- Home /
About to start a new project, need help...
I am about to begin developing a rythm-based game for Android and iOS. It involves a lot of things happening at set amounts of time. Now, the only knowledge I have for programming with time is by the use of coroutines. But I am not going to use about 60 coroutines per level, which will suck, never mind being inefficient. So my question is...
How can I have a single GameObject, at the very right of the screen, that will instantiate objects every set amount of time? Can this be dynamic, for example, instantiate GameObject "A" every 2 seconds for 8 seconds, then instantiate GameObject "B" every 4 seconds for 8 seconds?
The help I receive now will determine my future success. Thank you all so much :D
Oh and just as a side-note, I only have experience with C#, not JavaScript, however I can convert the scripts if they were not too complex.
Answer by robertbu · Mar 01, 2014 at 03:36 PM
There are a lot of different ways to do what you want, and there are too few details of your game for a recommendation. From this limited context, I'd probably use a language for each event either entered in a text file or in an array of string in the inspector. The lines could look like:
A,2
A,2
A,2
A,2
B,4
B,4
Then you simply parse the string, Instantiate the object specified (or get it from a pool), and wait the time specified.
But there is an underlying issue of synchronization. I'm guessing that you want to synchronize your game object to the music. I'd be very concerned about how Unity's timing matched up with the music playing speed. I know there have been posts on the issue.
Perhaps you need to describe your game more fully in a design question on Unity Forums.
Well, that seems to clear things up :D
Please convert your comment to an answer so I can accept it :D
Your answer
Follow this Question
Related Questions
Unity: C#: Eyes look at mouse: HELP!! 3 Answers
Changing gravity direction... 5 Answers
Distribute terrain in zones 3 Answers
C# Fourier transform rhytm game implementation? 1 Answer
Multiple Cars not working 1 Answer