/// <summary> /// Remove a specific word behaviour from list and optionally destroy game object. /// This might also remove a template, i.e. no further trackables will be augmented for a specific word or for a template /// </summary> public override void DestroyWordBehaviour(WordBehaviour behaviour, bool destroyGameObject = true) { var keys = mWordBehaviours.Keys.ToArray(); foreach (var key in keys) { if (mWordBehaviours[key].Contains(behaviour)) { mWordBehaviours[key].Remove(behaviour); // no behaviours left - delete whole list if (mWordBehaviours[key].Count == 0) { mWordBehaviours.Remove(key); } if (destroyGameObject) { Object.Destroy(behaviour.gameObject); mWordBehavioursMarkedForDeletion.Add(behaviour); } else { IEditorWordBehaviour editorTrackableBehaviour = behaviour; editorTrackableBehaviour.UnregisterTrackable(); } } } }
public override void DestroyWordBehaviour(WordAbstractBehaviour behaviour, [Optional, DefaultParameterValue(true)] bool destroyGameObject) { foreach (string str in this.mWordBehaviours.Keys.ToArray <string>()) { if (this.mWordBehaviours[str].Contains(behaviour)) { this.mWordBehaviours[str].Remove(behaviour); if (this.mWordBehaviours[str].Count == 0) { this.mWordBehaviours.Remove(str); } if (destroyGameObject) { UnityEngine.Object.Destroy(behaviour.gameObject); this.mWordBehavioursMarkedForDeletion.Add(behaviour); } else { IEditorWordBehaviour behaviour2 = behaviour; behaviour2.UnregisterTrackable(); } } } }