Search - User list
Full Version: HDA instancing prefabs question
Root » Houdini Engine for Unity » HDA instancing prefabs question
staszek-c
Hello,
I've searched the forum but I did not manage to find information about that.
I can add Unity prefabs for the scatter/placement tool:



but after the bake I get game objects that are not link to the original prefab:



which makes it complicated to work with when prefab changes.

Is it possible to instantiate prefabs and maintain the link to the original?
Same way the PrefabUtility.InstantiatePrefab method does that when used in Unity C# scripts?

I'd appreciate pointing me in the right direction and information if that's doable or do I have to add workaround scripts inside Unity.

Cheers,
ST
seelan
This is because of how you are supplying the input object. The input object in this case has its geometry uploaded into Houdini, processed during cook, and then output as a separate object. As its a separate and new object, there is no prefab connection to the original. To work around this and if you don't need to change the input object, then you can simply use instancing via the asset path name. The simplest way to do this is to output points only and set string attribute with name “unity_instance”.
See attribute info here: https://www.sidefx.com/docs/unity/_instancing.html#ObjectInstancers_Attribute [www.sidefx.com]

If you do need to change the input object and create a new object, then I suggest you break the HDA into 2 HDAs. First one takes in an input object and generates a prefab object. Second one generates points with path to the prefab. This will maintain the prefab link even after baking, as long you always update the same prefab using your first HDA.
staszek-c
Thanks for the explanation. Worked like a charm.
As a bonus since I'm using Unity 2019+ then by baking HDA's results into prefab I get nested prefab.



Cheers!
ST
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB