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!
↧