private ISwitch findSwitch(string id) { ISwitch r = null; foreach (ISwitch isw in this.switches) { if (!string.IsNullOrEmpty(isw.id) && isw.id.Equals(id)) { r = isw; break; } } return(r); }
public ISwitch addSwitch() { ISwitch iss = ScriptableObject.CreateInstance <ISwitch>(); this.switches.Add(iss); #if UNITY_EDITOR if (Application.isEditor && !Application.isPlaying && (UnityEditor.AssetDatabase.IsMainAsset(this) || UnityEditor.AssetDatabase.IsSubAsset(this))) { UnityEditor.AssetDatabase.AddObjectToAsset(iss, this); iss.Persist(); UnityEditor.AssetDatabase.SaveAssets(); } #endif return(iss); }
public void removeSwitch(ISwitch swt) { if (this.switches.Contains(swt)) { this.switches.Remove(swt); } #if UNITY_EDITOR if (Application.isEditor && !Application.isPlaying && (UnityEditor.AssetDatabase.IsMainAsset(this) || UnityEditor.AssetDatabase.IsSubAsset(this))) { ScriptableObject.DestroyImmediate(swt, true); UnityEditor.AssetDatabase.SaveAssets(); } #endif //ScriptableObject.Destroy (swt); }