MotionDispatcher.cs
Runtime/Scheduling/MotionDispatcher.cs
1 using System;
2 using UnityEngine;
3
4 namespace MeatMotion
5 {
6 #if UNITY_6000_7_OR_NEWER
7 [Unity.Scripting.LifecycleManagement.NoAutoStaticsCleanup] // The exception handler is a setting and stays registered.
8 #endif
9 public static class MotionDispatcher
10 {
11 static Action<Exception> handler = Debug.LogException;
12 public static void RegisterUnhandledExceptionHandler(Action<Exception> unhandledExceptionHandler) => handler = unhandledExceptionHandler;
13 public static Action<Exception> GetUnhandledExceptionHandler() => handler;
14 internal static void Report(Exception error) => handler?.Invoke(error);
15 public static void Clear() => MotionUpdateDriver.Clear();
16 public static void EnsureStorageCapacity<TValue, TOptions, TAdapter>(int capacity)
17 where TValue : unmanaged where TOptions : unmanaged, IMotionOptions
18 where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>
19 => MotionUpdateDriver.EnsureCapacity(typeof(MotionBuilder<TValue, TOptions, TAdapter>), capacity);
20 }
21 }