Commit 4805bc1
committed
fix(compat): keep Runtime helpers compiling when Physics 2D / Screen Capture modules are disabled (#1160)
v9.7.0 introduced two Runtime regressions that block compilation when users
disable the matching built-in modules in Package Manager:
- UnityPhysicsCompat.cs used `typeof(Physics2D)` directly, contradicting the
file's own contract of reflection-based access ("survive eventual removal
without recompile"). Switched to `Type.GetType("UnityEngine.Physics2D,
UnityEngine.Physics2DModule")` so the shim degrades gracefully when the
Physics 2D module is off.
- ScreenshotUtility.CaptureComposited bypassed the existing reflective
ScreenCapture path (s_captureScreenshotMethod) with a direct call to
ScreenCapture.CaptureScreenshotAsTexture. Cached a second MethodInfo
(s_captureScreenshotAsTextureMethod) and routed the call through it, so
the file compiles with the Screen Capture module disabled and falls back
to camera capture at runtime — matching the behavior the file already
advertises via IsScreenCaptureModuleAvailable.1 parent 5d0c2bd commit 4805bc1
2 files changed
Lines changed: 20 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
249 | 252 | | |
250 | 253 | | |
251 | 254 | | |
252 | | - | |
| 255 | + | |
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
| |||
266 | 269 | | |
267 | 270 | | |
268 | 271 | | |
269 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
270 | 275 | | |
271 | 276 | | |
272 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
| |||
0 commit comments