Skip to content

Commit e159732

Browse files
committed
fix: add Unity type stubs for DocFX v2 compilation
DocFX v2 uses Roslyn to compile C# files. Without UnityEngine.dll, types like MonoBehaviour, AudioClip, etc. fail to resolve, causing: - 14 CS0246 compilation warnings - Broken <see cref="AudioClip"/> → !:AudioClip (UnityXrefMaps can't link it) - Missing inheritance chain in generated docs UnityStubs/UnityEngine.cs provides minimal stubs for the types used in Player.cs. Placed outside Assets/ so Unity ignores it. The SDK auto-includes it in DocFxForUnity.csproj. filterConfig.yml excludes the UnityEngine namespace so stubs never appear as published API pages. Result: 0 compilation errors, full inheritance chain, correct xref links. https://claude.ai/code/session_01HDAawqjLMudEktivP5ifXw
1 parent 98f8e2c commit e159732

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

UnityStubs/UnityEngine.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Minimal Unity type stubs for DocFX documentation generation.
2+
// Outside Assets/ so Unity ignores this file at build time.
3+
using System;
4+
5+
namespace UnityEngine
6+
{
7+
public class Object {}
8+
public class Component : Object {}
9+
public class Behaviour : Component {}
10+
public class MonoBehaviour : Behaviour {}
11+
12+
public class AudioClip : Object {}
13+
14+
public class AudioSource : Behaviour
15+
{
16+
public void PlayOneShot(AudioClip clip) {}
17+
}
18+
19+
public static class Debug
20+
{
21+
public static void Log(object message) {}
22+
}
23+
24+
[AttributeUsage(AttributeTargets.Field)]
25+
public sealed class SerializeFieldAttribute : Attribute {}
26+
}

0 commit comments

Comments
 (0)