- Home /
Creating a Prefab and Keeping Original Objects Script Information
Here's my second question on Unity Answers. Not so much a scripting problem I'm having, but a problem about attached scripts.
I have this Turret model completely structured and attached scripts in my scene right now. However, my end result will have the user clicking on the environment to place a Turret, much like a Tower Defense game.
The only way I know to do this is to Instantiate a prefab of the original Turret from my scene, which has scripts attached to it for information regarding various systems it needs to access.
When I create a Prefab from this original Turret, the only things that these scripts retain are all Int, Float, and 3 out of 4 var : Transform; There's 1 Transform, 1 GameObject, and 1 Component missing from the prefab that's inside the original object sitting in my scene.
Why will the prefab not retain all the information I need in these scripts?
p.s. I'd rather not hard code the locations of the missing information into the scripts, as these scripts will be used universally for multiple configurations. Being able to change the information depending on the object the script is attached too is a must-have. Thanks in advance! -Kit Weiss