0

I have a code like this:

public bool foodEaten=true;

I'm able to view it in the Unity Editor having a checkbox with a check. If I refer the same variable on a different scene, it asks me to change it to static. If I do that, I'm not able to view it in the Unity Editor. How will I do both in which I can still see the same variable in Unity Editor, but I'm able to refer it on a different scene. Thanks!

Mr. Tacio
  • 442
  • 1
  • 7
  • 18

1 Answers1

0

There is one simpel solution, you can make a local non-static variable "foodEaten_nonstatic" and give it the same value as the static one.

public void Update(){ foodEaten_nonstatic = foodEaten; } But you can't change the value of it in the inspector!

Linus Lep
  • 26
  • 1