fix(ass): fix Playable obfuscation under NDMF; use fixed callbackOrder + NDMF Plugin API for build ordering#1
Conversation
|
@copilot 我的意思是直接用NDMF的API注册到NDMF概念中的最后一个阶段 |
查了 NDMF (
修复:把"存在 NDMF"分支的 |
|
@copilot 现在混淆所有 Playable的功能没有正常工作 |
…r + NDMF Plugin API
Fixed both issues. Root cause of "混淆所有 Playable" 失效: 架构调整: |
|
@copilot 最后一个阶段应该是#sym:PlatformFinish |
确认了, |
|
@copilot 更新一下所有的文档 |
已改为 |
There was a problem hiding this comment.
Pull request overview
This PR fixes ASS “Playable Layer obfuscation” when building under NDMF by removing an unwired, reflection-based NDMF detection path and instead explicitly threading hasNDMF from the build entrypoint. It also simplifies build ordering by using a fixed VRCSDK callbackOrder = -1024 for the non-NDMF path, while registering into NDMF’s build pipeline directly (PlatformFinish) when NDMF is present, and updates the docs/changelog accordingly.
Changes:
- Fix Playable controller renaming under NDMF by passing
hasNDMFintoObfuscatePlayableControllers(...)and removing the dead internal NDMF-detection field. - Replace runtime reflection-based
callbackOrderswitching with a fixed-1024, and add an NDMF Plugin API pass (BuildPhase.PlatformFinish) for the NDMF path. - Update README/technical docs/changelog to reflect the new build-order behavior and the NDMF vs standalone execution model.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Assets/UnityBox/AvatarSecuritySystem/Editor/README.md | Documentation updates describing the new fixed callbackOrder behavior and the NDMF Plugin API path. |
| Assets/UnityBox/AvatarSecuritySystem/Editor/Processor.cs | Makes standalone processing use fixed callbackOrder = -1024, skips processing when NDMF_AVAILABLE, and threads hasNDMF into the core pipeline. |
| Assets/UnityBox/AvatarSecuritySystem/Editor/Obfuscator.cs | Removes dead reflection-based NDMF detection and uses an explicit hasNDMF parameter to control Generated-path requirements. |
| Assets/UnityBox/AvatarSecuritySystem/Editor/NDMF/UnityBox.AvatarSecuritySystem.NDMF.asmdef | Adds an NDMF-gated editor assembly that only compiles when NDMF is installed. |
| Assets/UnityBox/AvatarSecuritySystem/Editor/NDMF/NDMFPlugin.cs | Registers ASS into NDMF at BuildPhase.PlatformFinish and propagates failures via exception. |
| Assets/UnityBox/AvatarSecuritySystem/Editor/ASS_TechnicalDoc.md | Technical doc updates for pipeline ordering and the NDMF vs standalone execution flow. |
| Assets/UnityBox/AvatarSecuritySystem/CHANGELOG.md | Adds Unreleased changelog entries for the NDMF obfuscation fix and build-order refactor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Processor.callbackOrderpreviously dynamically detected NDMF (via reflection onnadena.dev.ndmf.BuildContext) and switched between-1026(no NDMF) and-1024/-1023(NDMF present). Further investigation and review feedback revealed two problems: the "obfuscate all Playable Layers" feature was silently broken under NDMF, and there was no need to keep dynamically switchingcallbackOrderat runtime — NDMF's own Plugin API should be used to register into NDMF's build pipeline directly when NDMF is present.Root cause: obfuscation broken under NDMF
Obfuscator.cshad its own independent, reflection-based NDMF-detection field (_hasNDMF/HasNDMF) that was never assigned by any caller. This meantObfuscatePlayableControllersalways computedhasNDMF = falseinternally, forcingrequireGeneratedPath = trueeven when NDMF was present — silently skipping renaming of every NDMF-cloned controller (since those aren't under theGeneratedasset folder). Fixed by having the caller (Processor) passhasNDMFexplicitly as a parameter, eliminating the dead/unwired field.Processor.cscallbackOrderis now a fixed-1024(no more runtime reflection to pick between values) — used only in the no-NDMF scenario. This is the samecallbackOrderVRCFury uses for its ownRemoveEditorOnlyObjectsHook, but the two hooks operate on unrelated data, so their relative execution order has no functional impact#if NDMF_AVAILABLE),OnPreprocessAvatarimmediately returnstrue; actual processing moves toNDMFPlugininsteadProcessAvatarand its helper methods are nowstaticand take an explicithasNDMFparameter instead of relying on a cached reflection fieldEditor/NDMF/(new sub-assembly)NDMFPlugin, which registers with NDMF's own Plugin API atBuildPhase.PlatformFinish(the true last phase in NDMF'sBuiltInPhaseslist, running afterOptimizing), running after all other NDMF passes (Modular Avatar, VRCFury's NDMF-integrated passes, etc.) but before NDMF commits its virtual result to real assets (context.Finish()) — completely bypassing the VRCSDKcallbackOrderaxisUnityBox.AvatarSecuritySystem.NDMF.asmdefis gated bydefineConstraints: ["NDMF_AVAILABLE"], so it (and its hard reference tonadena.dev.ndmf) only compiles when the NDMF package is actually installed, avoiding compile breakage for users without NDMFProcessAvatar's failure result by throwing, so NDMF surfaces build failures instead of silently continuingObfuscator.cs_hasNDMF/HasNDMF)ObfuscatePlayableControllersnow takeshasNDMFas an explicit parameterASS_TechnicalDoc.md/Editor/README.md-1024VRCSDK callback (no-NDMF path, safely coexisting with VRCFury'sRemoveEditorOnlyObjectsHook) versus the NDMF Plugin API registration atBuildPhase.PlatformFinish(NDMF-present path)CHANGELOG.mdcallbackOrder+ NDMF Plugin API designOriginal prompt
Created from VS Code.