Jump to content
  • Sign Up

    Welcome to CANOPY.

    Browse the Forums, read articles in the Library, share your work in the Gallery, get the latest in Downloads

    Want more? Subscribe!

    Check out our Offer! All our assets for a fraction of their asset store purchase price.

  • Spawn Extensions: Calling GeNa from Gaia


    Peter
     Share

    A spawner can add different type of resources to your scene. One possible resource is a "SpawnExtension" which allows you to execute your own code whenever Gaia spawns at a certain position. If you own both Gaia and GeNa, you can use Spawn Extensions to call GeNa spawns from Gaia. This article explains how to set this up.

    1. Prepare your GeNa Spawner

    Prepare your GeNa Spawner that you want to call from Gaia - make sure that it spawns like you intend it to do when you press Ctrl + Click, and turn it into a prefab e.g. by dragging it into the project hierarchy. We will need this prefab later to reference the spawner from within Gaia. For this example we can use a simple cube spawner that just spawns a couple of unity cubes:

    image.png

    Please note: Make sure the spawner does not have any restrictions that hinder your intended spawning - if your spawner for example has a height spawn criteria set up that only lets it spawn within a certain height range, that limit will still apply when the spawner is run through Gaia, and will then also only spawn at that certain height range.

    2. Prepare the Spawn Extension Resource / Prefab

    Gaia does not work with the GeNa spawner directly, but it uses a special component that contains the logic to call a GeNa spawner. We need to create an empty game object, add the special component "GeNa to Gaia Spawner Extension" to it, and then assign the spawner prefab created in step 1:

    image.png

    Now create a prefab from this new game object as well. This is what we will assign in the Gaia Spawner in the next step.

    image.png
     

    3. Assign the Resource Prefab in the Gaia Spawner

    In the Gaia spawner that you want to use to call the GeNa spawner, create a new spawn rule that uses a resource of the type "Spawn Extension". Assign the prefab there that we created in the previous step.

    image.png

    That completes the setup part.


    4. Run the Gaia Spawner

    You can now run the Gaia Spawner, and it should call the GeNa spawner repeatedly across the terrain:

    image.png

    Note that you can now use this spawn extension similar to spawning Game Objects with Gaia. You can apply Masks in the spawner, and the GeNa calls will then be restricted to this area only:

    image.png

    image.png

    You can also clear the spawns again from the spawner etc. You can create a spawner exclusively for those GeNa spawn calls, or you can put the Spawn Extension Spawn rule into any other spawner.

    For Programmers: You can take a peek at the "ISpawnExtension" interface. If you create a new Monobehaviour that implements this interface, you can call it from Gaia just in the same way as demonstrated above. (Create a new empty game object, attach your monobehavior, turn into prefab, assign into Gaia spawner as a Spawn Extension resource)
    This allows you to integrate your own or 3rd party tools for spawning into Gaia, or do things like placing a game object, and then do advanced setup / initialization on that Game Object before moving on to the next spawn.

     Share


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...