I have a prefab object that I load into memory, and then I apply some changes to it (initialization stuff), and then I send it to an object pooler to load a bunch of copies into memory for game play.
Unfortunately, I have learned that my Initialization changes on the prefab are not reflected in the copies, which now I see as obvious, and presents me with a challenge.
I want a general solution for my pooler to instantiate my gameobjects, AND, perform initialization of object variables based on the prefab that I send to it. Is there a design pattern that the community uses to achieve initialization on prefab objects created via Instantiate()? I am considering a generalized interface where the (master) prefab object accepts a copy of itself to copy public variables across. Just wondering what others may have done to solve this problem.
↧