Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Replacement of FindGameObjectWithTag() in editor mode

Discussion in 'EditorXR' started by KushMathur, Jul 29, 2019.

  1. KushMathur

    KushMathur

    Joined:
    Jul 3, 2019
    Posts:
    22
    Hey everyone,

    I am trying to use regular public GameObject.FindGameObjectWithTag("Player");, inside the custom tool I created for my project. But it is not able to get gameobjects with a certain tag.
    Code (CSharp):
    1. if (GameObject.FindGameObjectWithTag("Player") == true)
    2.             {
    3.                 run = false;
    4.                 referedPlane = GameObject.FindGameObjectWithTag("Player");
    5.                 Debug.Log("Plane already created");
    6.             }
    This is the simple loop I created.

    What am I doing wrong and what could be replacement of FindGameObjectWithTag for Editor Scripting.

    Thanks for helping(and also reading;))
     
  2. KushMathur

    KushMathur

    Joined:
    Jul 3, 2019
    Posts:
    22
    Solved! Thanks for reading guys!!
     
  3. Deleted User

    Deleted User

    Guest

    How'd you solve it?
     
unityunity