UI Toolkit ComponentUI Toolkit Component
UI Toolkit ComponentUI Toolkit Component
  • Docs
  • API
  • Changelog
  • Unity Asset Store
  • Bug report
  • Getting Started
  • Essentials
    • How To Import a Demo
    • How To Add a Style Sheet
    • How To Add an Event
    • List of Pseudo Classes
    • List of Events
  • Advanced
    • How To Get a VisualElement
    • How To Find a VisualElement
    • How To Check a VisualElement
    • How To Create a custom Pseudo Class
    • How To Create a custom UI Toolkit Component
    • How To Add a custom UI Toolkit GameObject
Generated by DocFX
(with DiscordFX + SingulinkFX)

Search Results for

    How To Check a VisualElement

    using SoyWar.UIToolkit;
    using SoyWar.UIToolkit.Elements;
    using UnityEngine;
    using UnityEngine.UIElements;
    
    public class MyComponent : MonoBehaviour
    {
        // Use UIDocument
        [SerializeField] private UIDocument _element;
        
        // Or UI Toolkit Component
        [SerializeField] private VisualElementComponent _element;
        
        // Or any UI Element
        private VisualElement _element;
        
        public void Method(VisualElement target)
        {
            // Create a Selector via the Selector Builder
            Selector selector = Selector.Builder(className: "element").Build();
            
            // Or via the Selector Parser
            Selector selector = Selector.Parse(".element");
    
            // Check the presence of a VisualElement that matches with the selector
            bool check = selector.Exists(_element);
    
            // Check if the current VisualElement matches with the selector
            bool check = selector.Match(_element, target);
        }
    }