var newObject : Transform;
private var cubeCount = 0;
function Update () {
if (Input.GetButtonDown("Fire1")) {
Instantiate(newObject, transform.position, transform.rotation);
Debug.Log("Cube created");
cubeCount++;
}
}
This code is in the scripting tutorial, and it says that the private var cubeCount will show up in the Inspector while running the game. I tried this out, but it did not appear. Can somebody tell me where to look to find this? Viewing hidden variables would be quite handy!
If you want to only view it and not modify it at all, change the Inspector to Debug Mode.
If you want to be able to change the value in the Inspector, it cannot be `private`. You must explicitly set it to `public` (which shouldn't affect your script in any way, if you change that). `private` is also implied, you don't need to specify it if you don't want to, you could just do `var cubeCount = 0;` if you want to. Nevermind, `public` is implied, not private...stupid UnityScript...
Just wanted to point out the private variables can be changed via inspector, in c# I can accomplish this task by adding [SerializeField] in front of a private iVar like so “[SerializeField] private Texture textures;”.