Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Non deletable visual element

Discussion in 'UI Toolkit' started by PanagiotisKikas, Jul 28, 2021.

  1. PanagiotisKikas

    PanagiotisKikas

    Joined:
    Aug 23, 2019
    Posts:
    7
    Hello,
    Is there any way to make a visual element, specifically a custom node in the graph view non-deletable? I would like to add my custom node when creating the graph and let prevent the user from being able to delete it similar to how the animator prevents you from deleting the entry/any state and exit state nodes.

    I know that overriding the IsSelectable method on the node will make it non selectable and so non deletable but I want the user to be able to move it around the graph view. Is there something like an IsDeletable that I can override to achieve what I am trying to do?
    Thanks
     
  2. patrickf

    patrickf

    Unity Technologies

    Joined:
    Oct 24, 2016
    Posts:
    57
    Hi, did you try removing Capabilities.Deletable from Node.capabilities ?
     
    PanagiotisKikas likes this.
  3. PanagiotisKikas

    PanagiotisKikas

    Joined:
    Aug 23, 2019
    Posts:
    7
    Oh, I didn't know there was such a thing, that is exactly what I was searching for.
    Thank you.