VRCQuestTools
VRCQuestTools copied to clipboard
Implement VQT Fallback Avatar component for automatic fallback avatar setting
- [x] Create FallbackAvatar runtime component (marker component)
- [x] Create FallbackAvatarEditor custom inspector
- [x] Add localization strings for the component (EN, JA)
- [x] Implement upload success callback using IVRCSDKPreprocessAvatarCallback and SDK events
- [x] Add IAvatarRootComponent interface for avatar root validation
- [x] Refactor to remove NDMF dependency from callback mechanism
- [x] Refine callback implementation based on code review
- [x] Address additional code review feedback
- [x] Merge master branch
- [x] Address unresolved code review comments
- [ ] Test the implementation
Architecture
Callback Structure
ActualPerformanceCallback (Editor/Callbacks/ActualPerformanceCallback.cs):
- Calculates actual performance rating without NDMF dependency
- Runs with
callbackOrder => int.MaxValue(runs last to calculate final performance) - Stores performance rating in static
LastActualPerformanceRatingdictionary - Documented thread safety: Unity main thread only access via synchronization context
FallbackAvatarCallback (Editor/Callbacks/FallbackAvatarCallback.cs):
- Detects FallbackAvatar component with
callbackOrder => -100000(before NDMF optimizations) - Early returns for PC builds (only processes mobile builds)
- Subscribes to
OnSdkUploadSuccessevent - Smart pending avatar cleanup:
- Keeps in pending list if performance rating not found (allows retry)
- Removes if performance requirement not met
- Removes after successful fallback setting
- Uses TryGetValue for efficient dictionary access
- Wrapped in try-catch for safety with documented async void behavior
NDMF Compatibility
- NDMF files (
VRCQuestToolsActualPerformanceCallback.cs,NdmfSessionState.cs) remain unchanged - Callbacks work correctly whether NDMF is installed or not
Recent Updates
- Addressed code review feedback on pending avatar cleanup logic
- Added thread safety documentation
- Improved retry behavior for missing performance ratings
Original prompt
This section details on the original issue you should resolve
<issue_title>VQT Fallback Avatar コンポーネントの実装</issue_title> <issue_description>親Issue kurotu/VRCQuestTools#153 の要件に従ってコンポーネント及びフォールバック設定の適用処理を作成する。</issue_description>
Comments on the Issue (you are @copilot in this section)
- Fixes kurotu/VRCQuestTools#164
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.