public void LoadAsset(string prefabName, string destinationComponent)
 {
     if (_globalComponentTable.ContainsKey(destinationComponent))
     {
         Fabric.Component   component = _globalComponentTable[destinationComponent];
         UnityEngine.Object @object   = Resources.Load(prefabName);
         if (@object != null)
         {
             GameObject gameObject = UnityEngine.Object.Instantiate(@object) as GameObject;
             gameObject.name = gameObject.name.Replace("(Clone)", "");
             string key = destinationComponent + "_" + gameObject.name;
             if (_globalComponentTable.ContainsKey(key))
             {
                 UnityEngine.Object.Destroy(gameObject);
                 return;
             }
             gameObject.transform.parent = component.transform;
             Fabric.Component component2 = gameObject.GetComponent <Fabric.Component>();
             if (component2 != null)
             {
                 component2.Initialise(component, isComponentInstance: false);
                 component.AddComponent(component2);
                 AddChildComponentsToGlobalTable(component2, destinationComponent);
             }
             VolumeMeter component3 = component.GetComponent <VolumeMeter>();
             if (component3 != null)
             {
                 component3.CollectAudioComponents();
             }
             DebugLog.Print("Asset [" + prefabName + "] loaded succesfuly");
         }
         else
         {
             DebugLog.Print("Asset [" + prefabName + "] name not found", DebugLevel.Error);
         }
     }
     else
     {
         DebugLog.Print("Target Component [" + destinationComponent + "] not found", DebugLevel.Error);
     }
 }
 public void LoadAsset(GameObject component, string destinationComponent)
 {
     if (_globalComponentTable.ContainsKey(destinationComponent))
     {
         Fabric.Component component2 = _globalComponentTable[destinationComponent];
         if (component != null)
         {
             component.name = component.name.Replace("(Clone)", "");
             string key = destinationComponent + "_" + component.name;
             if (_globalComponentTable.ContainsKey(key))
             {
                 UnityEngine.Object.DestroyImmediate(component);
                 return;
             }
             component.transform.parent = component2.transform;
             Fabric.Component component3 = component.GetComponent <Fabric.Component>();
             if (component3 != null)
             {
                 component3.Initialise(component2, isComponentInstance: false);
                 component2.AddComponent(component3);
                 AddChildComponentsToGlobalTable(component3, destinationComponent);
                 VolumeMeter component4 = component2.GetComponent <VolumeMeter>();
                 if (component4 != null)
                 {
                     component4.CollectAudioComponents();
                 }
             }
             DebugLog.Print("Asset [" + component.name + "] loaded succesfuly");
         }
         else
         {
             DebugLog.Print("Asset [" + component.name + "] name not found", DebugLevel.Error);
         }
     }
     else
     {
         DebugLog.Print("Target Component [" + destinationComponent + "] not found", DebugLevel.Error);
     }
 }
    public bool RegisterGroupComponent(GroupComponent groupComponent, string targetGroupComponentPath, bool createProxy = true)
    {
        if (!_allowExternalGroupComponents)
        {
            DebugLog.Print("External GroupComponent registration is disabled");
            return(false);
        }
        bool result = false;

        Fabric.Component componentByName = GetComponentByName(targetGroupComponentPath);
        if (groupComponent != null)
        {
            groupComponent.Initialise(componentByName, isComponentInstance: false);
            if (componentByName != null)
            {
                componentByName.AddComponent(groupComponent);
            }
            else
            {
                _components.Add(groupComponent);
            }
            if (createProxy)
            {
                GameObject gameObject = new GameObject();
                gameObject.hideFlags = HideFlags.DontSave;
                GroupComponentProxy groupComponentProxy = gameObject.AddComponent <GroupComponentProxy>();
                groupComponentProxy._groupComponent = groupComponent;
                groupComponentProxy.name            = groupComponent.name + "_Proxy";
                if (componentByName != null)
                {
                    groupComponentProxy.transform.parent = componentByName.transform;
                }
                else
                {
                    groupComponentProxy.transform.parent = base.gameObject.transform;
                }
                _groupComponentProxies.Add(groupComponentProxy);
            }
            else if (componentByName != null)
            {
                groupComponent.transform.parent = componentByName.transform;
            }
            else
            {
                groupComponent.transform.parent = base.gameObject.transform;
            }
            if (componentByName != null)
            {
                VolumeMeter component = componentByName.GetComponent <VolumeMeter>();
                if (component != null)
                {
                    component.CollectAudioComponents();
                }
            }
            DebugLog.Print("GroupComponent [" + groupComponent.name + "] registred succesfuly");
            result = true;
        }
        else
        {
            DebugLog.Print("GroupComponent [" + groupComponent.name + "] failed to register", DebugLevel.Error);
        }
        return(result);
    }