- Home /
Public variable hidden in the inspector
Is there a way to see this variable in the inspector? e.g:
public string pigName {
get {
this.gameObject.name;
}
}
I want to see the variable in the inspector for debug purposes and I don't want to change the inspector to debug mode all the time. Someone can help me ?
Comment
Best Answer
Answer by NoseKills · Aug 10, 2015 at 08:32 PM
You can't
But you can set a Label Icon to a GameObject so you can see it's name in the scene view at all times
Answer by RLin · Aug 10, 2015 at 08:16 PM
I believe that you can place [SerializeField] above the code like this:
[SerializeField]
public string pigName {
get {
this.gameObject.name;
}
}
Your answer
Follow this Question
Related Questions
Problem About Get and Set Methods 0 Answers
string + int = variable 2 Answers
Change multiple variables with function argument 2 Answers
Are properties variables? 1 Answer
When to use SETters and GETters 2 Answers