Skip to content

Instantly share code, notes, and snippets.

@andrew-raphael-lukasik
andrew-raphael-lukasik / .ButtonThatCanBeDisabled.cs.md
Last active September 28, 2023 18:51
UI Toolkit Button class that can be disabled via style sheet or uxml inline property

Button class that can be disabled via style sheet or uxml inline property

how to disable a Button from UI Builder

@unitycoder
unitycoder / LineDrawer.cs
Created November 5, 2021 20:09
Drawing a line with Unity UI Toolkit
// Drawing a line with UITK https://forum.unity.com/threads/drawing-a-line-with-uitk.1193470/
public class LineDrawer : VisualElement
{
private Vector3 startPos, endPos;
private float thickness;
public LineDrawer(Vector3 pos1, Vector3 pos2, float width)
{
startPos = pos1;
endPos = pos2;
@karljj1
karljj1 / gist:fb2d61a9ea72c6cd9eff705220810d94
Created January 15, 2021 18:39
An example of how a UI Toolkit TextField Suggestion field could be created
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
public class TextEditorWindow : EditorWindow
{
VisualElement m_Suggestion;
TextField m_TextField;
[MenuItem("Test/Window")]