- Home /
Data with reference to scene objects: Monobehaviour or ScriptableObject?
I am developing the mission system for my RPG videogame. Now, missions are primarily composed by data (mission name, description, number of tasks, type of tasks...) so I thought to use ScriptableObjects, since I know they are supposed to be used to store data. The issue comes when I need to reference some objects (mainly components) within the scene: NPCs assigning missions, Colliders concluding mission objectives when triggered, and so on. ScriptableObjects are assets, and therefore cannot reference objects in the scene; however, theese data are part of mission data. So, which is the right way to handle them? Using Monobehaviours to directly reference objects in the scene (though attaching mission data to unnecessary gameObjects, slowing down hierarchy traversing), or using ScriptableObjects to indirectly reference theese objects with custom IDs (though working in a much less intuitive and more complex environment)?
P.S. I also know that Monobehaviours are serialized somehow differently from ScriptableObjects, but I still don't get if that would be a problem considering the large amount of references from other objects to mission data.
Answer by Casiell · Oct 19, 2018 at 08:11 AM
I would use a mix of those. Have an object that references all object you need for a mission and it will also reference a ScriptableObject which contains all the independent data (name, description etc)
Your answer
Follow this Question
Related Questions
ScriptableObject stored in MonoBehaviour lost on quit 1 Answer
[Solved]How to serialize Dictionary with Unity Serialization System 6 Answers
ScriptableObject : Serialized Polymorphism Classes Can Not be Deserialize with Polymorphism 1 Answer
Difference between assigning a value in inspector and with a custom editor script 1 Answer
Scriptable Objects in networks. 0 Answers