Quantcast
Channel: Questions in topic: "class instance"
Viewing all articles
Browse latest Browse all 131

"Object reference not set to an instance of the object" yet I can see the reference is working in monodevelop

$
0
0
As title says, using this code to access a function in another script GameObject castAccess = GameObject.Find("castInt(clone)"); castInt castScript = castAccess.GetComponent("castInt") as castInt; castScript.removeSelf(); it returns the error Object reference not set to an instance, I have no idea which reference is not set to an instance as I have been through everything... monodevelop autocompletes the castScript.removeSelf(); call so it finds the removeSelf function in the other script on the other class... the object `"castInt(clone)"` is an instantiated prefab which has the script castInt attached to it, it's created on button pressDown and then the code here is called on buttonPressUp on top of all this I have identical code seemingly working identically in another scene that doesn't error! any insight would be fantastic!

Viewing all articles
Browse latest Browse all 131

Trending Articles



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