Hey guys, i have a class (enemy), and i use new to create them in code. It’s a C# script, not deriving from MonoBehavior, since that makes it not possible to use “new” to create an object of the class.
I’m trying to add a function which would run once per second, and I’ve done it before with starting a coroutine, and using waitforseconds, so that part is all ok.
How can i make this work, either by changing my class to : MonoBehavior (in which case i don’t know how to create objects of the class in code), or perhaps using a separate script that derives from MonoBehavior and only starts the coroutine via a method.
This was very simple when my code was all in one script, but since i’m trying best practices, it’s now somehow much harder to handle the interactions between objects. Newbie stuff, but your help is appreciated nevertheless!