Hi all,
This is making me feel rather stupid at the moment. I’m converting a script from JS to C#, and there’s a Destroy() call that’s giving me grief. Can anybody see what’s wrong? (I tried searching the forums for an example of Destroy() in anybody’ script examples, but could only find JS uses…)
This function does stuff, instantiates an explosion, destroys the current gameObject, and returns a value.
(Some names have been changed to protect the innocent. Or, at least, to reduce visual clutter.:-))
public class SomeClass : MonoBehaviour {
...
public int SomeFunction(){
...
GameObject kaboom = (GameObject)Instantiate(explodyPrefab);
Destroy(gameObejct);
return someInt;
}
}
However, I’m getting this error on the Destroy() call:
I’m quite sure I’m just missing something as blatently obvious as the nose on my face, and like said nose I’m having trouble seeing it without an appropriate mirror. Tried all the variants that seemed logical…
Help appreciated!