Search Unity

Keep my gameObject selected

Discussion in 'Editor & General Support' started by zhutianlun810, Oct 16, 2019.

  1. zhutianlun810

    zhutianlun810

    Joined:
    Sep 17, 2017
    Posts:
    172
    Hello,

    I want to keep one of a gameObject selected. I know I can use Selection.activeGameObject. However, when I click another place in my scene, the selected gameObject got changed. I really need to keep one of a gameobject selected no matter what happens in EditorMode. How can I do it?

    Thank you very much.
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,779
    What is use case for such required behavior? You still can navigate camera.

    However, you can lock inspector with desired selection. You can have multiple inspectors, showing properties of different objects at the same time.
     
  3. zhutianlun810

    zhutianlun810

    Joined:
    Sep 17, 2017
    Posts:
    172
    I am implementing am editor which can preview a prefab. I don't want my user to click other items in the scene.
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,779
    Are you working on some moding tool, within Unity editor?
     
  5. zhutianlun810

    zhutianlun810

    Joined:
    Sep 17, 2017
    Posts:
    172
    No, I am building a custom editor like a modeling tool
     
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,779
    Ok, that makes sense.

    For that, you would be probably better to wait for an answer, from someone with better understanding of the matter.
    Sorry, I can not be more helpful here.