How Create a menu in script and inspector ??
Hi Guys.
I would like to create this.
I said that I am a beginner in C #
can you help me! :)
thx :D
Answer by Namey5 · Sep 17, 2016 at 11:26 AM
Well, one way of doing it would be to create a serializable class as a container of sorts, i.e.
[System.Serializable]
public class MyVariables
{
int number;
bool toggle;
}
//And then in any other scripts
public MyVariables myVariables;
Answer by Killer36016 · Sep 17, 2016 at 12:02 PM
and if I want to call a variable how I done ??
[System.Serializable] public class MySerializable { public bool MyVariable = true; }
public MySerializable Serializable;
void Start () { MyVariable = false; }
Well, you would access it as you would any other class, i.e.
[System.Serializable]
public class $$anonymous$$ySerializable
{
public bool myVariable = true;
}
public $$anonymous$$ySerializable serializable;
void Start ()
{
serializable.myVariable = false;
}
Your answer
Follow this Question
Related Questions
Destroy gameobjects several times in a scene. Also destroy other instances of that gameobject. 2 Answers
public bool not showing in inspector 1 Answer
I have assigned it, but I get an error of Unassigned Reference Exception! 1 Answer
I have problems with scripting movement, anyone can help me? 0 Answers
How to make an object fall after a delay?,How to get the object to fall after a certain time 1 Answer