- Home /
Question by
Nerethar · Jan 19, 2013 at 01:42 AM ·
c#waitforsecondsclassesmonobehavior
Use monobehavior functions in own classes
Hi guys, its me again.
And again I got a problem with custom classes and the wait function.
I got some new classes like this:
//My Parent Class, its mainly for all the other classes to //inherit from
public class A{
//some stuff
}
//some classes with actual functions
public class B : A{
//some stuff
}
public class C : A{
//more stuff
}
I create some of my B and C classes in a simple function from a class that inherit the MonoBehaviour.
it looks like
B test = new B();
B.CallAFunction();
B.CallAnotherFunction();
...
Well, now to my big problem: I want to usw the yield WaitForSeconds(x) in my classes B and C. A simple solution would be that A inheritates from MonoBehaviour. The problem with that, is that you can't use the new operator to create a new instance of an object of B's and C's then since MonoBehaviour won't allow that.
The question is, how can I create multiple objects from Typ A, B and C with using the yield WaitForSeconds(x) in it?
Thanks for any help.
Comment
Your answer
