public void Unregister(IRegistryObject t)
        {
            if (t == null)
            {
                return;
            }

            if (!m_Objects.Remove(t.Id))
            {
                return;
            }

            m_UnregisteredObjects.Add(t);

            var type = t.GetType();
            HashSet <UTinyId> typeIds;

            if (m_IdsByType.TryGetValue(type, out typeIds))
            {
                if (typeIds.Remove(t.Id))
                {
                    UTinyEventDispatcher.Dispatch(UTinyRegistryEventType.Unregistered, t);
                }
                if (typeIds.Count == 0)
                {
                    m_IdsByType.Remove(type);
                }
            }
        }
        public void Register(IRegistryObject t)
        {
            Assert.IsNotNull(t);

            IRegistryObject oldObject;

            if (m_Objects.TryGetValue(t.Id, out oldObject))
            {
                if (oldObject == t)
                {
                    return;
                }
                Unregister(oldObject);
            }

            Assert.AreNotEqual(UTinyId.Empty, t.Id);

            m_Objects[t.Id] = t;
            var type = t.GetType();
            HashSet <UTinyId> typeIds;

            if (!m_IdsByType.TryGetValue(type, out typeIds))
            {
                m_IdsByType[type] = typeIds = new HashSet <UTinyId>();
            }

            SetSourceIdentifier(t);

            if (typeIds.Add(t.Id))
            {
                UTinyEventDispatcher.Dispatch(UTinyRegistryEventType.Registered, t);
            }
        }