Search Unity

Selecting game objects in project, and displaying them through script

Discussion in 'Scripting' started by VallMont, Jun 20, 2019.

  1. VallMont

    VallMont

    Joined:
    Feb 6, 2019
    Posts:
    16
    Hello.

    Through scripting, I want to be able to pick up a currently selected game object in my project's hierarchy, and display its infos.

    I know that it has to be something like Selection.activeGameObject, but so far, I only made it work in the Start() function. I want it to work any time I select another game object in the project's hierarchy (not in a game UI), but I did not find the solution yet. Can you help me, please?
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
  3. VallMont

    VallMont

    Joined:
    Feb 6, 2019
    Posts:
    16
    Thanks.

    Actually, I solved my problem after I posted this.
     
  4. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    Hah, that's a common case. If you explain your problem to random person, then you will find solution. It works even with cats :)