- Home /
Design pattern: Loading custom data into prefab objects
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613184643im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Does Unity support application bootstrapping? 1 Answer
Static Initialization 1 Answer
Initialising List array for use in a custom Editor 1 Answer
Why do my first few collectable/powerup collisions cause lag but not later ones? 1 Answer
Game "hiccups" when pooled game objects are used for the first time. 0 Answers