- Home /
[Bug?] Prefab Instantiates with wrong public variables
Hey everyone, I have a main character prefab that I've been instantiating on start without problems for months. Recently, she's been instantiating with her public move mult and public gravity mult variables magically changed so that she moves really slow and falls really fast. Normally, I'd post my code and ask for help... BUT, here's where it gets weird: While in play mode, I clicked on the prefab instance in the hierarchy to check if the variables had changed, and she instantly started working as normal... Just from clicking on her instance in the hierarchy. I've found that once she is normal again, if I press pause then press maximize on play, as soon as I press play, it maximizes, the problem returns. This seems like a bug in the editor. Any ideas?
Thanks
Hey, I have the same problem. Did you resolve it?
Thanks
Answer by tormentoarmagedoom · Sep 29, 2017 at 10:14 AM
Hi @belamessex !
It is really strange, can you say me where do you initialize the values? when declaring the variables? or at the Start function? or where? And can you check in editor without runing, if the variable value at the inspector is the same as int he script.
If you initialize a public variable when declarin that variable, but you have a diferent value in the inspector, the value that will be loaded is the inspector value. You have to initialize the value at the Start funcion to provent this.
But this problem that disapear while clickiing the object during runtime... is so strange. Maybe you should take a look at Bug Report Page.
Bye!! :D