// AUTHORED SHIM (not copied). No-op UnityEngine surface for headless battle // resolution. Grows via the M1 compile loop -- add only members the compiler // demands. State-bearing battle logic lives in Engine/; nothing here computes // game state (Unity calls are VFX/IO/rendering, suppressed by IsForecast). using System; using System.Collections; namespace UnityEngine { // ---- value types (Vector2/3, Quaternion, Color, Mathf, Debug live in Primitives.cs) ---- public partial struct Vector4 { public float x, y, z, w; public Vector4(float x, float y, float z, float w){ this.x=x; this.y=y; this.z=z; this.w=w; } } public struct Color32 { public byte r, g, b, a; public Color32(byte r, byte g, byte b, byte a){ this.r=r; this.g=g; this.b=b; this.a=a; } } public struct Bounds { public Vector3 center, size; public Bounds(Vector3 c, Vector3 s) { center = c; size = s; } public Vector3 extents { get => size * 0.5f; set => size = value * 2f; } public Vector3 min { get => center - extents; set { } } public Vector3 max { get => center + extents; set { } } public bool Contains(Vector3 p) => false; public void Encapsulate(Vector3 p) { } public void Encapsulate(Bounds b) { } public void Expand(float amount) { } public bool Intersects(Bounds b) => false; public float SqrDistance(Vector3 p) => 0f; } public struct Rect { public float x, y, width, height; public Rect(float x, float y, float w, float h) { this.x = x; this.y = y; width = w; height = h; } public float xMin { get => x; set { width += x - value; x = value; } } public float yMin { get => y; set { height += y - value; y = value; } } public float xMax { get => x + width; set => width = value - x; } public float yMax { get => y + height; set => height = value - y; } public Vector2 center { get => new Vector2(x + width / 2, y + height / 2); set { } } public Vector2 size { get => new Vector2(width, height); set { width = value.x; height = value.y; } } public Vector2 position { get => new Vector2(x, y); set { x = value.x; y = value.y; } } public Vector2 min { get => new Vector2(xMin, yMin); set { } } public Vector2 max { get => new Vector2(xMax, yMax); set { } } public bool Contains(Vector2 p) => false; public bool Contains(Vector3 p) => false; public bool Overlaps(Rect other) => false; public static Rect MinMaxRect(float xmin, float ymin, float xmax, float ymax) => new Rect(xmin, ymin, xmax - xmin, ymax - ymin); public static bool operator ==(Rect a, Rect b) => a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; public static bool operator !=(Rect a, Rect b) => !(a == b); public override bool Equals(object o) => o is Rect r && this == r; public override int GetHashCode() => x.GetHashCode() ^ (y.GetHashCode() << 2) ^ (width.GetHashCode() << 4) ^ (height.GetHashCode() << 6); } public struct Matrix4x4 { public static Matrix4x4 identity => new Matrix4x4(); public Vector3 MultiplyPoint(Vector3 p) => p; public Vector3 MultiplyPoint3x4(Vector3 p) => p; public Vector3 MultiplyVector(Vector3 v) => v; public static Matrix4x4 TRS(Vector3 t, Quaternion r, Vector3 s) => identity; public Matrix4x4 inverse => identity; public static Matrix4x4 operator *(Matrix4x4 a, Matrix4x4 b) => identity; public Vector4 GetColumn(int i) => default; public Vector4 GetRow(int i) => default; public float this[int row, int col] { get => 0f; set { } } } public struct Plane { public Plane(Vector3 normal, Vector3 point) { } public Plane(Vector3 inNormal, float d) { } public Plane(Vector3 a, Vector3 b, Vector3 c) { } public bool Raycast(Ray r, out float enter) { enter = 0; return false; } } public struct Ray { public Ray(Vector3 origin, Vector3 dir) { this.origin = origin; this.direction = dir; } public Vector3 origin; public Vector3 direction; public Vector3 GetPoint(float d) => origin; } public struct RaycastHit { public Vector3 point; public Vector3 normal; public float distance; public Collider collider; public Transform transform; public GameObject gameObject; } public struct RaycastHit2D { public Vector3 point; public Vector3 normal; public float distance; public Collider2D collider; public Transform transform; public static implicit operator bool(RaycastHit2D hit) => hit.collider != null; } public struct LayerMask { public int value; public static int NameToLayer(string n) => 0; public static string LayerToName(int layer) => ""; public static implicit operator int(LayerMask m) => m.value; public static implicit operator LayerMask(int v) => new LayerMask { value = v }; } // ---- core object model ---- public class Object { public string name { get; set; } public HideFlags hideFlags { get; set; } public int GetInstanceID() => 0; public override string ToString() => name ?? base.ToString(); public static void Destroy(Object o) { } public static void Destroy(Object o, float t) { } public static void DestroyImmediate(Object o) { } public static void DestroyImmediate(Object o, bool allowDestroyingAssets) { } public static void DontDestroyOnLoad(Object o) { } public static T Instantiate(T original) where T : Object => original; public static T Instantiate(T original, Transform parent) where T : Object => original; public static T Instantiate(T original, Vector3 pos, Quaternion rot) where T : Object => original; public static T Instantiate(T original, Vector3 pos, Quaternion rot, Transform parent) where T : Object => original; public static Object Instantiate(Object original) => original; public static T FindObjectOfType() where T : Object => null; public static T[] FindObjectsOfType() where T : Object => new T[0]; public static T[] FindObjectsOfType(bool includeInactive) where T : Object => new T[0]; public static Object FindObjectOfType(System.Type t) => null; public static Object[] FindObjectsOfType(System.Type t) => new Object[0]; public static bool operator ==(Object a, Object b) => ReferenceEquals(a, b); public static bool operator !=(Object a, Object b) => !ReferenceEquals(a, b); public static implicit operator bool(Object o) => !ReferenceEquals(o, null); public override bool Equals(object o) => ReferenceEquals(this, o); public override int GetHashCode() => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(this); } public class Component : Object { internal GameObject _go; // Self-consistent no-op object graph (M5): a Component belongs to a GameObject, and // component.transform == component.gameObject.transform. Lazily materialize a backing // GameObject so the unguarded prefab/view touches on the createNullView:false card-creation // path (F1) resolve to non-null no-ops, and route GetComponent through that GameObject's // cached component model so a chained transform.Find(...).GetComponent() yields the same // non-null instances rather than null. public virtual GameObject gameObject => _go ??= new GameObject(); public virtual Transform transform => gameObject.transform; public string tag { get; set; } public T GetComponent() => gameObject.GetComponent(); public T GetComponent(string type) => gameObject.GetComponent(); public Component GetComponent(System.Type t) => gameObject.GetComponent(t); public Component GetComponent(string t) => null; public T GetComponentInChildren() => default; public T GetComponentInChildren(bool includeInactive) => default; public T[] GetComponentsInChildren() => new T[0]; public T[] GetComponentsInChildren(bool includeInactive) => new T[0]; public T GetComponentInParent() => default; public T GetComponentInParent(bool includeInactive) => default; public T[] GetComponentsInParent() => new T[0]; public T[] GetComponents() => new T[0]; public Component[] GetComponents(System.Type t) => new Component[0]; public void SendMessage(string method) { } public void SendMessage(string method, object value) { } public void SendMessage(string method, object value, SendMessageOptions options) { } public void SendMessage(string method, SendMessageOptions options) { } public void BroadcastMessage(string method) { } public void BroadcastMessage(string method, object parameter) { } public void BroadcastMessage(string method, object parameter, SendMessageOptions options) { } public bool CompareTag(string t) => false; } public class Behaviour : Component { public bool enabled { get; set; } public bool isActiveAndEnabled { get; } } public class MonoBehaviour : Behaviour { public static void print(object message) { } public Coroutine StartCoroutine(IEnumerator routine) => null; public Coroutine StartCoroutine(string methodName) => null; public void StopCoroutine(IEnumerator routine) { } public void StopCoroutine(Coroutine routine) { } public void StopCoroutine(string methodName) { } public void StopAllCoroutines() { } public void Invoke(string methodName, float time) { } public void CancelInvoke() { } public void CancelInvoke(string methodName) { } public bool IsInvoking() => false; } public partial class Transform : Component, IEnumerable { public Transform() { } internal Transform(GameObject owner) { _go = owner; } // A Transform IS its own transform (vs Component.transform => gameObject.transform). public override Transform transform => this; public Vector3 position { get; set; } public Vector3 localPosition { get; set; } public Vector3 localScale { get; set; } = new Vector3(1, 1, 1); public Vector3 localEulerAngles { get; set; } public Vector3 eulerAngles { get; set; } public Quaternion rotation { get; set; } public Quaternion localRotation { get; set; } // Lazily non-null so `someLabel.transform.parent.gameObject` (unguarded in the NORMAL // card-creation path) resolves; settable so real re-parenting still records. private Transform _parent; public Transform parent { get => _parent ??= new Transform(); set => _parent = value; } public int childCount => 0; // Return a non-null cached child per name so Find(...).Find(...).GetComponent() // chains resolve to no-ops; cached so repeated Find of the same child is stable. private System.Collections.Generic.Dictionary _children; public Transform Find(string n) { _children ??= new System.Collections.Generic.Dictionary(); if (!_children.TryGetValue(n ?? "", out var t)) { t = new GameObject(n).transform; _children[n ?? ""] = t; } return t; } public Transform GetChild(int i) => null; public void SetParent(Transform p) { } public void SetParent(Transform p, bool worldPositionStays) { } public void SetSiblingIndex(int i) { } public int GetSiblingIndex() => 0; public void SetAsLastSibling() { } public void SetAsFirstSibling() { } public Vector3 lossyScale => Vector3.one; public Vector3 forward { get => Vector3.forward; set { } } public Vector3 up { get => Vector3.up; set { } } public Vector3 right { get => Vector3.right; set { } } public Transform root => this; public Vector3 TransformPoint(Vector3 p) => p; public Vector3 TransformPoint(float x, float y, float z) => new Vector3(x, y, z); public Vector3 InverseTransformPoint(Vector3 p) => p; public Vector3 InverseTransformPoint(float x, float y, float z) => new Vector3(x, y, z); public Vector3 TransformDirection(Vector3 d) => d; public Vector3 InverseTransformDirection(Vector3 d) => d; public Vector3 TransformVector(Vector3 v) => v; public Vector3 InverseTransformVector(Vector3 v) => v; public void Translate(Vector3 t) { } public void Translate(float x, float y, float z) { } public void Rotate(Vector3 e) { } public void Rotate(float x, float y, float z) { } public void RotateAround(Vector3 point, Vector3 axis, float angle) { } public void LookAt(Transform t) { } public void LookAt(Transform t, Vector3 worldUp) { } public void LookAt(Vector3 p) { } public void LookAt(Vector3 p, Vector3 worldUp) { } public void DetachChildren() { } public Transform Find(string n, bool includeInactive) => Find(n); public IEnumerator GetEnumerator() { yield break; } } public class GameObject : Object { public GameObject() { } public GameObject(string name) { this.name = name; } public GameObject(string name, params Type[] components) { this.name = name; } private Transform _transform; public Transform transform => _transform ??= new Transform(this); public GameObject gameObject => this; public bool activeSelf => false; public bool activeInHierarchy => false; public int layer { get; set; } public string tag { get; set; } public void SetActive(bool value) { } // Headless component model: the resolution-path ctor (and copied views) acquire components // off prefab GameObjects and use them unguarded (F1). Lazily create + cache a no-op instance // per concrete Component-derived type so those touches resolve harmlessly instead of NRE. // Non-Component T or abstract/uninstantiable T still returns default (null). // ConcurrentDictionary because Resources.Load returns SHARED prefab GameObjects across // concurrent battle setups, so two engines' Setup() may race on the same _components map. private System.Collections.Concurrent.ConcurrentDictionary _components; private object GetOrAddComponent(Type t) { if (t == null || t.IsAbstract || !typeof(Component).IsAssignableFrom(t)) return null; var map = _components; if (map == null) { var fresh = new System.Collections.Concurrent.ConcurrentDictionary(); map = System.Threading.Interlocked.CompareExchange(ref _components, fresh, null) ?? fresh; } // GetOrAdd may invoke the factory more than once under contention; only one result wins. // Safe here: the discarded instance has its _go set to `this` (private write to a soon- // unreachable object) and WireComponentFields only assigns to the new tree's own private // fields. The shared _noopViewMaterial sentinel below is read-only. No global state leaks. return map.GetOrAdd(t, ty => { object inst; try { inst = Activator.CreateInstance(ty); } catch { return null; } if (inst is Component comp) comp._go = this; WireComponentFields(inst); return inst; }); } // The createNullView:false card-creation path reads many view-leaf reference fields off a // CardTemplate component (UILabel/MeshRenderer/Transform/GameObject) UNGUARDED, plus the // copied NGUI cosmetic helpers (CardTemplate.SetNumberLabelStyle -> UIBase_CardManager -> // UIFont.material / UILabel.material) read material backing fields. The real engine wires all // of this from the prefab in SBattleLoad.CreateUnitCardTemplate, which we skip headless. Fill // any null GameObject/Component-derived view field with a no-op instance. Pure no-ops: // nothing here computes game state (the token's authoritative stats come from CardCSVData). internal const System.Reflection.BindingFlags WireFlags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance; private static readonly Material _noopViewMaterial = new Material { name = "ShimNoOpMaterial" }; // Create a no-op view-leaf instance and pre-set the NGUI material backing fields the copied // UIFont.material / UILabel.material getters read so they return non-null. Only mMat/mMaterial // are filled: blanket-filling mReplacement/mAtlas/mDynamicFont would make those getters // DELEGATE down a chain that re-nulls. One level deep — no recursion into the created leaf. private static object Materialize(Type t) { var o = Activator.CreateInstance(t); SetBackingMaterial(o, "mMat"); // UIFont SetBackingMaterial(o, "mMaterial"); // UILabel / UIWidget return o; } private static void SetBackingMaterial(object o, string field) { var f = o.GetType().GetField(field, WireFlags); if (f != null && f.FieldType == typeof(Material) && f.GetValue(o) == null) f.SetValue(o, _noopViewMaterial); } internal static void WireComponentFields(object inst) { foreach (var f in inst.GetType().GetFields(WireFlags)) { if (f.GetValue(inst) != null) continue; var ft = f.FieldType; if (ft == typeof(GameObject) || (typeof(Component).IsAssignableFrom(ft) && !ft.IsAbstract)) { try { f.SetValue(inst, Materialize(ft)); } catch { } } else if (ft == typeof(Material)) { f.SetValue(inst, _noopViewMaterial); } } } public T GetComponent() => (T)(GetOrAddComponent(typeof(T)) ?? default(T)); public Component GetComponent(Type t) => (Component)GetOrAddComponent(t); public Component GetComponent(string t) => null; public T GetComponentInChildren() => default; public T GetComponentInChildren(bool includeInactive) => default; public T[] GetComponentsInChildren() => new T[0]; public T[] GetComponentsInChildren(bool includeInactive) => new T[0]; public T GetComponentInParent() => default; public T GetComponentInParent(bool includeInactive) => default; public T[] GetComponents() => new T[0]; public Component[] GetComponents(Type t) => new Component[0]; public T AddComponent() where T : Component => (T)(GetOrAddComponent(typeof(T)) ?? default(T)); public Component AddComponent(Type t) => (Component)GetOrAddComponent(t); public void SendMessage(string method) { } public void SendMessage(string method, object value) { } public void SendMessage(string method, object value, SendMessageOptions options) { } public void SendMessage(string method, SendMessageOptions options) { } public void BroadcastMessage(string method) { } public void BroadcastMessage(string method, object parameter) { } public void BroadcastMessage(string method, object parameter, SendMessageOptions options) { } public bool CompareTag(string t) => false; public static GameObject Find(string n) => null; public static GameObject FindGameObjectWithTag(string t) => null; public static GameObject[] FindGameObjectsWithTag(string t) => new GameObject[0]; } public class ScriptableObject : Object { } // Factory for no-op view/manager objects that are NOT acquired via GameObject.GetComponent (e.g. // UIManager.getUIBase_CardManager()). Creates the instance and runs the same field-wiring the // component model applies, so the copied cosmetic helpers it exposes resolve headless. public static class ShimView { public static T Create() where T : class { var o = System.Activator.CreateInstance(typeof(T)); GameObject.WireComponentFields(o); return (T)o; } } // ---- rendering / physics / audio (pure no-op presentation) ---- public class Renderer : Component { public Material material { get; set; } public Material[] materials { get; set; } public Material sharedMaterial { get; set; } public Material[] sharedMaterials { get; set; } public bool enabled { get; set; } public bool isVisible => false; public int sortingOrder { get; set; } public string sortingLayerName { get; set; } public int sortingLayerID { get; set; } public Bounds bounds => default; public ShadowCastingMode shadowCastingMode { get; set; } public bool receiveShadows { get; set; } } public enum ShadowCastingMode { Off, On, TwoSided, ShadowsOnly } public class MeshRenderer : Renderer { } public class SkinnedMeshRenderer : Renderer { public Mesh sharedMesh { get; set; } public Transform rootBone { get; set; } public Transform[] bones { get; set; } } public class SpriteRenderer : Renderer { public Sprite sprite { get; set; } public Color color { get; set; } } public class MeshFilter : Component { public Mesh mesh { get; set; } public Mesh sharedMesh { get; set; } } public class ParticleSystem : Component { public void Play() { } public void Play(bool withChildren) { } public void Stop() { } public void Stop(bool withChildren) { } public void Pause() { } public void Clear() { } public void Clear(bool withChildren) { } public void Simulate(float t) { } public bool isPlaying => false; public bool isPaused => false; public bool isStopped => true; public bool IsAlive() => false; public bool IsAlive(bool withChildren) => false; public int particleCount => 0; public MainModule main => default; public EmissionModule emission => default; public int GetParticles(Particle[] p) => 0; public void SetParticles(Particle[] p, int n) { } public struct MainModule { public float duration; public float startLifetime; public bool loop; public float startSpeed; public bool playOnAwake; public float simulationSpeed; public MinMaxGradient startColor; } public struct MinMaxGradient { public Color color; public MinMaxGradient(Color c) { color = c; } public static implicit operator MinMaxGradient(Color c) => new MinMaxGradient(c); } public struct EmissionModule { public bool enabled; public float rateOverTime; } public struct Particle { public Vector3 position; public Vector3 velocity; public Color32 startColor; public float remainingLifetime; } } public class ParticleSystemRenderer : Renderer { public SpriteMaskInteraction maskInteraction { get; set; } public Material trailMaterial { get; set; } } public enum SpriteMaskInteraction { None, VisibleInsideMask, VisibleOutsideMask } public partial class LODGroup : Component { } public class Collider : Component { public bool enabled { get; set; } } public class BoxCollider : Collider { public Vector3 size { get; set; } public Vector3 center { get; set; } public bool isTrigger { get; set; } } public partial class Rigidbody : Component { } public class Rigidbody2D : Component { public bool isKinematic { get; set; } } public partial class Material : Object { public Material() { } public Material(Material src) { } public Material(Shader shader) { } public Color color { get; set; } public Shader shader { get; set; } public Texture mainTexture { get; set; } public Vector2 mainTextureOffset { get; set; } public Vector2 mainTextureScale { get; set; } public int renderQueue { get; set; } public string[] shaderKeywords { get; set; } public float GetFloat(string n) => 0f; public int GetInt(string n) => 0; public Color GetColor(string n) => Color.white; public Texture GetTexture(string n) => null; public Vector4 GetVector(string n) => default; public void SetFloat(string n, float v) { } public void SetInt(string n, int v) { } public void SetColor(string n, Color c) { } public void SetTexture(string n, Texture t) { } public void SetVector(string n, Vector4 v) { } public void SetVector(int nameID, Vector4 v) { } public void SetMatrix(string n, Matrix4x4 m) { } public void SetTextureOffset(string n, Vector2 o) { } public void EnableKeyword(string k) { } public void DisableKeyword(string k) { } public bool IsKeywordEnabled(string k) => false; public bool HasProperty(string n) => false; } public partial class Mesh : Object { public Vector3[] vertices { get; set; } public int[] triangles { get; set; } public void Clear() { } public void RecalculateBounds() { } } public class Texture : Object { public int width => 0; public int height => 0; } public partial class Texture2D : Texture { public Texture2D(int w, int h) { } public Texture2D(int w, int h, TextureFormat format, bool mipChain) { } public void Apply() { } public Color GetPixel(int x, int y) => Color.white; public void SetPixel(int x, int y, Color c) { } } public enum FilterMode { Point, Bilinear, Trilinear } public enum TextureWrapMode { Repeat, Clamp, Mirror, MirrorOnce } public enum WrapMode { Once = 1, Loop = 2, PingPong = 4, Default = 0, ClampForever = 8, Clamp = 1 } public struct Keyframe { public float time; public float value; public float inTangent; public float outTangent; public Keyframe(float t, float v) { time = t; value = v; inTangent = 0; outTangent = 0; } public Keyframe(float t, float v, float inT, float outT) { time = t; value = v; inTangent = inT; outTangent = outT; } } public struct AnimatorStateInfo { public bool IsName(string name) => false; public float normalizedTime => 0f; public int shortNameHash => 0; public int fullPathHash => 0; public float length => 0f; } public struct AnimatorClipInfo { public AnimationClip clip => null; public float weight => 0f; } public class RenderTexture : Texture { public RenderTexture(int w, int h, int depth) { } public RenderTexture(int w, int h, int depth, RenderTextureFormat fmt) { } public void Create() { } public void Release() { } public bool IsCreated() => false; public static RenderTexture active { get; set; } public int depth { get; set; } public FilterMode filterMode { get; set; } public TextureWrapMode wrapMode { get; set; } public void DiscardContents() { } public static RenderTexture GetTemporary(int w, int h) => null; public static RenderTexture GetTemporary(int w, int h, int depth) => null; public static RenderTexture GetTemporary(int w, int h, int depth, RenderTextureFormat fmt) => null; public static void ReleaseTemporary(RenderTexture rt) { } } public partial class Sprite : Object { public Rect rect => default; public Texture2D texture => null; public static Sprite Create(Texture2D t, Rect r, Vector2 pivot) => null; } public partial class Shader : Object { public static Shader Find(string n) => null; public bool isSupported => true; } public class AnimationClip : Object { public float length => 0f; public string name { get; set; } public float frameRate => 0f; } public partial class Animation : Component, IEnumerable { public AnimationClip clip { get; set; } public bool isPlaying => false; public void Play() { } public void Play(string n) { } public void Stop() { } public IEnumerator GetEnumerator() { yield break; } public AnimationState this[string name] => null; } public class Animator : Component { public void SetTrigger(string n) { } public void SetTrigger(int id) { } public void SetBool(string n, bool v) { } public void SetInteger(string n, int v) { } public void SetFloat(string n, float v) { } public bool GetBool(string n) => false; public int GetInteger(string n) => 0; public float GetFloat(string n) => 0f; public void Play(string n) { } public void Play(int hash) { } public void Play(string n, int layer) { } public void Play(string n, int layer, float normalizedTime) { } public void Play(int hash, int layer) { } public void Play(int hash, int layer, float normalizedTime) { } public void SetLayerWeight(int layer, float w) { } public float speed { get; set; } public bool enabled { get; set; } public void ResetTrigger(string n) { } public void ResetTrigger(int id) { } public void Update(float dt) { } public AnimatorStateInfo GetCurrentAnimatorStateInfo(int layer) => default; public AnimatorClipInfo[] GetCurrentAnimatorClipInfo(int layer) => new AnimatorClipInfo[0]; } public class AnimationCurve { public AnimationCurve() { } public AnimationCurve(params Keyframe[] keys) { } public float Evaluate(float t) => 0f; public int length => 0; public Keyframe[] keys { get; set; } public WrapMode preWrapMode { get; set; } public WrapMode postWrapMode { get; set; } public static AnimationCurve Linear(float a, float b, float c, float d) => new AnimationCurve(); } public class AudioClip : Object { public float length => 0f; } public partial class AudioSource : Component { public AudioClip clip { get; set; } public float volume { get; set; } public bool isPlaying => false; public bool loop { get; set; } public void Play() { } public void Stop() { } public void Pause() { } } public partial class Camera : Component { public static Camera main => null; public static Camera current => null; public static int allCamerasCount => 0; public static Camera[] allCameras => new Camera[0]; public float nearClipPlane { get; set; } public float farClipPlane { get; set; } public float fieldOfView { get; set; } public float orthographicSize { get; set; } public bool orthographic { get; set; } public float aspect { get; set; } public float depth { get; set; } public int cullingMask { get; set; } public int pixelWidth => 1920; public int pixelHeight => 1080; public Rect rect { get; set; } public Rect pixelRect { get; set; } public Color backgroundColor { get; set; } public CameraClearFlags clearFlags { get; set; } public RenderTexture targetTexture { get; set; } public Vector3 ViewportToWorldPoint(Vector3 p) => p; public Vector3 WorldToViewportPoint(Vector3 p) => p; public Vector3 ScreenToWorldPoint(Vector3 p) => p; public Vector3 WorldToScreenPoint(Vector3 p) => p; public Vector3 ViewportToScreenPoint(Vector3 p) => p; public Vector3 ScreenToViewportPoint(Vector3 p) => p; public Ray ScreenPointToRay(Vector3 p) => default; public Ray ViewportPointToRay(Vector3 p) => default; public void Render() { } } public enum CameraClearFlags { Skybox = 1, Color = 2, SolidColor = 2, Depth = 3, Nothing = 4 } public partial struct CharacterInfo { } // ---- coroutine machinery (never pumped headless; types must exist) ---- public class YieldInstruction { } public sealed class Coroutine : YieldInstruction { } public sealed class WaitForEndOfFrame : YieldInstruction { } public sealed class WaitForSeconds : YieldInstruction { public WaitForSeconds(float s) { } } public sealed class WaitForFixedUpdate : YieldInstruction { } // ---- input ---- public struct Touch { public int fingerId; public Vector2 position; public TouchPhase phase; public int tapCount; } // ---- enums (grow members as the compiler demands) ---- public enum FontStyle { Normal, Bold, Italic, BoldAndItalic } public enum TouchPhase { Began, Moved, Stationary, Ended, Canceled } // KeyCode lives in UnityRuntime.cs (full enum). [Flags] public enum HideFlags { None = 0, HideInHierarchy = 1, HideInInspector = 2, DontSaveInEditor = 4, NotEditable = 8, DontSaveInBuild = 16, DontUnloadUnusedAsset = 32, DontSave = 52, HideAndDontSave = 61 } public enum SendMessageOptions { RequireReceiver, DontRequireReceiver } // ---- attributes: permissive ctors accept any compile-time attribute args ---- public class SerializeField : Attribute { } public class HideInInspector : Attribute { } public class ExecuteInEditMode : Attribute { } public class ExecuteAlwaysAttribute : Attribute { } public class DisallowMultipleComponentAttribute : Attribute { } public class AndroidJavaObject : IDisposable { public AndroidJavaObject(string className, params object[] args) { } public T Call(string method, params object[] args) => default; public void Call(string method, params object[] args) { } public T Get(string name) => default; public void Set(string name, T val) { } public void Dispose() { } } public class WebCamTexture : Texture { public WebCamTexture() { } public WebCamTexture(int w, int h, int fps) { } public WebCamTexture(string deviceName, int w, int h, int fps) { } public void Play() { } public void Stop() { } public bool isPlaying => false; public Color32[] GetPixels32() => new Color32[0]; public static WebCamDevice[] devices => System.Array.Empty(); } public class AddComponentMenu : Attribute { public AddComponentMenu(string n) { } public AddComponentMenu(string n, int o) { } } public class ContextMenu : Attribute { public ContextMenu(string n) { } } [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public class RequireComponent : Attribute { public RequireComponent(Type a) { } public RequireComponent(Type a, Type b) { } public RequireComponent(Type a, Type b, Type c) { } } public class HeaderAttribute : Attribute { public HeaderAttribute(string h) { } } public class TooltipAttribute : Attribute { public TooltipAttribute(string t) { } } public class SpaceAttribute : Attribute { public SpaceAttribute() { } public SpaceAttribute(float h) { } } public class RangeAttribute : Attribute { public RangeAttribute(float min, float max) { } } public class MultilineAttribute : Attribute { public MultilineAttribute() { } public MultilineAttribute(int lines) { } } // ---- subsystem singletons / statics ---- public static partial class Application { public static bool isEditor => false; public static bool isPlaying => true; public static bool isMobilePlatform => false; public static string persistentDataPath => ""; public static string dataPath => ""; public static string temporaryCachePath => ""; public static string version => "1.0"; public static string identifier => ""; public static int targetFrameRate { get; set; } public static RuntimePlatform platform => RuntimePlatform.WindowsPlayer; public static SystemLanguage systemLanguage => SystemLanguage.English; public static void Quit() { } public static event System.Action focusChanged { add { } remove { } } } public enum RuntimePlatform { WindowsPlayer, OSXPlayer, IPhonePlayer, Android, WindowsEditor, OSXEditor, LinuxPlayer, XBOX360, BlackBerryPlayer, PS4, XboxOne, Switch, Stadia } public enum SystemLanguage { English, Japanese, ChineseSimplified, ChineseTraditional, Korean, French, German, Chinese, Unknown } public static partial class Time { public static float deltaTime => 0f; public static float time => 0f; public static float unscaledTime => 0f; public static float unscaledDeltaTime => 0f; public static float fixedDeltaTime => 0.02f; public static float realtimeSinceStartup => 0f; public static float timeScale { get; set; } public static int frameCount => 0; public static float timeSinceLevelLoad => 0f; } public static partial class Screen { public static int width => 1920; public static int height => 1080; public static float dpi => 96f; public static ScreenOrientation orientation { get; set; } public static bool fullScreen { get; set; } public static Resolution currentResolution => default; } public enum ScreenOrientation { Portrait, PortraitUpsideDown, LandscapeLeft, LandscapeRight, AutoRotation } public struct Resolution { public int width; public int height; public int refreshRate; } }