Reputation: 3499
Is it possible in Unity3d to make a variable visible in the inspector but not to other classes. I want the variable to be private to other classes but it still needs to be set in the inspector.
Upvotes: 1
Views: 88
Reputation: 8251
Yes, you can achieve this using SerializeField:
For C#:
[SerializeField] private Type name;
For JavaScript:
@SerializeField
private var name : Type;
Looks like Unity even has a short video tutorial on this topic.
Upvotes: 2