- Home /
How do you save a reference to a prefab's script in a ScriptableObject?
So, I have a ScriptableObject class called "Template" that stores a reference to a script on a Prefab. You can see it here: http://i.imgur.com/qjfJ4eA.png
It's the first field, the "TileMarker". That script is located here, on this prefab: http://i.imgur.com/VszE3v0.png
And here is the inspector view of that prefab, showing the "TileMarker" script: http://i.imgur.com/G42qmCj.png
Notice that the "TileMarker" script also has a field that points back to the "Template" which is the ScriptableObject. So, this all works fine until I save the project, exit, and come back. For some reason, the "Template" loses its reference to the "TileMarker" after saving and exiting: http://i.imgur.com/zoysakN.png
Strangely enough, the "TileMarker" doesn't lose its reference to the "Template". Only the ScriptableObject pointing to the Prefab's script loses the reference. The prefab script pointing to the ScriptableObject is fine. Is this a quirk of ScriptableObjects? Can they not store references like this permanently? Is there a way to work around this?
Thank you very much in advance for any help you can give.
Your answer
Follow this Question
Related Questions
How to Update ScriptableObject 1 Answer
Multiple Cars not working 1 Answer
Referencing in a prefab 1 Answer
Polymorphism with generic ScriptableObjects? 1 Answer
Reliable way to detect when the game starts playing on a ScriptableObject? 1 Answer