Search Unity

Set selectable during runtime

Discussion in 'Editor & General Support' started by The_Arrival, Jan 27, 2021.

  1. The_Arrival

    The_Arrival

    Joined:
    Dec 3, 2014
    Posts:
    82
    Hello folks,

    so i started to use that little "toggle selectable" icon in the editor, which is very neat, since it toggles the flag for all nested objects as well for stuff i usually do not want to select.

    I need a solution to set that flag during runtime via code. The usecase is like this:

    As shown in the picture i have two parent objects which get populated during runtime with debug-objects i don´t want them to be selectable. I can set the flag for the parent pre-runtime, but that still means the instatiated children are all selectable
    upload_2021-1-27_15-41-1.png

    Is it possible to set that property during runtime via code?