Referencing GOs in another simulator

Example:

I have NPCs with a public GameObject target.
The NPC can shoot/chase a player or another NPC.

Lets say npcA has npcB as target, but then npcB moves from simulator1 to simulator2.

How does npcA can keep the reference of npcB? Does the reference is somehow sent via the replicator?

Hey, so as long as npcB stays in the live query of the client that has authority over npcA then the reference to npcB that npcA has will not change even if the authority over npcB is transferred.

If npcB does go out of the livequery it will be deleted so npcA should be prepared for this. If you’re using live queries with a radius of 0 this will never happen, though.

From the point of view of the Unity code, the reference should just be a reference to the npc’s Transform, GameoOject or CoherenceSync which won’t change unless it is deleted the same as though you were in a single player game.

Thanks for the answer!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.