Copy prefab and swap component BEFORE instantiation
I want to instantiate a prefab with a component BaseFoo, but swap out the component BaseFoo for my own MyFoo. This needs to happen before Awake() gets called on any other components in that prefab, as those Awake() methods contain`m_cachedFooReference = GetComponent()` - which would then be nullified if I tried to "delete BaseFoo + add MyFoo" on instances of the prefab. I need to keep the original prefab the same tough: while other places should always be instantiating the original prefab with BaseFoo, in this particular instance I want to instantiate a modified prefab with MyFoo.
This needs to be able to happen at Runtime; I cannot make a copy of the prefab in editor and do the swap there. I'm not sure if this is even possible, but I wanted to know for sure if it isn't :)
Your answer
Follow this Question
Related Questions
How to add a component from a Custom Editor object field to a Prefab ? 1 Answer
problem with lightmap in prefabs 0 Answers
Unity gets hang and nothing work in it, even I have to close it from the task manager 0 Answers
ECS Entity not shown in the scene 1 Answer
How To Reset Prefab Values after exiting Playmode? 0 Answers