- Home /
Question by
DumbLemon · Jul 10, 2014 at 08:51 PM ·
javascriptgame
How do i enter the UnityEngine.Transform instance?
When i start my game i get this message
Assets/Scripts/BallHealth.js(8,30): BCE0020: An instance of type 'UnityEngine.Transform' is required to access non static member 'position'.
And This is my script.
#pragma strict
var maxFallDistance = -10;
function Update ()
{
if (Transform.position.y >= maxFallDistance)
{
Debug.Log("Test");
}
}
Comment
Best Answer
Answer by robertbu · Jul 10, 2014 at 08:52 PM
'Transform' with an upper case 'T' is the class. The reference to the particular instance of the transform associated with the current game object, is 'transform' with a lower case 't'. So line 8 should be:
if (transform.position.y >= maxFallDistance)