Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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?