im getting this Error when im entering the Water:
NullReferenceException: A null value was found where an object instance was required.
water.OnTriggerExit (UnityEngine.Collider col) (at Assets/water.js:11)
On the water is this script:
function OnTriggerEnter (col : Collider)
{
var controller : ThirdPersonController = col.GetComponent(ThirdPersonController);
if (controller != null)
print ("enter");
}
function OnTriggerExit (col : Collider)
{
var controller : ThirdPersonController = col.GetComponent(ThirdPersonController);
if (controller.IsGrounded != null)
print("We are grounded");
}
Some different collider other than your collider object with the "ThirdPersonController" script is hitting your trigger. function OnTriggerExit (col : Collider) { var controller : ThirdPersonController = col.GetComponent(ThirdPersonController); if ( controller ) { if (controller.IsGrounded != null) print("We are grounded"); } else { Debug.LogWarning( "Something else is hitting this trigger : " + col.gameObject.name ); } } do the same for OnTriggerEnter
– AlucardJay* 1 / DON'T POST COMMENTS AS ANSWERS * 2 / Watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers Please don't post comments as answers. Post comments by clicking the [add new comment] button, a window then open for you to type in. Answer fields are for answers only, as this is a knowledge base. Here at Unity Answers, Answer means Solution, not Response. Please watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers I have converted this to a comment for you. Also you don't have to wait for a moderator to approve a comment.
– AlucardJay