Timeline for Instantiation taking too long?
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 13, 2015 at 4:05 | vote | accept | Zee | ||
Apr 27, 2015 at 3:44 | comment | added | tbkn23 | That's not true. Like I said, maybe there is a problem with the thing you are instantiating. Just for testing purposes, why don't you try to instantiate from basictable in SpawnB? | |
Apr 26, 2015 at 14:24 | comment | added | Zee |
Hmm, what you say is logic, but what happens is far from being logical. Right now I just realized that : Instantiate (xxxx); StartCoroutine("Delay"); The program would actually go to the delay, wait for x seconds, and THEN come back and instantiate the object. How logical is that?
|
|
Apr 26, 2015 at 14:06 | comment | added | tbkn23 | Thats not true, Updates in unity are Synchronous, the next update (or the update of the next object) will not run until the first one is complete. Your problem is probably that you don't want to spawn one every frame. You could use a coroutine, but put them all in a single coroutine, the jumping around between coroutines like you do seems a bit overcomplicated and is a recipe for bugs, like the one you have. | |
Apr 26, 2015 at 14:04 | comment | added | Zee |
I don't have an update anymore because of that, and it was just like this one. Like this : void Update() { if(boolvar) { spawnB(); boolvar = false; } } But because of the nature of Update, even if I make the variable false right inside the if statement, it would update too fast, causig it to spawn the object 5 or 6 times before actually realizing it shouldn't. Even FixedUpdate wouldn't work.
|
|
Apr 26, 2015 at 13:54 | comment | added | tbkn23 | Paste the update code and we'll see why it's called more than once | |
Apr 26, 2015 at 13:36 | comment | added | Zee | For the DelayedSpwn it's an error I made when I pasted the code here and made a few edits. I apologize! And for the complextable, I don't have any null objects.. And I'll try to do as you suggested. The problem is that when I was using the Update() method, the functions would be called several times, I only want it to be called one time. | |
Apr 26, 2015 at 8:11 | history | answered | tbkn23 | CC BY-SA 3.0 |