Quantcast
Channel: Latest Questions by gdbjohnson
Viewing all articles
Browse latest Browse all 24

Design pattern: Loading custom data into prefab objects

$
0
0
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.

Viewing all articles
Browse latest Browse all 24

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>