public void Register(SceneObjectGUIDComponent component)
    {
        Assert.IsFalse(string.IsNullOrEmpty(component.id));

        //Add will trow an exception if the id is already registered
        components.Add(component.id, component);
    }
    public void Update(UnityEngine.Object newObject)
    {
        ResetInitialization();
        ResetReference();
        if (newObject == null)
        {
            SaveProperties();
            return;
        }

        SceneObjectGUIDComponent guidComponent = null;
        Component  component = null;
        GameObject go        = null;

        if (newObject is Component)
        {
            component                 = newObject as Component;
            go                        = component.gameObject;
            guidComponent             = go.GetComponent <SceneObjectGUIDComponent>();
            m_SerializedComponentType = new SerializedType(component.GetType());
            m_ComponentIndex          = Array.IndexOf(go.GetComponents(component.GetType()), component);
        }
        else if (newObject is GameObject)
        {
            go = newObject as GameObject;
            if (PrefabUtility.IsPartOfPrefabAsset(go))
            {
                m_Prefab = go;
                SaveProperties();
                return;
            }
            guidComponent = go.GetComponent <SceneObjectGUIDComponent>();
        }
        else
        {
            m_ReferencedObject = m_AssetObject = newObject;
            SaveProperties();
            return;
        }

        if (guidComponent == null)
        {
            guidComponent = go.AddComponent <SceneObjectGUIDComponent>();
            Undo.RegisterCreatedObjectUndo(guidComponent, "Created GUID component");
        }

        m_GameObjectGuid = guidComponent.id;
        m_SceneGuid      = GetSceneId(go);
        if (string.IsNullOrEmpty(m_SceneGuid))
        {
            Debug.LogError("The scene needs to be saved");
            return;
        }

        SaveProperties();
    }
 public void Deregister(SceneObjectGUIDComponent component)
 {
     components.Remove(component.id);
 }