{
if (Input.GetKey("f")) // If the player is pressing the "f" key
{
// makes the object shrink.
Vector3 CurrentScale = transform.localScale;
Vector3 newScale = CurrentScale + new Vector3(0, 0. - 0.4);
Transform.localScale = newScale;
Debug.Log("Shrunk!");
}
}
It gives me a console error at the - line 5 (just says identifier expected), and a "object reference is required for the non-static field method or property "Transform.localScale’
i dont know what the problem is
Transform with a capital T is a class, if the class derives from MonoBehaviour, transform with a lowercase t is a reference to the game object’s transform which the class is attached to.
I’m guessing that you have used an uppercase in your code but have pasted it with a lowercase which is correct. Once you get past that though, floats need to be defined with an f at the end. So -0.4 will give an error, just add an f so it reads -0.4f instead.