// Minimal engine boundary for .NET lifecycle tests; not a Unity runtime replacement. using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; namespace UnityEngine { public class Object { public static implicit operator bool(Object value) => value != null; public static void DestroyImmediate(Object value) { if (value is GameObject go) foreach (var component in go.Components) component.GetType().GetMethod("OnDestroy", BindingFlags.NonPublic | BindingFlags.Instance)?.Invoke(component, null); } public static void Destroy(Object value) => DestroyImmediate(value); public static void DontDestroyOnLoad(Object value) { } } public class ScriptableObject : Object { public static T CreateInstance() where T : ScriptableObject, new() => new T(); } public class MonoBehaviour : Object { public GameObject gameObject; } public class GameObject : Object { internal readonly List Components = new(); public GameObject(string name) { } public T AddComponent() where T : MonoBehaviour, new() { var c = new T { gameObject = this }; Components.Add(c); return c; } } public static class Resources { public static T Load(string path) where T : Object => null; } public static class Application { public static string persistentDataPath => System.IO.Path.GetTempPath(); public static bool isPlaying => false; } public static class Time { private static readonly Stopwatch Clock = Stopwatch.StartNew(); public static float realtimeSinceStartup => (float)Clock.Elapsed.TotalSeconds; } public static class Mathf { public static float Max(float a, float b) => Math.Max(a, b); } public enum LogType { Error, Assert, Warning, Log, Exception } public static class Debug { public static event Action Logged; public static void Log(object value) => Logged?.Invoke(LogType.Log, value?.ToString()); public static void LogWarning(object value) => Logged?.Invoke(LogType.Warning, value?.ToString()); public static void LogError(object value) => Logged?.Invoke(LogType.Error, value?.ToString()); public static void LogException(Exception value) => Logged?.Invoke(LogType.Exception, value.ToString()); } public class CreateAssetMenuAttribute : Attribute { public string fileName, menuName; } public class HeaderAttribute : Attribute { public HeaderAttribute(string text) { } } public class TooltipAttribute : Attribute { public TooltipAttribute(string text) { } } public class MinAttribute : Attribute { public MinAttribute(float value) { } } public class SerializeField : Attribute { } public class DefaultExecutionOrder : Attribute { public DefaultExecutionOrder(int value) { } } public enum RuntimeInitializeLoadType { SubsystemRegistration, AfterAssembliesLoaded } public class RuntimeInitializeOnLoadMethodAttribute : Attribute { public RuntimeInitializeOnLoadMethodAttribute(RuntimeInitializeLoadType type) { } } }