Search Unity

  1. Dismiss Notice
  2. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  3. Unity wants to learn about your experiences working on a Unity project today. We'd like to hear from you via this survey.
    Dismiss Notice
  4. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  5. 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
  6. Read here for Unity's latest plans on OpenXR.
    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