Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [KnMethod(null, "DirtyCachedAITagsForUI", null, false)]
- public class AIManager : MonoBehaviour
- {
- static AIManager singleton;
- public string[] AITags;
- #region AI Tag caching
- protected List<GUIContent> cachedAITagsforUI;
- bool cachedAITagsforUIDirty = true;
- #endregion
- void Start()
- {
- if (singleton != null) { Debug.LogError("You have multiple AIManager in the scene. Knock that crap off, or shit gunna get weird."); }
- singleton = this;
- }
- #region AI Tag caching
- public void DirtyCachedAITagsForUI()
- {
- cachedAITagsforUIDirty = true;
- }
- // (please never call this anywhere but in the editor)
- static public List<GUIContent> GetAITagsForUI()
- {
- // (we HAVE to do this, because this gets called in editor, so Start has never been called)
- if (singleton == null) { singleton = FindObjectOfType<AIManager>(); }
- if (singleton.cachedAITagsforUIDirty)
- {
- singleton.cachedAITagsforUI = new List<GUIContent>();
- foreach (string aiTag in singleton.AITags)
- {
- singleton.cachedAITagsforUI.Add(new GUIContent(aiTag));
- }
- singleton.cachedAITagsforUIDirty = false;
- }
- return singleton.cachedAITagsforUI;
- }
- #endregion
- }
Advertisement
Add Comment
Please, Sign In to add comment