Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Calling another scripts function

$
0
0
I'm trying to call the DoorOpen function from the other script called DoorBehaviour function Update () { useDoor(); } function useDoor() { var doorScript : DoorBehaviour = GetComponent(DoorBehaviour); if(Input.GetKeyDown("return")) { doorScript.DoorOpen(); } } I keep getting the "NullReferenceException: Object reference not set to an instance of an object" error. What am I doing wrong? Thanks,

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>