Jump to content

Best way to generate GameObject when using spawner


dodger8000

Recommended Posts

Hi, I have a script that will generate a building for me with random things.  How can I link a spawner so when I add things it runs the script to get an object to place and then places?   Can I do this?

Link to comment
Share on other sites

Hi @dodger8000, it is possible to spawn "Spawn Extensions" with a spawner. A Spawn Extension allows you to spawn a prefab with a script on it that runs your own code at the moment of the spawn. The script needs to implement the "ISpawnExtension" interface so Gaia can call it correctly. Please see here for an example where we set up Gaia to call GeNa to spawn things:

https://canopy.procedural-worlds.com/library/tools/gaia-pro-2021/written-articles/advanced/spawn-extensions-calling-gena-from-gaia-r136/

But instead of GeNa you could also call your own code to do things at each spawn.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...