- Home /
Script Default References vs. Object Variable References?
Just a quick item that I'm confused on (sorry if this is really basic, but the book I read doesn't address the purpose of this...):
A script shows Default References for variables. If I attach that script to an object, it, too, shows References for those variables in the Inspector, where they can be specified. Furthermore, if I make that object into a prefab, now I've got three places for such References: the script, the prefab, and the instantiated prefab in the Hierarchy.
So, why are there three places to specify References? And, must I specify the values for those References in all three places? Thanks for any clarification.
Answer by roamcel · Jan 13, 2012 at 10:15 PM
Default values are the values that the script sets those references values when the script is attached to anything.
An instance normally precedes a prefab, since you make prefabs out of customized instances, so basically you change an instance preferences to the desired scene values, and then you make a prefab for it.
Because of the above, once you create a prefab, your references should be set to their meant and correct values, but fundamentally you need to just set the 'instance' references only.