Reverting overrides on instances

   1434   1   1
User Avatar
Member
13 posts
Joined: Nov. 2019
Offline
Hi. I'm making a tool that uses alot of instancing to assemble a level in Unity. I've come up against some issues with the way Houdini engine overrides lots of properties on each instance that you may not want. You can control a few overrides via the Unity attributes [www.sidefx.com] but lots of other attributes will also be overridden. Instead I found it better to revert all the overrides that occur with the instancing so that each prefab can be set correctly upfront. To do this I attach a script via the Unity script attribute [www.sidefx.com] which looks a bit like this:

    private void GetInstancedOverrides()
    {
        InstancedObjs.Clear();

        foreach (var childTransform in GetComponentsInChildren<Transform>())
        {
            if (childTransform.gameObject.name.Contains("Instance"))
            {
                InstancedObjs.Add(childTransform);
            }
        }

        FixedInstancedOverrides();
    }

    private void FixedInstancedOverrides()
    {
        foreach (var childTransform in InstancedObjs)
        {
#if UNITY_EDITOR
            PrefabUtility.RevertPrefabInstance(childTransform.gameObject, InteractionMode.UserAction);
#endif            
        }
        Debug.Log("Fixup fired");
    }

The issue is this fires to early and breaks rebuilds or recooking of the HDA. i used editor coroutines to delay running these functions which does work but I wanted to ask if there was a good way to latch onto the event of the HDA to say the cook or rebuild had finished?
User Avatar
Member
100 posts
Joined: Dec. 2020
Offline
Sounds like there might be a bug somewhere here. Can you file a bug report with an example HDA to make sure? https://www.sidefx.com/forum/topic/38188/ [www.sidefx.com]
  • Quick Links