Home > other >  How do I let the public values of Prefab code will not be a permanent change
How do I let the public values of Prefab code will not be a permanent change

Time:09-27

If a variable using the public, you can see this variable in the Inspector
Then assigned to its value in the Inspector, this value can be assigned to the code
But if change the variables in the code, the values in the Inspector will permanently alter
Game starts next time, don't use the start value given by the
How to avoid in the code changes permanent public variables affect the Prefab?

CodePudding user response:

Already make a Prefab, and use it every time you generate, generate to the assignment, when not destroyed,

CodePudding user response:

Isn't in the Start or Awake to variable assignment, it will be overwritten each time you Start the fall assignment in the inspector

CodePudding user response:

Prefab into the scenario is to use Instantiate to Instantiate
It only change the instantiated object script corresponding public variables can
Do not change the script for the prefab directly, only change it copy the object's script
  • Related