Do we have an unique identifier for triggering a state on a FSM ?
I Need that for synchronizing state accross the network. For the moment I use an array of stateName to trigger all subStateMachine in order from the root to the real state but that need a lot of data (each name in string…) accross the network ^^.
Hello again and sorry for the late reply due to summer vacation.
All Nodes (and as such FSMStates) do have a property called “UID” which is exactly that, a unique identifier. It is still a string though just like state name is, since that UID is made with “System.Guid.NewGuid().ToString()”, but it is more convenient that using the state name for this case.
Please note though, that a UID is created only once after it is requested (meaning that once the property “UID” is accessed for the first time).
Please let me know if that works for you, for what you are after.
Thanks!
I hoped it would be a GUID created when editing the FSM. So all prefabs would have the same and to pass it throught network I could TriggerState with it. But if created on each client and different for each client… It’s useless for me :p
For the moment it work great, but I have to trigger all NestedFSMState with the path from the root … not really optimized ^^.
Hey,
Sorry for the late reply!
I can make it so that all nodes have a UID created for them automatically, without the need to first access the property.
This change can actually be made very simply, by changing the serialized “_UID” field in Node.cs like so:
I really don’t know, because of SubStateMachine. I will try to do this and will try to trigger state with the Guid when working on it.
I Will answer you again when tested (not for the moment, so much things to do >,< ^^ )
Author
Posts
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.