Class DiagnosticEventCollector
Collects ResourceManager events and passed them on the registered event handlers. In editor play mode, events are passed directly to the ResourceManager profiler window. In player builds, events are sent to the editor via the EditorConnection API.
Namespace: UnityEngine.ResourceManagement.Diagnostics
Syntax
public class DiagnosticEventCollector : MonoBehaviour
Properties
PlayerConnectionGuid
The guid used for the PlayerConnect messaging system.
Declaration
public static Guid PlayerConnectionGuid { get; }
Property Value
Type | Description |
---|---|
Guid |
Methods
FindOrCreateGlobalInstance()
Retrieves the global event collector. A new one is created if needed.
Declaration
public static DiagnosticEventCollector FindOrCreateGlobalInstance()
Returns
Type | Description |
---|---|
DiagnosticEventCollector | The event collector global instance. |
PostEvent(DiagnosticEvent)
Send a DiagnosticEvent event to all registered handlers
Declaration
public void PostEvent(DiagnosticEvent diagnosticEvent)
Parameters
Type | Name | Description |
---|---|---|
DiagnosticEvent | diagnosticEvent | The event to send |
RegisterEventHandler(Action<DiagnosticEvent>, Boolean, Boolean)
Register for diagnostic events. If there is no collector, this will fail and return false.
Declaration
public static bool RegisterEventHandler(Action<DiagnosticEvent> handler, bool register, bool create)
Parameters
Type | Name | Description |
---|---|---|
Action<DiagnosticEvent> | handler | The handler method action. |
Boolean | register | Register or unregister. |
Boolean | create | If true, the event collector will be created if needed. |
Returns
Type | Description |
---|---|
Boolean | True if registered, false if not. |
UnregisterEventHandler(Action<DiagnosticEvent>)
Unregister event hander
Declaration
public void UnregisterEventHandler(Action<DiagnosticEvent> handler)
Parameters
Type | Name | Description |
---|---|---|
Action<DiagnosticEvent> | handler | Method or delegate that will handle the events |