Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CG CreateGameObject and Prefabs
#1
One of our uses for CurvyGenerator is to automatically build and place repetitive geometry in environment assets. For example, we'll use it to generate columns around the perimeter of a Roman temple. We would then like to turn the entire GameObject into a prefab and use those prefabs across several scene environments.

However, we're having an issue when it comes to turning these assets into prefabs. An asset with CurvyGenerator can be turned into a prefab just fine, but if we instantiate it, it will immediately lose its prefab connection. I believe this is due to CurvyGenerator.Update() in the editor, which is called due to ExecuteInEditMode. It will immediately call Initialize(), which in turn will call Refresh(true). This causes a CreateGameObject module in the generator to refresh, deleting its current managed resources while creating new ones. This last bit is what breaks the prefab connection.

This isn't ideal for us, so I was wondering what the recommended workflow is for our use case? Currently, the only ways I see around this are to either disable the CreateGameObject module after generating its resources at edit time, or to not include the CurvyGenerator in the prefab and instead generate the geometry separately, after which we pull the geometry into the prefab and update it. Both of these solutions aren't super satisfactory, since it adds extra steps (and potential opportunities for forgetfulness or mistakes) to our prefab process. Do you recommend a different approach?

Thanks!
Reply
#2
Currently the best solution is to detach the generated geometry from the CG and prefab just that. You can use the SaveToScene method of the CrateMesh module to detach the resulting meshes.
Reply
#3
(01-15-2017, 09:28 AM)Jake Wrote: Currently the best solution is to detach the generated geometry from the CG and prefab just that. You can use the SaveToScene method of the CrateMesh module to detach the resulting meshes.

Thanks! I'll look into that and talk with my artists.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CurvyConnections inside prefabs CoolUser 9 3,884 10-02-2024, 06:41 PM
Last Post: _Aka_
  Deforming prefabs with LODs along a spine LiveWire 6 27 05-29-2024, 08:25 AM
Last Post: _Aka_
Bug Issues when working with in-place prefabs Sacryn 4 7 02-27-2024, 04:08 PM
Last Post: _Aka_
  Custom CurvySplineSegment prefabs Lupos 1 10 10-02-2023, 09:36 AM
Last Post: _Aka_

Forum Jump: