public void SetResourceState(ResourceState newResState) { if (null != newResState) { newResState.AddRef(); } if (null != resState) { resState.SubRef(); } resState = newResState; }
public static void Add(GameObject go, ResourceState resState) { resState.AddRef(); GameObjectRefMonitorMono cmp = go.GetComponent <GameObjectRefMonitorMono>(); if (null == cmp) { cmp = go.AddComponent <GameObjectRefMonitorMono>(); } if (null != cmp.resState) { cmp.resState.SubRef(); } cmp.resState = resState; }