Experimental: this API is experimental and might be changed or removed in the future.

Gate

struct in UnityEngine.Experimental.UIElements

매뉴얼로 전환

설명

Gates control when the dispatcher processes events.

Here is an example of using a gate:

public class MyElement : VisualElement
{
    void Foo()
    {
        using (new EventDispatcher.Gate(dispatcher))
        {
            // do something that sends events
        }
    }
}

When the gate is instantiated, it closes automatically, causing the dispatcher to store the events it receives in a queue. At the end of the using block, Dispose is called, which triggers opening the gate. When all gates on a dispatcher open, the events stored in the queue are processed. Closing a gate while the event queue is processed does not stop it from being processed. Instead, a new queue is created to store new events.

생성자

EventDispatcher.GateConstructor.

Public 함수

DisposeImplementation of IDisposable.Dispose. Opens the gate. If all gates are open, events in the queue are processed.