- Home /
How to spawn prefab from a single cache when using multiple caches?
Using AngryBots\Assets\Scripts\Managers\Spawner.js from Unity's AngryBots demo to store multiple prefabs into different caches to avoid slowdowns. Limiting this example to two caches for simplicity.
cache01 holds prefab of player fire objects. (Simplebullet.js is close enough, for example.) cache02 contains prefab of target objects. (Uses OnEnable() for random placement and vectoring.)
Start(){ // called once in the lifetime of the behaviour
InvokeRepeating("Spawn", timeToStartSpawning, timeDelayBetweenSpawns);
}
...is tempting, but results in "Trying to Invoke method: Spawner.Spawn couldn't be called.". And would spawn from both caches if it did work if I following the logic properly.
Spawning the player's fire is meant to be on demand. Spawning/Despawning from the target cache is to be continuous until levelEnd conditions are reached. (Timer in this example.)
How do I spawn from a single cache, basically within a container cache, without causing all to activate? Or am I going to have to brute force my way with SpawnTarget() and SpawnFire()? (Which seems like a bit of overhead as the number of caches increases.)
I have the same reason, Invoke works in all other places except one place, i tried changeing everything, but no use still the same happens. Any one has solution?!
Your answer
Follow this Question
Related Questions
Spawning objects help 2 Answers
Spawn Controller... 2 Answers
Player spawn after touching 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
spawning object as child of other:error 2 Answers