lemmons
New Member
Posts: 16
Posts: 16
|
Post by lemmons on Mar 18, 2019 19:11:03 GMT
Is there any way to adjust variables on my prefabs from the Wave Settings menu? Specifically, I've got a few enemies who move differently or use different abilities based on certain parameters. To capitalize on pooling and not needing to make hyper-specific prefabs I'd love to be able to recycle these same prefabs over and over in the scene and just switch on or off bools and change values of ints. I can write up some code that makes this work, but it's getting very hairy and I wanted to see if there was an easier way before going all the way down this road.
|
|
lemmons
New Member
Posts: 16
Posts: 16
|
Post by lemmons on Mar 18, 2019 23:24:20 GMT
Follow up question: to try and lessen the load I created some empty objects and attached a script on them to spawn the prefabs and alter some variables. This resulted in me making like 9 essentially blank prefabs which only contain scripts to spawn custom instances of the prefabs. So I loaded all 9 of them into Pool Boss and the first wave will load but if I add any more with this prefab of just a spawning script it skips all of them and goes straight to "level complete". I'm wondering if there's something like a sprite or rigidbody that needs to exist on a prefab for Level Wave Settings to "see" it? I played around with other prefabs and it works fine, it's just these empty spawner scripts that trip it up.
|
|
|
Post by DarkTonic Dev on Mar 19, 2019 16:10:37 GMT
Is there any way to adjust variables on my prefabs from the Wave Settings menu? Specifically, I've got a few enemies who move differently or use different abilities based on certain parameters. To capitalize on pooling and not needing to make hyper-specific prefabs I'd love to be able to recycle these same prefabs over and over in the scene and just switch on or off bools and change values of ints. I can write up some code that makes this work, but it's getting very hairy and I wanted to see if there was an easier way before going all the way down this road. To adjust variables, you need to edit their values on the actual World Variable's Inspector. However, World Variables only have a single value that's shared among everything. So that might not even help you. If not, just use your own public variable fields.
|
|
|
Post by DarkTonic Dev on Mar 19, 2019 16:12:19 GMT
Follow up question: to try and lessen the load I created some empty objects and attached a script on them to spawn the prefabs and alter some variables. This resulted in me making like 9 essentially blank prefabs which only contain scripts to spawn custom instances of the prefabs. So I loaded all 9 of them into Pool Boss and the first wave will load but if I add any more with this prefab of just a spawning script it skips all of them and goes straight to "level complete". I'm wondering if there's something like a sprite or rigidbody that needs to exist on a prefab for Level Wave Settings to "see" it? I played around with other prefabs and it works fine, it's just these empty spawner scripts that trip it up. You need to read the Pool Boss documentation. Basically what you need to know is that Awake and Start only get called the very first time (not every time the prefab spawns), so any code that needs to fire on every spawn needs to go into the Pool Boss-only method OnSpawned. You will need to move initialization code there from Start probably.
|
|