Thanks for bring up this question. Upon a worker transfer, only your schema defined component properties will carry over. The state of your MonoBehaviour scripts will not carry over.
Your previously authoritative worker
A will either lose authority over your entity
X but still see it (in which case your
X will remain in
A's scene but all scripts requiring component writers will be disabled) or
X will be completely removed from
A's view (in case A is not supposed to see
X anymore after the authority transfer, in this case, the behaviour is identical to when the entity is completely deleted from the point of view of
A). In both cases
OnDisable() is called on all scripts requiring a writer. In the latter case,
OnDestroy() is called on all scripts attached to
At the side of your worker gaining authority (worker
B), your entity is either freshly added to the scene, at which point
OnEnable() is called on all scripts. (For
A the behaviour is the same as if the entity was freshly created for the entire simulation) The component values of
X from the point of view of
B will be the canonical component values of the simulation. In case
A has been aware of
X before (but just hasn’t been authoritative over it), all scripts which require a writer are now enabled while all other scripts are enabled already. The component values of
X have been kept in sync with the canonical values of the simulation until that point.
What happens inside a worker stays inside a worker, i.e.
B doesn’t know what is happening locally to
A. Only schema defined component values are synced, i.e. if
X's canonical component values, the values will also change on
B's side. When it comes to the
TargetNavigation behaviour, your analysis is spot-on. We are saving (among others) the position an NPC is supposed to move to because that information would otherwise be lost if an NPC changes workers mid-transition.
In case of commands, a command will fail during an authority transfer, i.e. If you send a command and your worker loses authority on the component before a command response is received, your command callback will immediately be invoked with an error message telling you so. For more information on that matter, please see: https://spatialos.improbable.io/docs/reference/10.1/workers/commands
Hope this helps,