- Home /
Question by
rushikesh90 · Aug 16, 2011 at 10:42 AM ·
gameobjectscene
Calling function from another scenes gameobject
I am trying to call a function from scene instructions gameobject backbutton, but when I do so it gives me error "NullReferenceException: Object reference not set to an instance of an object". I cant attach a gameobject because it belongs to other scene. What should I do?
My code is var objaScript:BackButton =GetComponent(BackButton); objaScript.OpenLevel("game1"); which I am using to open a new scene, and function open level belongs to script backButton and linked to button gameobject from the scene instructions.I am trying to call the function from scene menu.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612181851im_/https://answers.unity.com/themes/thub/images/avi.jpg)