So I'm using a CustomEditor setup to make a Spawn Point manager. I've got it setup to add spawn points in a scene (let's call it Room 1), no problems there. What I need to do next is load up a different scene (Room 2) and make a door interact reference a spawn point from Room 1. I have all parts of the equation setup except for how to get a list of spawn points in Room 1 while I'm editing the Room 2 scene.
Is there a way to call up a query of the values setup in an object in Room 1 scene while I'm editing Room 2 scene? Keep in mind this is in the editor/inspector, not while the application is running, so I don't think player prefs and DontDestroyOnLoad will help here.
Any thoughts? Thanks!
Is there a way to call up a query of the values setup in an object in Room 1 scene while I'm editing Room 2 scene?
No, you can't. The editor let you open one scene at the time. You can consider different scenes as different worlds. You can add the content of a scene to the current opened scene, using EditorApplication.OpenSceneAdditive. Btw this isn't useful for your case, since the object of the scene added are copied inside the opened one.
If you need to share objects between scenes you have 2 ways to do that:
What I would do in your case is, more or less, the following:
GameObject
with attached a Component called SpawnPointManager
.Prefab
from the created GameObject
.Prefab instance
of your manager.SpawnPointManager
Component
from a custom inspectorSince all your Prefab instances
are linked to the same Prefab
, even if they are in different scenes, basically the share the same object (accessible from the inspector). So if you modify the prefab
it self (or an instance of it and apply the modification back to the linked prefab), all your prefab instances (even in the different scenes) will see the modifications and will update accordingly to the linked prefab.