- Home /
How to set public variable value in a prefab
I've given a relatively thorough search for a previously asked version of this question but I've been unable to find one.
How do I ago about setting the 'prefab' value of public variable? I've built my prefab with a public float set to a specific value. I then save the prefab but upon instantiation the float is not the value I expect. How do I go about setting this value so that it is modified when the value is changed in the inspector?
Answer by tanoshimi · Oct 18, 2016 at 06:00 AM
Remember to "Apply" the changes made to any prefab.
I had tried that previously but I'll attempt again and see if it functions as I'd hoped.
You were correct. I had two public variables in two separate scripts that were causing confusion!
Thank you for the help!
Your answer
Follow this Question
Related Questions
How to access a variable from a game object once instantiated (C#) 1 Answer
How to force variables in a script to be unique to every instance? 0 Answers
Assign object in hierarchy as public variable in prefab 1 Answer
Set prefab to public variable of another script 1 Answer
Cloned/Instantiated GameObject's Losing Public Variables When Created? 1 Answer