Forum rules - please read before posting.

Change character from a scene to another.

Is there a way to move an NPC from one scene to another?
We can only think of creating the character again in the second scene and control its visibility/invisibility with a variable. We would like to avoid duplicating the character.

Comments

  • Not in the same way you can move Players, but you could try using the Object: Add or remove Action to load him in at runtime from a prefab.

    However, that's not ideal because you want scene objects to refer to him easily - e.g. Cutscenes that might move him to Markers are much easier when working with a scene object.  Having an instance of a shared prefab in each scene is a Unity "best practice" too.

    If you're talking about re-creating his Interactions, know that you can set any Hotspot component's Actions source field to Asset File, so that you can rely completely on ActionList assets - so that you can use the same Actions regardless of which scene he's currently in.
  • Hello,

    we managed to create a prefab of the NPC we wanted to move to another scene, and an ActionList with the conversation and interactions. Then we assigned the prefab to each Speaker field in the Dialogues and everything seemed to work.

    But now we noticed the NPC subtitles appear following the position of the NPC's first scene instance (this position is the same as the prefab), and not the correct position corresponding to the second scene. If we change the prefab's position to match the second scene, the first one is incorrect, so it's a circular problem. We also can't assign any particular instance of the NPC to the actionlist's dialogues Speaker field because it gets reseted.

    What's the correct approach here? We guess we're doing something wrong.

    Thanks!
  • Make sure that you have Retain in prefab? checked in the NPC prefab's Constant ID component(s).

    The Constant ID component is how AC "finds" objects that are scene-independent.  If you check the above box, any instance of the prefab will always share the same ID number in any scene it's placed in.

    Actions that refer to such objects do so via the "Recorded Constant ID" value beneath their fields - not by the actual object field.  Once the "Retain" box is checked, make sure all Actions refer to this ID and see if it then works.  Otherwise, you'll have to provide images showing the set up you have, as without knowing more I can only give very general advice.
  • That fixed it, we didn't notice the ID difference. Thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.