Jump to content

How to spawn a prefab instance and still apply GeNa decorators


mroshaw
 Share

Go to solution Solved by Bryan,

Recommended Posts

Hi!

I've set up some GeNa spawners, spawning buildings from 3D Forge "interior and exterior buildings" asset packs. I've created custom prefab variants from the base prefabs provided, and use those prefab variants in my GeNa spawners.

Having spawned some buildings, I updated my prefab variant. I noticed that my changes weren't being reflected in my GeNa spawned instances. Digging down, it would appear that the spawned Game Objects aren't prefab instances at all but "unpacked".

I'm using GeNa decorators, so I need to use the "Prefab Unpacker" to then have the "Terrain Decorator" unpacked and applied.

Is there a way to have GeNa spawn a prefab instance, so that I can update my prefab variant and have the changes reflected in spawned instances, while still having my terrain decorator applied at the point of spawn?

Many thanks again!

Link to comment
Share on other sites

  • Solution
On 2/23/2022 at 5:02 AM, mroshaw said:

Hi!

I've set up some GeNa spawners, spawning buildings from 3D Forge "interior and exterior buildings" asset packs. I've created custom prefab variants from the base prefabs provided, and use those prefab variants in my GeNa spawners.

Having spawned some buildings, I updated my prefab variant. I noticed that my changes weren't being reflected in my GeNa spawned instances. Digging down, it would appear that the spawned Game Objects aren't prefab instances at all but "unpacked".

I'm using GeNa decorators, so I need to use the "Prefab Unpacker" to then have the "Terrain Decorator" unpacked and applied.

Is there a way to have GeNa spawn a prefab instance, so that I can update my prefab variant and have the changes reflected in spawned instances, while still having my terrain decorator applied at the point of spawn?

Many thanks again!

If I understand correctly, you wish to re-pack a spawned instance after you've already spawned an unpacked prefab.

This is a limitation of Unity's prefab design. We unpack a prefab when you add it to a Spawner so that we can extract the decorators inside of it and perform spawn logic where necessary. If we were to spawn Prefab Instances, your decorators inside that prefab will not be recognized by a GeNa Spawner.

Link to comment
Share on other sites

Gotcha, thanks again Bryan.

So, I've added a parent GO and re-created the prefab, allowing the unpacker to get to the decorators, while still retaining the settlement and building prefabs in place. All working great!

Thanks again!

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
 Share

×
×
  • Create New...