Jump to content

Specifying layer in which Game Object instances are spawned


mroshaw
 Share

Go to solution Solved by Bryan,

Recommended Posts

Hi again!

I'm continuing my quest to build my own Desert Biome, using assets I've acquired from the store.

Hopefully a quick and simple question: how do I specify the layer in which Game Objects are spawned by a Spawner or Spawn Rule? Is it simply a case of setting the layer on the prefab? Is there a way to configure a Spawner to spawn prefab instances to a specified layer?

Many thanks again!

Oli

  • Unity 2021.2.6f1
  • HDRP 12.1.2
  • Gaia Pro 2021 3.1.4
Link to comment
Share on other sites

@mroshaw You can manage that by going into the spawners and using the visual tool for that spawner (eye to the left of the color picker).  There are masks that are impacted globally for the entire spawner or just on a spawn object basis.  There are different masks you can apply if inital settings are not getting you what you need like a height mask to manipulate it specifically within a height range, etc.... It's pretty powerful and when you get to messing with the curves along side of the masks, any combination or just one mask, its even more powerful, but obviously a gets a little more complicated to set up.  Once you are happy with something from the spawner settings, best to save that spawner by itself as well as the stamp settings if applicable. 

As for the prefabs and what not, you can do it in the spawner itself.  Take a look at one of the village spawners PW shipped with the asset.  Theirs are a little more complex than one might initially want but you can learn a lot from them.  Just add one of them to your scene via the Gaia Manager (Control-G or click it at the top of your scene window or tools, procedural worlds, gaia, gaia manager). If you use the gaia manager, select the Advanced Tab and then select Gaia Tools and select the fold-out for Add Existing Spawners.

Link to comment
Share on other sites

Thanks for the reply, Mike!

I think you may have misunderstood my question. What I was trying to find out was whether I could configure a Spawner to spawn game objects into a specific layer, or whether the layer of a spawned object is purely determined by the layer setting of the game object prefab.

That is, the "layer" property as highlighted here:

image.png.a9faf0f9b17ddcab4195ef377ae2ef30.png

Which in turn relates to the Game Objects that have been instantiated by the Spawner:

image.png.552761c43b5ab626b513052558c8e892.png

So my question is, in the scenario above, can I configure the Spawner to set the prefab instance layer to the "PW_Object_Medium" (or something else, per Spawner or Spawn Rule) or do I have to set the layer directly in the prefab and that's the layer in which the instance will be spawned?

Thanks again!

  • Like 1
Link to comment
Share on other sites

  • Solution
4 hours ago, mroshaw said:

Thanks for the reply, Mike!

I think you may have misunderstood my question. What I was trying to find out was whether I could configure a Spawner to spawn game objects into a specific layer, or whether the layer of a spawned object is purely determined by the layer setting of the game object prefab.

That is, the "layer" property as highlighted here:

image.png.a9faf0f9b17ddcab4195ef377ae2ef30.png

Which in turn relates to the Game Objects that have been instantiated by the Spawner:

image.png.552761c43b5ab626b513052558c8e892.png

So my question is, in the scenario above, can I configure the Spawner to set the prefab instance layer to the "PW_Object_Medium" (or something else, per Spawner or Spawn Rule) or do I have to set the layer directly in the prefab and that's the layer in which the instance will be spawned?

Thanks again!

Hey there. 

Yes you can do this. 
You would want to click on the prefab that is used for the resource. 
image.png
 

Go to the original: 
image.png

Set the layer here, and then apply it to the biome. 
The spawned object will have the correct layer. 

 

  • Like 1
Link to comment
Share on other sites

  • Ben Black locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...