This function is called immediately every time the object/component is constructed on each client instance, whether it was created locally, synchronized from remote location or loaded.
Any of its modifications are not synchronized and as such should be deterministic and not depend on any external state. Any data model additions/deletions are not permitted during its execution.
It is useful for initializing default values for the sync elements of the object/component, before any loading or non-deterministic state changes are performed.
It can also be used to setup any local hooks, events and helper objects.
This function is called for all newly constructed objects/components in the scene during the startup phase of the update cycle. It is called for every user in the world, but any state modifications are permitted and synchronized.
It is called after each construction, whether created locally, synchronized or loaded.
This function is called when the component is attached to an object, before AttachComponent<T>() function returns control. It is only ever called once for each component, when it's first put into the data model, for the user who actually attached it.
Any state modification is permitted and is synchronized to others. It doesn't get called when the object is loaded or synchronized to others.
It can be used to do any initial setup that the component needs, that requires arbitrary changes to the data model (creating new objects, attaching other components) or non-deterministic initialization of properties (e.g. initializing them with random number generator).
This function is called for every user on every frame. It can be used to perform any per-frame logic.
If you want to perform the changes only for particular user, you can use the LocalUser property to check which user is currently executing the code, or LocalUser.IsHost if you only want to execute them on the host.
This function is called anytime something changes on the object/component, for each user where the changes occurred. The changes could be either local or remote.
It's not called immediately after the change, but called in batch after all the other updates run, so if multiple things are changed on the component/object during a frame, it only gets called once for all of them.
This is useful for updating any state that depends on some other states or state of the component, but doesn't change every frame.