feat(battle-engine): UnityEngine member + static-class shims (3526->2706)

Extend the UnityEngine value/component shims with no-op members surfaced by the compile
loop (UnityWebRequest/Font/Mesh/LODGroup/AudioSource/Rigidbody/Camera/Sprite/Animation/
Transform/Material/Texture2D/Light/Input/Resources + CharacterInfo/Vector4), via partial
declarations + UnityShimExt.cs. Add the missing UnityEngine static classes (PlayerPrefs/
Physics/GUI/SystemInfo/Graphics/QualitySettings/StackTraceUtility) + enums (TextureFormat/
ColorSpace/EventModifiers/RenderTextureReadWrite) + Experimental.Rendering.GraphicsFormat*
in UnityStatics.cs. All cosmetic, off the battle path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-05 22:14:23 -04:00
parent 9cd3f40a2f
commit d01e3da869
6 changed files with 335 additions and 22 deletions

View File

@@ -5,7 +5,7 @@ using System;
namespace UnityEngine
{
public static class Input
public static partial class Input
{
public static Vector3 mousePosition => Vector3.zero;
public static Vector2 mouseScrollDelta => Vector2.zero;
@@ -46,7 +46,7 @@ namespace UnityEngine
public static Color ColorHSV() => Color.white;
}
public static class Resources
public static partial class Resources
{
public static T Load<T>(string path) where T : Object => null;
public static T Load<T>(string path, Type t) where T : Object => null;

View File

@@ -8,7 +8,7 @@ using System.Collections;
namespace UnityEngine
{
// ---- value types (Vector2/3, Quaternion, Color, Mathf, Debug live in Primitives.cs) ----
public 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 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
{
@@ -113,7 +113,7 @@ namespace UnityEngine
public bool IsInvoking() => false;
}
public class Transform : Component, IEnumerable
public partial class Transform : Component, IEnumerable
{
public Vector3 position { get; set; }
public Vector3 localPosition { get; set; }
@@ -231,12 +231,12 @@ namespace UnityEngine
public struct Particle { public Vector3 position; public Vector3 velocity; public Color32 startColor; public float remainingLifetime; }
}
public class ParticleSystemRenderer : Renderer { }
public class LODGroup : Component { }
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 class Rigidbody : Component { }
public partial class Rigidbody : Component { }
public class Rigidbody2D : Component { }
public class Material : Object
public partial class Material : Object
{
public Material() { }
public Material(Material src) { }
@@ -265,9 +265,9 @@ namespace UnityEngine
public bool IsKeywordEnabled(string k) => false;
public bool HasProperty(string n) => false;
}
public class Mesh : Object { public Vector3[] vertices { get; set; } public int[] triangles { get; set; } public void Clear() { } public void RecalculateBounds() { } }
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 class Texture2D : Texture { public Texture2D(int w, int h) { } public void Apply() { } public Color GetPixel(int x, int y) => Color.white; public void SetPixel(int x, int y, Color c) { } }
public partial class Texture2D : Texture { public Texture2D(int w, int h) { } 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 }
@@ -275,10 +275,10 @@ namespace UnityEngine
public struct AnimatorStateInfo { public bool IsName(string name) => false; public float normalizedTime => 0f; public int shortNameHash => 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 class Sprite : Object { public Rect rect => default; public Texture2D texture => null; public static Sprite Create(Texture2D t, Rect r, Vector2 pivot) => null; }
public class Shader : Object { public static Shader Find(string n) => null; public bool isSupported => true; }
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 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 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 class Animator : Component
{
public void SetTrigger(string n) { } public void SetTrigger(int id) { }
@@ -295,8 +295,8 @@ namespace UnityEngine
}
public class AnimationCurve { 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 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 class Camera : Component
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;
@@ -328,7 +328,7 @@ namespace UnityEngine
public void Render() { }
}
public enum CameraClearFlags { Skybox = 1, Color = 2, SolidColor = 2, Depth = 3, Nothing = 4 }
public struct CharacterInfo { }
public partial struct CharacterInfo { }
// ---- coroutine machinery (never pumped headless; types must exist) ----
public class YieldInstruction { }
@@ -366,7 +366,7 @@ namespace UnityEngine
public class MultilineAttribute : Attribute { public MultilineAttribute() { } public MultilineAttribute(int lines) { } }
// ---- subsystem singletons / statics ----
public static class Application
public static partial class Application
{
public static bool isEditor => false;
public static bool isPlaying => true;
@@ -384,7 +384,7 @@ namespace UnityEngine
}
public enum RuntimePlatform { WindowsPlayer, OSXPlayer, IPhonePlayer, Android, WindowsEditor, OSXEditor, LinuxPlayer }
public enum SystemLanguage { English, Japanese, ChineseSimplified, ChineseTraditional, Korean, French, German, Unknown }
public static class Time
public static partial class Time
{
public static float deltaTime => 0f;
public static float time => 0f;
@@ -396,7 +396,7 @@ namespace UnityEngine
public static int frameCount => 0;
public static float timeSinceLevelLoad => 0f;
}
public static class Screen
public static partial class Screen
{
public static int width => 1920;
public static int height => 1080;

View File

@@ -36,8 +36,8 @@ namespace UnityEngine
public class AssetBundleRequest : AsyncOperation { public Object asset => null; public Object[] allAssets => new Object[0]; }
public class Collider2D : Component { public bool enabled { get; set; } }
public class BoxCollider2D : Collider2D { }
public class Light : Behaviour { }
public partial class BoxCollider2D : Collider2D { }
public partial class Light : Behaviour { }
public class AudioListener : Behaviour { }
public enum RenderTextureFormat { ARGB32, Depth, ARGBHalf, ARGB64, Default }

View File

@@ -0,0 +1,206 @@
// AUTHORED SHIM (not copied). No-op member extensions to the UnityEngine value/component
// shims, added as the M1 compile loop surfaced specific calls from copied engine/view
// code. Signatures mirror the real UnityEngine API at the call sites (arg counts/types
// taken from the decomp). None executes headless — all return safe defaults.
using System;
using System.Collections.Generic;
namespace UnityEngine
{
public partial struct Vector4
{
public static Vector4 zero => default;
public static Vector4 one => new Vector4(1f, 1f, 1f, 1f);
}
public partial class Transform
{
public bool hasChanged { get; set; }
public Matrix4x4 localToWorldMatrix => default;
public Matrix4x4 worldToLocalMatrix => default;
}
public partial class LODGroup
{
public bool enabled { get; set; }
public LOD[] GetLODs() => Array.Empty<LOD>();
}
public struct LOD
{
public float screenRelativeTransitionHeight;
public Renderer[] renderers;
public LOD(float height, Renderer[] rends) { screenRelativeTransitionHeight = height; renderers = rends; }
}
public partial class Rigidbody
{
public bool isKinematic { get; set; }
public bool useGravity { get; set; }
public void MovePosition(Vector3 position) { }
public void MoveRotation(Quaternion rotation) { }
}
public partial class Material
{
public void CopyPropertiesFromMaterial(Material mat) { }
public void SetVectorArray(string name, Vector4[] values) { }
public void SetVectorArray(int nameID, Vector4[] values) { }
public void SetVectorArray(string name, List<Vector4> values) { }
public void SetVectorArray(int nameID, List<Vector4> values) { }
}
public partial class Mesh
{
public int vertexCount => 0;
public Vector3[] normals { get; set; }
public Vector4[] tangents { get; set; }
public Vector2[] uv { get; set; }
public Color32[] colors32 { get; set; }
public void MarkDynamic() { }
public void RecalculateNormals() { }
public void RecalculateTangents() { }
}
public partial class Texture2D
{
public byte[] EncodeToPNG() => Array.Empty<byte>();
public Color32[] GetPixels32() => Array.Empty<Color32>();
public void SetPixels32(Color32[] colors) { }
public bool LoadImage(byte[] data) => false;
}
public partial class Sprite
{
public Rect textureRect => default;
public Vector2 textureRectOffset => default;
}
public partial class Shader
{
public static int PropertyToID(string name) => 0;
public static void SetGlobalColor(string name, Color value) { }
public static void SetGlobalColor(int nameID, Color value) { }
}
public partial class Animation
{
public bool enabled { get; set; }
public bool IsPlaying(string name) => false;
public void Sample() { }
}
public partial class AudioSource
{
public float pitch { get; set; }
public bool playOnAwake { get; set; }
public int priority { get; set; }
public void PlayOneShot(AudioClip clip) { }
public void PlayOneShot(AudioClip clip, float volumeScale) { }
}
public partial class Camera
{
public bool enabled { get; set; }
public bool allowMSAA { get; set; }
public int eventMask { get; set; }
public TransparencySortMode transparencySortMode { get; set; }
public void ResetAspect() { }
public static int GetAllCameras(Camera[] cameras) => 0;
}
public enum TransparencySortMode { Default, Perspective, Orthographic, CustomAxis }
public partial struct CharacterInfo
{
public int advance;
public int minX, maxX, minY, maxY;
public Vector2 uvBottomLeft, uvBottomRight, uvTopLeft, uvTopRight;
}
public partial class Font
{
public string[] fontNames { get; set; }
public Material material { get; set; }
public static event Action<Font> textureRebuilt;
public bool GetCharacterInfo(char ch, out CharacterInfo info, int size, FontStyle style)
{ info = default; return false; }
public bool GetCharacterInfo(char ch, out CharacterInfo info, int size)
{ info = default; return false; }
public bool GetCharacterInfo(char ch, out CharacterInfo info)
{ info = default; return false; }
public void RequestCharactersInTexture(string characters, int size, FontStyle style) { }
public void RequestCharactersInTexture(string characters, int size) { }
public void RequestCharactersInTexture(string characters) { }
// suppress unused-event warning while keeping the API surface
private void _TouchTextureRebuilt() => textureRebuilt?.Invoke(this);
}
public partial class Light
{
public Color color { get; set; }
}
public partial class Time
{
public static float smoothDeltaTime => 0f;
}
public partial class Application
{
public static string streamingAssetsPath => "";
public static NetworkReachability internetReachability => NetworkReachability.NotReachable;
public static void OpenURL(string url) { }
}
public enum NetworkReachability { NotReachable, ReachableViaCarrierDataNetwork, ReachableViaLocalAreaNetwork }
public partial class Screen
{
public static int sleepTimeout { get; set; }
public static void SetResolution(int width, int height, bool fullscreen) { }
public static void SetResolution(int width, int height, FullScreenMode mode) { }
}
public enum FullScreenMode { ExclusiveFullScreen, FullScreenWindow, MaximizedWindow, Windowed }
public enum IMECompositionMode { Auto, On, Off }
public partial class Input
{
public static Vector2 compositionCursorPos { get; set; }
public static string compositionString => "";
public static IMECompositionMode imeCompositionMode { get; set; }
}
public partial class Resources
{
public static Object[] FindObjectsOfTypeAll(Type type) => Array.Empty<Object>();
public static T[] FindObjectsOfTypeAll<T>() => Array.Empty<T>();
}
}
namespace UnityEngine.Networking
{
public partial class UnityWebRequest
{
public static string EscapeURL(string s) => s;
public static UnityWebRequest Get(string uri) => new UnityWebRequest();
public UnityWebRequestAsyncOperation SendWebRequest() => new UnityWebRequestAsyncOperation();
public void SetRequestHeader(string name, string value) { }
public string GetResponseHeader(string name) => null;
public Dictionary<string, string> GetResponseHeaders() => new Dictionary<string, string>();
public bool isDone => true;
public float downloadProgress => 1f;
public long responseCode => 200;
public string error => null;
public DownloadHandler downloadHandler { get; set; }
public UploadHandler uploadHandler { get; set; }
}
public class DownloadHandler { public byte[] data => Array.Empty<byte>(); public string text => ""; }
public class UploadHandler { }
public class UploadHandlerRaw : UploadHandler { public UploadHandlerRaw(byte[] data) { } }
public class DownloadHandlerBuffer : DownloadHandler { }
public class UnityWebRequestAsyncOperation : AsyncOperation { }
}

View File

@@ -0,0 +1,107 @@
// AUTHORED SHIM (not copied). UnityEngine static-class surface (prefs, physics, IMGUI,
// device info, rendering) referenced by tangentially-copied engine code (settings,
// post-processing, raycast UI, device fingerprinting). All cosmetic / off the battle
// path; every member is a no-op returning a safe default.
using System;
namespace UnityEngine
{
public static class PlayerPrefs
{
public static void DeleteAll() { }
public static void DeleteKey(string key) { }
public static bool HasKey(string key) => false;
public static void Save() { }
public static float GetFloat(string key, float defaultValue = 0f) => defaultValue;
public static int GetInt(string key, int defaultValue = 0) => defaultValue;
public static string GetString(string key, string defaultValue = "") => defaultValue;
public static void SetFloat(string key, float value) { }
public static void SetInt(string key, int value) { }
public static void SetString(string key, string value) { }
}
public static class Physics
{
public static Vector3 gravity { get; set; }
public static bool Raycast(Ray ray, out RaycastHit hit, float maxDistance = float.PositiveInfinity, int layerMask = -1)
{ hit = default; return false; }
public static bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit hit, float maxDistance = float.PositiveInfinity, int layerMask = -1)
{ hit = default; return false; }
public static RaycastHit[] RaycastAll(Ray ray, float maxDistance = float.PositiveInfinity, int layerMask = -1)
=> Array.Empty<RaycastHit>();
public static RaycastHit[] RaycastAll(Vector3 origin, Vector3 direction, float maxDistance = float.PositiveInfinity, int layerMask = -1)
=> Array.Empty<RaycastHit>();
}
public static class GUI
{
public static Color color { get; set; }
public static void Label(Rect position, string text) { }
}
public static class SystemInfo
{
public static string deviceModel => "";
public static string deviceName => "";
public static string deviceUniqueIdentifier => "";
public static string operatingSystem => "";
public static string graphicsDeviceName => "";
public static string graphicsDeviceVersion => "";
public static int graphicsShaderLevel => 0;
public static int graphicsMemorySize => 0;
public static int systemMemorySize => 0;
public static int processorCount => 1;
public static string processorType => "";
public static bool SupportsRenderTextureFormat(RenderTextureFormat format) => true;
public static bool SupportsTextureFormat(TextureFormat format) => true;
public static bool IsFormatSupported(Experimental.Rendering.GraphicsFormat format, Experimental.Rendering.FormatUsage usage) => true;
}
public static class Graphics
{
public static void Blit(Texture source, RenderTexture dest) { }
public static void Blit(Texture source, RenderTexture dest, Material mat) { }
public static void Blit(Texture source, RenderTexture dest, Material mat, int pass) { }
}
public static class QualitySettings
{
public static ColorSpace activeColorSpace => ColorSpace.Linear;
public static int vSyncCount { get; set; }
}
public static class StackTraceUtility
{
public static string ExtractStackTrace() => "";
}
public enum ColorSpace { Uninitialized = -1, Gamma = 0, Linear = 1 }
public enum RenderTextureReadWrite { Default, Linear, sRGB }
public enum TextureFormat
{
Alpha8, ARGB4444, RGB24, RGBA32, ARGB32, RGB565, R16, DXT1, DXT5,
RGBA4444, BGRA32, RHalf, RGHalf, RGBAHalf, RFloat, RGFloat, RGBAFloat,
ARGB64, ASTC_6x6, ETC2_RGB, ETC2_RGBA8, ETC_RGB4, PVRTC_RGB4
}
[Flags]
public enum EventModifiers
{
None = 0, Shift = 1, Control = 2, Alt = 4, Command = 8,
Numeric = 16, CapsLock = 32, FunctionKey = 64
}
}
namespace UnityEngine.Experimental.Rendering
{
public enum GraphicsFormat { None, R8G8B8A8_UNorm, R16G16B16A16_SFloat, R32G32B32A32_SFloat, D32_SFloat }
[Flags]
public enum FormatUsage { Sample = 1, Linear = 2, Sparse = 4, Render = 8, Blend = 16, MSAA2x = 32 }
public static class GraphicsFormatUtility
{
public static GraphicsFormat GetGraphicsFormat(RenderTextureFormat format, RenderTextureReadWrite readWrite) => GraphicsFormat.None;
public static GraphicsFormat GetGraphicsFormat(TextureFormat format, bool isSRGB) => GraphicsFormat.None;
}
}