I’m trying to write a class that uses Invoke(), but it’s a class that I need to be able to create arbitrary instances of without them being tied to a gameObject. Obviously, to use Invoke(), the class has to derive from Monobehavior, and for that to work, from the errors I’m getting, it looks like if you instantiate the object in script, then the gameObject member isn’t properly set for obvious reasons, and calling Invoke() will generate a null reference exception.
So my question is, is there any alternative to Invoke() that will accomplish the same thing without having to inherit from Monobehavior, and subsequently have to tie each instance to a gameObject?
Also, let me ask another question in addition to the above: I don’t know how Invoke() works internally, so how does it compare performance-wise (particularly on iPhone) to just updating a value that keeps track of how much time has passed and checking that value in each Update() call? I suppose that’s an alternative to Invoke(), but if you have lots of objects doing this independently, would it be faster or slower than many objects each with their own pending Invoke()/InvokeRepeating()?