public async void OnEnable() { try { manager = target as PersistentMonoBehaviour; Type type = null; await Task.Run(() => { type = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).Where(t => { var att = t.GetCustomAttributes <CustomEditor>().FirstOrDefault(); if (att == null) { return(false); } var inspectedType = typeof(CustomEditor).GetField("m_InspectedType", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(att) as Type; return(inspectedType == manager.GetType()); }).FirstOrDefault(); }); if (type != null) { editor = CreateEditor(manager, type); } else { editor = this; } } catch (Exception e) { ZSerialize.LogWarning(e, DebugMode.Developer); } }
public void UnregisterPersistent(PersistentMonoBehaviour persistent) { persistents.Remove(persistent); }
public void RegisterPersistent(PersistentMonoBehaviour persistent) { persistents.Add(persistent); }