Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Finding a gameobject in scene

Discussion in 'Editor & General Support' started by leoggwp, Apr 18, 2019.

  1. leoggwp

    leoggwp

    Joined:
    Feb 22, 2018
    Posts:
    10
    My Problem is that I have a gameobject in my scene which seams to be an old version of the player prefab. It is being detected by the gamecontroller, who just tracks all player object in an array by finding it by the tag. The object shouldn't be there and I can only access it by the reference in the player array, so only in playmode. For deleting it from the scene I need to find it. I can't find it via the searchbar, neither by searching for the name "Player" nor by searching for a script of the object. Does anyone have an idea of how do find and delete the an object?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,657
    Probably you gave game object meaningless name.
    If you can access object from array, then fetch it name.
    Then search all game object with than name, using search bar.
     
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,500
    You can also create a public gameobject reference you can see in the inspector on some script, in play mode assign the reference for the problem object to this this so you can see it in the inspector, and while in play mode click on it in the inspector and it should take you to it in the hierarchy.
     
  4. leoggwp

    leoggwp

    Joined:
    Feb 22, 2018
    Posts:
    10
    show.jpg
    The gamecontroller hold the reference of the right player object(the second one) and the wrong object(the first one). Both are named "Player". But when I search for it only one will appear.

    So when I double click the right one, which has been created by the network controller it opens the inspector and highlights it yellow in the hierarchy as it should. When I double click the other one it opens the inspector, but doesn't highlight anything.