public ComponentDisableHandle GetDisableHandle <T>() { Assert.IsTrue(mInitialized, "Call GetTrackHand in OnUpdate of System, after ComponentDisableInfoSystem is initialized"); var offset = TypeManagerExt.GetTypeOffset <T>(); Assert.IsTrue(offset >= 0 && offset < TypeOffset2DisableID.Length, "Invalid Type"); var disableID = TypeOffset2DisableID[offset]; DisableID_Check(disableID, TypeManager.GetTypeIndex <T>()); return(new ComponentDisableHandle() { DisableID = disableID }); }
/// <summary> /// Register a new type that can be disabled, must be called in main thread /// </summary> public void RegisterTypeForDisable <T>() { if (TrackedTypeCount > K_MaxTrackedComponentCount) { Debug.LogError($"Can not Track more than {K_MaxTrackedComponentCount} Disable types, consider increase ComponentDisable.K_MaxTrackedComponentCount"); return; } Initialize(); var typeOffset = TypeManagerExt.GetTypeOffset <T>(); if (TypeOffset2DisableID[typeOffset] > CanNotDisable) { return; } TypeOffset2DisableID[typeOffset] = TrackedTypeCount++; }