Closed emrys90 closed 3 years ago
All the Unity UIElements have a tooltip field if that's what you're looking for. When you assign the tooltip of a node view it shows up below the node like this: https://docs.unity3d.com/ScriptReference/UIElements.VisualElement-tooltip.html
How do you get it below the node? Do you need a custom node view class for each node to give it a tooltip, or is there some attribute that can be applied to a node?
Basically I'm looking for a way to have an on hover tooltip if possible, but always below works too for now, and ideally a way to see the tooltip in the create node menu too
Yeah, with a custom view. I recommend you create a base custom view that all your node inherit, this will give you a lot more control over your nodes. Like I did in my Mixture project: https://github.com/alelievr/Mixture/blob/master/Packages/com.alelievr.mixture/Editor/Views/MixtureNodeView.cs
For the node create menu I don't think it's possible to have a tooltip in it. I'm using the ISearchWindowProvider for it and it doesn't seem to support tooltips
Is it not possible to do this in a way that doesn't require a custom node view, ie using a Description attribute that is put on your classes that derive from BaseNode?
For the search window, is it possible to add a second line of text in a smaller font or something? So you could place the description below it
Is it not possible to do this in a way that doesn't require a custom node view, ie using a Description attribute that is put on your classes that derive from BaseNode?
You can do this, but you'll have to modify NodeGraphProcessor to add it in this case.
For the search window, is it possible to add a second line of text in a smaller font or something? No idea, I never tried. But the API seems very limited (i.e. you can only give a
GUIContent
for an item and that's it) so it's unlikely that it'll work.
Thanks, I just added it in using a custom node view
Sorry for all the questions! I tried searching, but didn't see a way to add descriptions to a node on tooltip or something. Would be very useful once you get a lot of custom nodes added in