#Probably due to Unity Serialization
1 messages ยท Page 1 of 1 (latest)
Is the struct/class marked as serializable?
There are no more usages than mentioned. Declared the BufferedInputAction on a vanilla demo script and invoked it in update thats all.
any context? lol
sure what you need ?
I.. don't need anything.. do you? :p
I have posted the initial problem outside of this thread, check that out incase you havent, So I have no idea what more context you need. Thus the question ๐
yes ofc, understanding of what the error is.
I meant more like, I can't see the original context
[Original Message]
I have this basic InputBufferAction struct which utilizes FrameSliceCounter which is also a struct. They work perfectly when I make them serializable or when I make them class (non-serializable) but break when they are struct and non-serializable.
For eg. in image the frameSliceCounter should count 15->14 then in next frame 14-13 and so on, with class and serializedStruct the state(frame Idx) is preserved while with non-serialized struct they dont. Any insights ?
Sorry I didnt knew since it loads perfectly in my instance, However I have reposted the original message.
@random geyser typically you'd want your structs to be immutable, but pretty sure you already know that.
As for the issue, it might be how you call HasFrameSliceExpired().
Like if you do:
void Update() {
var action = buffer[0];
action.HasFrameExpired(); // test
}
the struct would be duplicated, not affecting the one in index 0.. but likely you know that as well (?)
it could be a Unity Serialization issue if you're working in editor, but in runtime it shouldn't matter
ofc, I always assign carefully when using structs and im pretty sure that there arent copies being made in BufferedInputAction.
could you also post the code you use to call action.HasFrameSliceExpired just in case?