- Home /
Executing code on prefabs that are never instaciated + data loss
I have been using this interesting approach of having prefabs that reside in the project. Each prefab has a script that contains behavior and references a scriptable object which contains the defined behavior (like a preset). Recently I have noticed the prefabs data being corrupted, the prefabs loosing reference to their scriptable object properties and other unwanted behavior.
I am assuming that these problem stem from the prefab running code (instead of an instance doing that) and thus modifying the prefab instead of an instance. Now I want to continue keeping the definition of this behavior outside of the scene.
If you have made experiences with this sort of behavior or have any ideas how I can keep my system procedural without having to instanciate a bunch of stuff that would be neat. I was thinking of moving the logic to scriptable objects as well although that would be a bit of a compromise and I am not sure if that makes sense at all...
Your answer
Follow this Question
Related Questions
Instantiation in C# 1 Answer
prefab always instantiates at 0.0.0 1 Answer
Setting the parent of a transform which resides in a prefab error 1 Answer
prefab instantiated by script containing ShadowCaster2D bugs out 0 Answers
Modifying a prefab 0 Answers