Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. #if UNITY_EDITOR
  2.         [ContextMenu("Populate AI Actors")]
  3.         public void PopulateAiActors()
  4.         {
  5.             aiActors = null;
  6.             GameObject[]  aiActorsGameObjectsToFind = GameObject.FindGameObjectsWithTag("Enemy");
  7.             AIActor[] aiActorsTofind = new AIActor[aiActorsGameObjectsToFind.Length];
  8.  
  9.             for (int i = 0; i < aiActorsGameObjectsToFind.Length; i++)
  10.             {
  11.                 aiActorsTofind[i] = aiActorsGameObjectsToFind[i].GetComponent<AIActor>();
  12.             }
  13.             Debug.Log("Begin populate");
  14.             aiActors = aiActorsTofind;
  15.             EditorUtility.SetDirty(this);
  16.             EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
  17.         }
  18. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement