@alpsckr/unitycli 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/contracts/command-contract.json +109 -217
- package/contracts/package-files.json +374 -294
- package/contracts/stable-session/direct-call-semantics.json +8 -2
- package/contracts/tool-completion-contract.json +148 -672
- package/dist/bridge/admission.d.ts +17 -1
- package/dist/bridge/admission.js +2 -0
- package/dist/bridge/admission.js.map +1 -1
- package/dist/bridge/domains/asset.js +3 -1
- package/dist/bridge/domains/asset.js.map +1 -1
- package/dist/bridge/domains/camera.js +39 -7
- package/dist/bridge/domains/camera.js.map +1 -1
- package/dist/bridge/domains/console.js +2 -1
- package/dist/bridge/domains/console.js.map +1 -1
- package/dist/bridge/domains/doctor.d.ts +3 -0
- package/dist/bridge/domains/doctor.js +8 -0
- package/dist/bridge/domains/doctor.js.map +1 -0
- package/dist/bridge/domains/editor.js +0 -4
- package/dist/bridge/domains/editor.js.map +1 -1
- package/dist/bridge/domains/game-object.js +4 -12
- package/dist/bridge/domains/game-object.js.map +1 -1
- package/dist/bridge/domains/graphics.js +1 -16
- package/dist/bridge/domains/graphics.js.map +1 -1
- package/dist/bridge/domains/object.js +3 -0
- package/dist/bridge/domains/object.js.map +1 -1
- package/dist/bridge/domains/physics.js +1 -2
- package/dist/bridge/domains/physics.js.map +1 -1
- package/dist/bridge/domains/profiler.js +18 -7
- package/dist/bridge/domains/profiler.js.map +1 -1
- package/dist/bridge/domains/project-tool.js +4 -0
- package/dist/bridge/domains/project-tool.js.map +1 -1
- package/dist/bridge/domains/reflection.js +10 -2
- package/dist/bridge/domains/reflection.js.map +1 -1
- package/dist/bridge/domains/runtime-tool.js +3 -0
- package/dist/bridge/domains/runtime-tool.js.map +1 -1
- package/dist/bridge/domains/scene.js +3 -8
- package/dist/bridge/domains/scene.js.map +1 -1
- package/dist/bridge/domains/screenshot.js +30 -6
- package/dist/bridge/domains/screenshot.js.map +1 -1
- package/dist/bridge/domains/ui.js +3 -1
- package/dist/bridge/domains/ui.js.map +1 -1
- package/dist/bridge/index.d.ts +5 -5
- package/dist/bridge/index.js +6 -9
- package/dist/bridge/index.js.map +1 -1
- package/dist/bridge/registry.js +3 -5
- package/dist/bridge/registry.js.map +1 -1
- package/dist/bridge/session-supervisor.d.ts +6 -3
- package/dist/bridge/session-supervisor.js +122 -34
- package/dist/bridge/session-supervisor.js.map +1 -1
- package/dist/bridge/types.d.ts +6 -5
- package/dist/bridge/types.js +16 -2
- package/dist/bridge/types.js.map +1 -1
- package/dist/catalog-protocol.d.ts +64 -0
- package/dist/catalog-protocol.js +460 -0
- package/dist/catalog-protocol.js.map +1 -0
- package/dist/cli-commands/command.js +84 -61
- package/dist/cli-commands/command.js.map +1 -1
- package/dist/cli-commands/extensions.js +70 -50
- package/dist/cli-commands/extensions.js.map +1 -1
- package/dist/cli-commands/instances.js +1 -1
- package/dist/cli-commands/instances.js.map +1 -1
- package/dist/cli-process-owners.d.ts +6 -0
- package/dist/cli-process-owners.js +27 -0
- package/dist/cli-process-owners.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +20 -5
- package/dist/cli.js.map +1 -1
- package/dist/contracts/command-contract.js +14 -4
- package/dist/contracts/command-contract.js.map +1 -1
- package/dist/doctor.d.ts +4 -6
- package/dist/doctor.js +429 -398
- package/dist/doctor.js.map +1 -1
- package/dist/editor-blocker-observer.d.ts +2 -1
- package/dist/editor-blocker-observer.js +40 -13
- package/dist/editor-blocker-observer.js.map +1 -1
- package/dist/extension-availability.d.ts +27 -9
- package/dist/extension-availability.js +96 -56
- package/dist/extension-availability.js.map +1 -1
- package/dist/extensions/descriptor-loader.d.ts +2 -2
- package/dist/extensions/descriptor-loader.js +3 -4
- package/dist/extensions/descriptor-loader.js.map +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/installer.d.ts +24 -7
- package/dist/extensions/installer.js +142 -66
- package/dist/extensions/installer.js.map +1 -1
- package/dist/extensions/registry.js +3 -5
- package/dist/extensions/registry.js.map +1 -1
- package/dist/extensions/state-contract.d.ts +11 -0
- package/dist/extensions/state-contract.js +50 -0
- package/dist/extensions/state-contract.js.map +1 -0
- package/dist/instances.d.ts +13 -1
- package/dist/instances.js +26 -0
- package/dist/instances.js.map +1 -1
- package/dist/package-manager.d.ts +0 -24
- package/dist/package-manager.js +5 -58
- package/dist/package-manager.js.map +1 -1
- package/dist/project-tool-discovery.d.ts +5 -2
- package/dist/project-tool-discovery.js +22 -18
- package/dist/project-tool-discovery.js.map +1 -1
- package/dist/runtime-code.js +1 -1
- package/dist/runtime-code.js.map +1 -1
- package/dist/tool-name.d.ts +4 -0
- package/dist/tool-name.js +15 -0
- package/dist/tool-name.js.map +1 -0
- package/dist/tools/.generated-completion-registry.d.ts +2 -0
- package/dist/tools/.generated-completion-registry.js +763 -325
- package/dist/tools/.generated-completion-registry.js.map +1 -1
- package/dist/tools/.generated-registry.d.ts +6 -11
- package/dist/tools/.generated-registry.js +6 -11
- package/dist/tools/.generated-registry.js.map +1 -1
- package/dist/tools/.generated-schemas.js +11 -16
- package/dist/tools/.generated-schemas.js.map +1 -1
- package/dist/tools/asset/refresh-status.d.ts +3 -0
- package/dist/tools/asset/refresh-status.js +12 -0
- package/dist/tools/asset/refresh-status.js.map +1 -0
- package/dist/tools/asset/refresh.js +7 -3
- package/dist/tools/asset/refresh.js.map +1 -1
- package/dist/tools/build/player-status.d.ts +3 -0
- package/dist/tools/build/player-status.js +12 -0
- package/dist/tools/build/player-status.js.map +1 -0
- package/dist/tools/build/run.js +1 -1
- package/dist/tools/build/run.js.map +1 -1
- package/dist/tools/catalog-control.d.ts +22 -0
- package/dist/tools/catalog-control.js +335 -0
- package/dist/tools/catalog-control.js.map +1 -0
- package/dist/tools/catalog.d.ts +7 -9
- package/dist/tools/catalog.js +66 -45
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/commands.d.ts +1 -1
- package/dist/tools/commands.js +44 -11
- package/dist/tools/commands.js.map +1 -1
- package/dist/tools/define.js +3 -2
- package/dist/tools/define.js.map +1 -1
- package/dist/tools/dispatcher.d.ts +53 -6
- package/dist/tools/dispatcher.js +277 -108
- package/dist/tools/dispatcher.js.map +1 -1
- package/dist/tools/editor/compile.js +1 -1
- package/dist/tools/editor/compile.js.map +1 -1
- package/dist/tools/editor/play-mode-status.d.ts +3 -0
- package/dist/tools/editor/play-mode-status.js +12 -0
- package/dist/tools/editor/play-mode-status.js.map +1 -0
- package/dist/tools/editor/readiness.d.ts +0 -1
- package/dist/tools/editor/readiness.js +0 -1
- package/dist/tools/editor/readiness.js.map +1 -1
- package/dist/tools/editor/refresh.d.ts +7 -3
- package/dist/tools/editor/refresh.js +20 -15
- package/dist/tools/editor/refresh.js.map +1 -1
- package/dist/tools/editor/state.d.ts +2 -2
- package/dist/tools/editor/state.js +13 -12
- package/dist/tools/editor/state.js.map +1 -1
- package/dist/tools/metadata/derived.js +1 -7
- package/dist/tools/metadata/derived.js.map +1 -1
- package/dist/tools/metadata/status.js +1 -12
- package/dist/tools/metadata/status.js.map +1 -1
- package/dist/tools/metadata/types.d.ts +0 -2
- package/dist/tools/navmesh/live.js +1 -1
- package/dist/tools/navmesh/live.js.map +1 -1
- package/dist/tools/occlusion/live.js +1 -1
- package/dist/tools/occlusion/live.js.map +1 -1
- package/dist/tools/package/deploy.js +2 -2
- package/dist/tools/package/deploy.js.map +1 -1
- package/dist/tools/package/embed.js +1 -1
- package/dist/tools/package/embed.js.map +1 -1
- package/dist/tools/package/install-status.d.ts +3 -0
- package/dist/tools/package/install-status.js +12 -0
- package/dist/tools/package/install-status.js.map +1 -0
- package/dist/tools/package/install.js +3 -3
- package/dist/tools/package/install.js.map +1 -1
- package/dist/tools/package/live-resolve.js +45 -12
- package/dist/tools/package/live-resolve.js.map +1 -1
- package/dist/tools/package/registry-clear.js.map +1 -1
- package/dist/tools/package/registry-set.js.map +1 -1
- package/dist/tools/package/remove-status.d.ts +3 -0
- package/dist/tools/package/remove-status.js +12 -0
- package/dist/tools/package/remove-status.js.map +1 -0
- package/dist/tools/package/remove.js +3 -3
- package/dist/tools/package/remove.js.map +1 -1
- package/dist/tools/package/resolve.js +3 -3
- package/dist/tools/package/resolve.js.map +1 -1
- package/dist/tools/package/restore.js +2 -2
- package/dist/tools/package/restore.js.map +1 -1
- package/dist/tools/package/scoped-registry-add.js.map +1 -1
- package/dist/tools/status/support.d.ts +13 -0
- package/dist/tools/status/support.js +28 -0
- package/dist/tools/status/support.js.map +1 -0
- package/dist/tools/test/cancel.js +2 -2
- package/dist/tools/test/cancel.js.map +1 -1
- package/dist/tools/test/run-status.d.ts +3 -0
- package/dist/tools/test/run-status.js +12 -0
- package/dist/tools/test/run-status.js.map +1 -0
- package/dist/tools/test/run.js +7 -4
- package/dist/tools/test/run.js.map +1 -1
- package/dist/tools/tools/group-summaries.js +10 -14
- package/dist/tools/tools/group-summaries.js.map +1 -1
- package/docs/architecture.md +4 -4
- package/docs/availability-differences.md +4 -4
- package/docs/command-execution.md +4 -3
- package/docs/error-codes.md +13 -5
- package/docs/extensions.md +1 -7
- package/docs/risk-and-side-effects.md +4 -3
- package/docs/safety-boundaries.md +3 -1
- package/docs/target-and-instance.md +1 -1
- package/docs/tool-discovery.md +17 -10
- package/docs/tool-execution.md +18 -7
- package/extensions/cinemachine/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/extensions/hdrp/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/extensions/probuilder/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/extensions/urp/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/extensions/vfx-graph/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/package.json +2 -4
- package/skills/unitycli/SKILL.md +35 -42
- package/skills/unitycli/manifest.json +1 -1
- package/skills/unitycli/references/operation-protocol.md +3 -3
- package/unitypkg/Editor/AssemblyInfo.cs +5 -0
- package/unitypkg/Editor/Bridge/BridgeCommandRegistry.cs +49 -14
- package/unitypkg/Editor/Bridge/BridgeHttpServer.cs +9 -35
- package/unitypkg/Editor/Bridge/BridgeQueueState.cs +672 -0
- package/unitypkg/Editor/Bridge/BridgeWorkQueue.cs +970 -120
- package/unitypkg/Editor/BridgeStartupStateMachine.cs +59 -1
- package/unitypkg/Editor/Commands/ProjectToolCommands.cs +4 -0
- package/unitypkg/Editor/Commands/RuntimeToolCommands.cs +3 -0
- package/unitypkg/Editor/Generated/UnityCliToolCompletionRegistry.g.cs +379 -14
- package/unitypkg/Editor/Infrastructure/CodeExecSupport.cs +28 -13
- package/unitypkg/Editor/Infrastructure/RegistryOwnershipResolver.cs +132 -105
- package/unitypkg/Editor/Infrastructure/UnityCliActiveOperation.cs +138 -29
- package/unitypkg/Editor/Infrastructure/UnityCliAdmission.cs +1856 -237
- package/unitypkg/Editor/Infrastructure/UnityCliDoctorDiagnostics.cs +220 -0
- package/unitypkg/Editor/Infrastructure/UnityCliDurableStatusCoordinator.cs +118 -0
- package/unitypkg/Editor/Infrastructure/UnityCliEditorStateSnapshot.cs +2 -1
- package/unitypkg/Editor/Infrastructure/UnityCliHierarchyPager.cs +203 -0
- package/unitypkg/Editor/Infrastructure/UnityCliInstanceCleanup.cs +2 -1
- package/unitypkg/Editor/Infrastructure/UnityCliInstanceRegistry.cs +201 -63
- package/unitypkg/Editor/Infrastructure/UnityCliJson.cs +2 -3
- package/unitypkg/Editor/Infrastructure/UnityCliLiveBuildCoordinator.cs +289 -46
- package/unitypkg/Editor/Infrastructure/UnityCliLiveRefreshCoordinator.cs +87 -53
- package/unitypkg/Editor/Infrastructure/UnityCliNavMeshBakeCoordinator.cs +4 -4
- package/unitypkg/Editor/Infrastructure/UnityCliObjectRef.cs +128 -25
- package/unitypkg/Editor/Infrastructure/UnityCliObjectSerializer.cs +435 -327
- package/unitypkg/Editor/Infrastructure/UnityCliOcclusionBakeCoordinator.cs +4 -4
- package/unitypkg/Editor/Infrastructure/UnityCliOperationCoordinator.cs +351 -53
- package/unitypkg/Editor/Infrastructure/UnityCliPackageResolveCoordinator.cs +118 -18
- package/unitypkg/Editor/Infrastructure/UnityCliPackageResolveState.cs +20 -1
- package/unitypkg/Editor/Infrastructure/UnityCliReadGeneration.cs +97 -0
- package/unitypkg/Editor/Infrastructure/UnityCliReflection.cs +644 -133
- package/unitypkg/Editor/Infrastructure/UnityCliReloadOperation.cs +128 -41
- package/unitypkg/Editor/Infrastructure/UnityCliRuntimeExecutor.cs +14 -84
- package/unitypkg/Editor/Infrastructure/UnityCliSerializer.cs +220 -0
- package/unitypkg/Editor/Infrastructure/UnityCliSessionMutationLease.cs +69 -29
- package/unitypkg/Editor/Infrastructure/UnityCliTestRunCoordinator.cs +440 -54
- package/unitypkg/Editor/Infrastructure/UnityCliWaiter.cs +128 -35
- package/unitypkg/Editor/ProjectTools/IUnityCliTool.cs +9 -1
- package/unitypkg/Editor/ProjectTools/OfficialAttributeToolRegistry.cs +32 -31
- package/unitypkg/Editor/ProjectTools/ProjectToolRegistry.cs +607 -458
- package/unitypkg/Editor/ProjectTools/ProjectToolSchemaValidator.cs +35 -7
- package/unitypkg/Editor/ProjectTools/RegisteredTool.cs +501 -60
- package/unitypkg/Editor/ProjectTools/UnityCliProjectToolContext.cs +21 -0
- package/unitypkg/Editor/ProjectTools/UnityCliSchemaDeriver.cs +36 -7
- package/unitypkg/Editor/ProjectTools/UnityCliToolName.cs +30 -0
- package/unitypkg/Editor/Properties/AssemblyInfo.cs +3 -0
- package/unitypkg/Editor/Tools/asset/get-data.cs +16 -7
- package/unitypkg/Editor/Tools/build/BuildSceneStateTool.cs +23 -3
- package/unitypkg/Editor/Tools/build/BuildToolDtos.cs +2 -1
- package/unitypkg/Editor/Tools/build/scene/add.cs +6 -3
- package/unitypkg/Editor/Tools/build/scene/disable.cs +1 -1
- package/unitypkg/Editor/Tools/build/scene/enable.cs +1 -1
- package/unitypkg/Editor/Tools/build/scene/list.cs +1 -1
- package/unitypkg/Editor/Tools/build/scene/remove.cs +13 -3
- package/unitypkg/Editor/Tools/camera/CameraToolSupport.cs +38 -38
- package/unitypkg/Editor/Tools/camera/multiview.cs +13 -6
- package/unitypkg/Editor/Tools/camera/screenshot.cs +14 -7
- package/unitypkg/Editor/Tools/component/get.cs +16 -9
- package/unitypkg/Editor/Tools/component/modify.cs +6 -4
- package/unitypkg/Editor/Tools/console/clear.cs +7 -6
- package/unitypkg/Editor/Tools/console/get.cs +48 -16
- package/unitypkg/Editor/Tools/editor/EditorToolSupport.cs +143 -28
- package/unitypkg/Editor/Tools/editor/menu-items.cs +1 -1
- package/unitypkg/Editor/Tools/editor/play.cs +2 -11
- package/unitypkg/Editor/Tools/editor/selection.cs +1 -1
- package/unitypkg/Editor/Tools/editor/stop.cs +2 -11
- package/unitypkg/Editor/Tools/editor/windows.cs +1 -1
- package/unitypkg/Editor/Tools/go/GameObjectToolSupport.cs +54 -4
- package/unitypkg/Editor/Tools/go/delete.cs +1 -1
- package/unitypkg/Editor/Tools/go/find.cs +167 -70
- package/unitypkg/Editor/Tools/graphics/GraphicsToolSupport.cs +25 -0
- package/unitypkg/Editor/Tools/graphics/light-probe-group.cs +9 -3
- package/unitypkg/Editor/Tools/graphics/pipeline-info.cs +1 -1
- package/unitypkg/Editor/Tools/graphics/pipeline-settings.cs +1 -1
- package/unitypkg/Editor/Tools/graphics/quality.cs +2 -2
- package/unitypkg/Editor/Tools/graphics/reflection-probe.cs +3 -3
- package/unitypkg/Editor/Tools/graphics/stats.cs +1 -1
- package/unitypkg/Editor/Tools/object/ObjectToolSupport.cs +4 -4
- package/unitypkg/Editor/Tools/object/get-data.cs +9 -7
- package/unitypkg/Editor/Tools/object/modify.cs +7 -5
- package/unitypkg/Editor/Tools/physics/raycast.cs +24 -6
- package/unitypkg/Editor/Tools/prefab/stage.cs +1 -1
- package/unitypkg/Editor/Tools/profiler/ProfilerFrameDebuggerSupport.cs +94 -21
- package/unitypkg/Editor/Tools/profiler/ProfilerMemorySnapshotSupport.cs +397 -10
- package/unitypkg/Editor/Tools/profiler/ProfilerToolSupport.cs +18 -4
- package/unitypkg/Editor/Tools/profiler/frame-debugger/enable.cs +1 -1
- package/unitypkg/Editor/Tools/profiler/frame-debugger/events.cs +88 -87
- package/unitypkg/Editor/Tools/profiler/hierarchy.cs +278 -112
- package/unitypkg/Editor/Tools/profiler/memory-snapshot/compare.cs +9 -5
- package/unitypkg/Editor/Tools/profiler/memory-snapshot/list.cs +37 -35
- package/unitypkg/Editor/Tools/profiler/memory-snapshot/take.cs +99 -97
- package/unitypkg/Editor/Tools/project/info.cs +1 -1
- package/unitypkg/Editor/Tools/project/layers.cs +1 -1
- package/unitypkg/Editor/Tools/project/tags.cs +1 -1
- package/unitypkg/Editor/Tools/reflection/method/call.cs +9 -7
- package/unitypkg/Editor/Tools/reflection/method/find.cs +27 -37
- package/unitypkg/Editor/Tools/reflection/type/schema.cs +24 -28
- package/unitypkg/Editor/Tools/scene/gameobject/component.cs +8 -5
- package/unitypkg/Editor/Tools/scene/gameobject/components.cs +10 -7
- package/unitypkg/Editor/Tools/scene/gameobject-support.cs +104 -8
- package/unitypkg/Editor/Tools/scene/gameobject.cs +37 -16
- package/unitypkg/Editor/Tools/scene/hierarchy.cs +146 -142
- package/unitypkg/Editor/Tools/screenshot/EditorElementCaptureToolSupport.cs +77 -25
- package/unitypkg/Editor/Tools/screenshot/ScreenshotToolSupport.cs +315 -95
- package/unitypkg/Editor/Tools/screenshot/editor-element.cs +7 -5
- package/unitypkg/Editor/Tools/screenshot/game-view.cs +35 -21
- package/unitypkg/Editor/Tools/screenshot/isolated-object.cs +29 -23
- package/unitypkg/Editor/Tools/screenshot/orbit.cs +37 -25
- package/unitypkg/Editor/Tools/screenshot/scene-view.cs +25 -18
- package/unitypkg/Editor/Tools/screenshot/screen.cs +177 -17
- package/unitypkg/Editor/Tools/screenshot/surround.cs +83 -79
- package/unitypkg/Editor/Tools/ui/render-preview.cs +16 -11
- package/unitypkg/Editor/UnityCliBridge.cs +97 -34
- package/unitypkg/Runtime/Infrastructure/UnityCliRuntimeBridge.cs +753 -122
- package/unitypkg/Runtime/Properties/AssemblyInfo.cs +5 -0
- package/unitypkg/Runtime/UnityCli.Runtime.asmdef +1 -1
- package/unitypkg/Shared/AssemblyInfo.cs +4 -0
- package/unitypkg/Shared/UnityCliAdmissionPool.cs +265 -75
- package/unitypkg/Shared/UnityCliBridgeQueuePolicy.cs +410 -0
- package/unitypkg/Shared/UnityCliBridgeWorkItemState.cs +47 -0
- package/unitypkg/Shared/UnityCliExceptionProjection.cs +151 -0
- package/unitypkg/Shared/UnityCliQueuePublication.cs +30 -0
- package/unitypkg/Shared/UnityCliRequestBudget.cs +352 -0
- package/unitypkg/Shared/UnityCliRuntimeRequestPublication.cs +107 -0
- package/unitypkg/Tests/Editor/UnityCli.Editor.Tests.asmdef +2 -2
- package/unitypkg/Tests/Editor/UnityCliAdmissionCoordinatorIntegrationTests.cs +1329 -0
- package/unitypkg/Tests/Editor/UnityCliAdmissionPoolTests.cs +311 -114
- package/unitypkg/Tests/Editor/UnityCliAdmissionRepairStateTests.cs +94 -0
- package/unitypkg/Tests/Editor/UnityCliBridgeAdmissionIntegrationTests.cs +1229 -0
- package/unitypkg/Tests/Editor/UnityCliBridgeQueuePolicyTests.cs +412 -0
- package/unitypkg/Tests/Editor/UnityCliContinuationIntegrationTests.cs +292 -0
- package/unitypkg/Tests/Editor/UnityCliDiagnosticBoundaryTests.cs +120 -0
- package/unitypkg/Tests/Editor/UnityCliDurableStatusTests.cs +84 -0
- package/unitypkg/Tests/Editor/UnityCliExceptionProjectionTests.cs +72 -0
- package/unitypkg/Tests/Editor/UnityCliInstancePublicationRetryTests.cs +180 -97
- package/unitypkg/Tests/Editor/UnityCliMemoryReflectionIntegrationTests.cs +434 -0
- package/unitypkg/Tests/Editor/UnityCliRequestBudgetTests.cs +615 -0
- package/unitypkg/Tests/Editor/UnityCliRuntimeBridgeIntegrationTests.cs +520 -0
- package/unitypkg/Tests/Editor/UnityCliToolCatalogTests.cs +562 -0
- package/unitypkg/Tests/Runtime/UnityCli.Runtime.Tests.asmdef +23 -0
- package/unitypkg/Tests/Runtime/UnityCliRuntimeCatalogValidationTests.cs +29 -0
- package/unitypkg/package.json +1 -1
- package/contracts/static-capability-catalog.json +0 -48226
- package/dist/bridge/domains/diagnose.d.ts +0 -2
- package/dist/bridge/domains/diagnose.js +0 -11
- package/dist/bridge/domains/diagnose.js.map +0 -1
- package/dist/bridge/domains/extension.d.ts +0 -8
- package/dist/bridge/domains/extension.js +0 -20
- package/dist/bridge/domains/extension.js.map +0 -1
- package/dist/capabilities.d.ts +0 -5
- package/dist/capabilities.js +0 -84
- package/dist/capabilities.js.map +0 -1
- package/dist/static-capability-catalog.d.ts +0 -13
- package/dist/static-capability-catalog.js +0 -41
- package/dist/static-capability-catalog.js.map +0 -1
- package/dist/tools/diagnose/capabilities.d.ts +0 -13
- package/dist/tools/diagnose/capabilities.js +0 -34
- package/dist/tools/diagnose/capabilities.js.map +0 -1
- package/dist/tools/package/info.d.ts +0 -19
- package/dist/tools/package/info.js +0 -27
- package/dist/tools/package/info.js.map +0 -1
- package/dist/tools/package/list.d.ts +0 -27
- package/dist/tools/package/list.js +0 -21
- package/dist/tools/package/list.js.map +0 -1
- package/dist/tools/package/registry-get.d.ts +0 -10
- package/dist/tools/package/registry-get.js +0 -22
- package/dist/tools/package/registry-get.js.map +0 -1
- package/dist/tools/package/scoped-registry-list.d.ts +0 -14
- package/dist/tools/package/scoped-registry-list.js +0 -22
- package/dist/tools/package/scoped-registry-list.js.map +0 -1
- package/dist/tools/package/search.d.ts +0 -17
- package/dist/tools/package/search.js +0 -39
- package/dist/tools/package/search.js.map +0 -1
- package/dist/tools/package/status.d.ts +0 -21
- package/dist/tools/package/status.js +0 -37
- package/dist/tools/package/status.js.map +0 -1
- package/dist/tools/tools/describe.d.ts +0 -27
- package/dist/tools/tools/describe.js +0 -35
- package/dist/tools/tools/describe.js.map +0 -1
- package/dist/tools/tools/group-list.d.ts +0 -16
- package/dist/tools/tools/group-list.js +0 -38
- package/dist/tools/tools/group-list.js.map +0 -1
- package/dist/tools/tools/group.d.ts +0 -13
- package/dist/tools/tools/group.js +0 -34
- package/dist/tools/tools/group.js.map +0 -1
- package/dist/tools/tools/pagination.d.ts +0 -17
- package/dist/tools/tools/pagination.js +0 -28
- package/dist/tools/tools/pagination.js.map +0 -1
- package/dist/tools/tools/search.d.ts +0 -15
- package/dist/tools/tools/search.js +0 -42
- package/dist/tools/tools/search.js.map +0 -1
- package/unitypkg/Editor/Tools/diagnose/preflight.cs +0 -269
- package/unitypkg/Editor/Tools/editor/console.cs +0 -26
- package/unitypkg/Editor/Tools/extension/status.cs +0 -87
- package/unitypkg/Editor/Tools/go/inspect.cs +0 -49
- package/unitypkg/Editor/Tools/graphics/pipeline-quality.cs +0 -24
- package/unitypkg/Editor/Tools/graphics/probe-positions.cs +0 -58
- package/unitypkg/Editor/Tools/graphics/settings.cs +0 -104
- package/unitypkg/Editor/Tools/graphics/stats-counters.cs +0 -28
- package/unitypkg/Editor/Tools/graphics/stats-memory.cs +0 -21
- package/unitypkg/Editor/Tools/instances/list.cs +0 -71
- package/unitypkg/Editor/Tools/physics/raycast-all.cs +0 -67
- package/unitypkg/Editor/Tools/scene/build-settings.cs +0 -69
- package/unitypkg/Editor/Tools/scene/data.cs +0 -125
- package/unitypkg/Editor/Tools/tests/list.cs +0 -98
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System;
|
|
3
|
-
using System.Collections.Generic;
|
|
4
|
-
using System.IO;
|
|
5
|
-
using System.Linq;
|
|
6
|
-
|
|
7
|
-
namespace UnityCli
|
|
8
|
-
{
|
|
9
|
-
/// <summary>
|
|
10
|
-
/// extension.status — 返回可选 Unity 包的安装可用性(Library/PackageCache 探测)。
|
|
11
|
-
/// </summary>
|
|
12
|
-
public class ExtensionStatusTool : IUnityCliTool<ExtensionStatusTool.Request, ExtensionStatusTool.Result>
|
|
13
|
-
{
|
|
14
|
-
public sealed class Request
|
|
15
|
-
{
|
|
16
|
-
public string ExtensionId { get; set; }
|
|
17
|
-
public string Id { get; set; }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public sealed class Result
|
|
21
|
-
{
|
|
22
|
-
public bool Ok { get; set; } = true;
|
|
23
|
-
public List<string> Installed { get; set; }
|
|
24
|
-
public List<PackageAvailability> Packages { get; set; }
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public sealed class PackageAvailability
|
|
28
|
-
{
|
|
29
|
-
public string Name { get; set; }
|
|
30
|
-
public bool Available { get; set; }
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public ToolDescriptor Describe() => new()
|
|
34
|
-
{
|
|
35
|
-
Name = "extension.status",
|
|
36
|
-
Summary = "Report optional Unity package availability for CLI extension flows.",
|
|
37
|
-
Description = "Return basic package availability status for CLI-side extension flows. Probes Library/PackageCache for known optional packages (probuilder, cinemachine, visualeffectgraph, URP, HDRP). Install/remove are handled by the CLI command layer.",
|
|
38
|
-
Group = "extension",
|
|
39
|
-
DestructiveHint = false,
|
|
40
|
-
Target = "editor",
|
|
41
|
-
PlayModeSupport = "supported",
|
|
42
|
-
DefaultTimeoutMs = 30000,
|
|
43
|
-
MaxTimeoutMs = 600000,
|
|
44
|
-
Examples = new[]
|
|
45
|
-
{
|
|
46
|
-
new ToolExample { Description = "Check extension package availability", Input = new Request { } }
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request request, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
51
|
-
{
|
|
52
|
-
// 已知可选包列表,用于检测扩展依赖的 Unity 包是否已安装
|
|
53
|
-
var optionalPackages = new[]
|
|
54
|
-
{
|
|
55
|
-
"com.unity.probuilder",
|
|
56
|
-
"com.unity.cinemachine",
|
|
57
|
-
"com.unity.visualeffectgraph",
|
|
58
|
-
"com.unity.render-pipelines.universal",
|
|
59
|
-
"com.unity.render-pipelines.high-definition"
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var packages = new List<PackageAvailability>();
|
|
63
|
-
foreach (var pkg in optionalPackages.OrderBy(p => p, StringComparer.Ordinal))
|
|
64
|
-
{
|
|
65
|
-
var available = false;
|
|
66
|
-
try
|
|
67
|
-
{
|
|
68
|
-
var matches = Directory.GetFiles("Library/PackageCache", pkg + "@*", SearchOption.TopDirectoryOnly);
|
|
69
|
-
available = matches.Length > 0;
|
|
70
|
-
}
|
|
71
|
-
catch
|
|
72
|
-
{
|
|
73
|
-
available = false;
|
|
74
|
-
}
|
|
75
|
-
packages.Add(new PackageAvailability { Name = pkg, Available = available });
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result
|
|
79
|
-
{
|
|
80
|
-
Ok = true,
|
|
81
|
-
Installed = new List<string>(),
|
|
82
|
-
Packages = packages
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
#endif
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using UnityEngine;
|
|
3
|
-
|
|
4
|
-
namespace UnityCli
|
|
5
|
-
{
|
|
6
|
-
/// <summary>
|
|
7
|
-
/// go.inspect — 查看单个 GameObject 的摘要(id/name/path/active/tag/layer/transform/components/children)。
|
|
8
|
-
/// </summary>
|
|
9
|
-
public class GameObjectInspectTool : IUnityCliTool<GameObjectInspectTool.Request, GameObjectInspectTool.Result>
|
|
10
|
-
{
|
|
11
|
-
public sealed class Request
|
|
12
|
-
{
|
|
13
|
-
public string Target { get; set; }
|
|
14
|
-
public string Name { get; set; }
|
|
15
|
-
public string Path { get; set; }
|
|
16
|
-
public string Id { get; set; }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public sealed class Result
|
|
20
|
-
{
|
|
21
|
-
public GameObjectDetail GameObject { get; set; }
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public ToolDescriptor Describe() => new()
|
|
25
|
-
{
|
|
26
|
-
Name = "go.inspect",
|
|
27
|
-
Summary = "Inspect one GameObject summary by name/path/id; use component.get for deep component fields.",
|
|
28
|
-
Description = "Inspect one GameObject by name, hierarchy path, or instance id. Returns transform, components and direct children; use object.get-data or component.get for deeper serialized data and keep go.find/scene.hierarchy for discovery.",
|
|
29
|
-
Group = "go",
|
|
30
|
-
DestructiveHint = false,
|
|
31
|
-
Target = "editor",
|
|
32
|
-
PlayModeSupport = "supported",
|
|
33
|
-
DefaultTimeoutMs = 30000,
|
|
34
|
-
MaxTimeoutMs = 600000,
|
|
35
|
-
Examples = new[]
|
|
36
|
-
{
|
|
37
|
-
new ToolExample { Description = "Inspect by hierarchy path", Input = new Request { Target = "Player/CameraRig" } }
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request request, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
42
|
-
{
|
|
43
|
-
var target = request.Target ?? request.Name ?? request.Path ?? request.Id;
|
|
44
|
-
var gameObject = GameObjectToolSupport.ResolveUniqueTarget(target, "GameObject inspect requires a target.");
|
|
45
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { GameObject = GameObjectToolSupport.BuildGameObjectDetail(gameObject) });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
#endif
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using UnityEditor;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
namespace UnityCli
|
|
6
|
-
{
|
|
7
|
-
public class GraphicsPipelineQualityTool : IUnityCliTool<GraphicsPipelineQualityTool.Request, GraphicsPipelineQualityTool.Result>
|
|
8
|
-
{
|
|
9
|
-
public sealed class Request { public string QualityLevel { get; set; } }
|
|
10
|
-
public sealed class Result { public QualitySettingsInfo QualitySettings { get; set; } public List<GraphicsPlannedEffect> PlannedEffects { get; set; } }
|
|
11
|
-
public ToolDescriptor Describe() => new() { Name = "graphics.pipeline-quality", Summary = "Set the active quality level by name or index.", Description = "Set QualitySettings quality level.", Group = "graphics",DestructiveHint = true, SideEffects = new[] { "settings-write" }, Target = "editor", PlayModeSupport = "editor-only", DefaultTimeoutMs = 30000, MaxTimeoutMs = 600000, Examples = new[] { new ToolExample { Description = "Select a quality level by name", Input = new Request { QualityLevel = "Medium" } } } };
|
|
12
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request r, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
13
|
-
{
|
|
14
|
-
if (string.IsNullOrEmpty(r.QualityLevel)) return new System.Threading.Tasks.ValueTask<Result>(new Result { QualitySettings = GraphicsToolSupport.BuildQualitySettings(), PlannedEffects = new List<GraphicsPlannedEffect>() });
|
|
15
|
-
var level = GraphicsToolSupport.ResolveQualityLevel(r.QualityLevel); // immutable validated plan
|
|
16
|
-
ctx.CommitEffect();
|
|
17
|
-
QualitySettings.SetQualityLevel(level, true);
|
|
18
|
-
AssetDatabase.SaveAssets();
|
|
19
|
-
if (QualitySettings.GetQualityLevel() != level) throw new UnityCliBridge.BridgeCommandException("E_PIPELINE_QUALITY_STATE_MISMATCH", "Quality level readback did not match the request.", "Retry after the editor is idle.");
|
|
20
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { QualitySettings = GraphicsToolSupport.BuildQualitySettings(), PlannedEffects = new List<GraphicsPlannedEffect> { new GraphicsPlannedEffect { Type = "graphics.pipeline-quality", Property = "qualityLevel", Value = level.ToString() } } });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
#endif
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using System.Globalization;
|
|
4
|
-
using UnityEditor;
|
|
5
|
-
using UnityEngine;
|
|
6
|
-
using UnityEngine.Rendering;
|
|
7
|
-
|
|
8
|
-
namespace UnityCli
|
|
9
|
-
{
|
|
10
|
-
/// <summary>graphics.probe-positions — 读取/写入探针位置(ReflectionProbe 或 LightProbeGroup)。</summary>
|
|
11
|
-
public class GraphicsProbePositionsTool : IUnityCliTool<GraphicsProbePositionsTool.Request, GraphicsProbePositionsTool.Result>
|
|
12
|
-
{
|
|
13
|
-
public sealed class Request { public string Target { get; set; } public string Type { get; set; } public string Positions { get; set; } }
|
|
14
|
-
public sealed class Result { public string ProbeType { get; set; } public List<GraphicsPlannedEffect> PlannedEffects { get; set; } }
|
|
15
|
-
public ToolDescriptor Describe() => new() { Name = "graphics.probe-positions", Summary = "Read or update probe positions for a ReflectionProbe or LightProbeGroup.", Description = "Resolve a probe component by type (reflection or light), then optionally set positions.", Group = "graphics",DestructiveHint = false, SideEffects = new[] { "scene-modify" }, Target = "editor", PlayModeSupport = "supported", DefaultTimeoutMs = 30000, MaxTimeoutMs = 600000, Examples = new[] { new ToolExample { Description = "Read probe positions", Input = new Request { Target = "Probes" } } } };
|
|
16
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request r, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
17
|
-
{
|
|
18
|
-
var probeType = r.Type ?? "reflection";
|
|
19
|
-
var reflection = string.Equals(probeType, "reflection", System.StringComparison.OrdinalIgnoreCase);
|
|
20
|
-
var light = string.Equals(probeType, "light", System.StringComparison.OrdinalIgnoreCase);
|
|
21
|
-
if (!reflection && !light) throw new UnityCliBridge.BridgeCommandException("E_PROBE_TYPE_INVALID", "Unsupported probe type: " + probeType, "Pass reflection or light.");
|
|
22
|
-
Component component = reflection ? (Component)PhysicsToolSupport.ResolveReflectionProbe(r.Target) : ResolveLightProbeGroup(r.Target);
|
|
23
|
-
if (component == null) throw new UnityCliBridge.BridgeCommandException("E_PROBE_NOT_FOUND", "Probe component not found: " + r.Target + " (type=" + probeType + ")", "Pass a GameObject name / hierarchy path with a ReflectionProbe or LightProbeGroup component.");
|
|
24
|
-
var effects = new List<GraphicsPlannedEffect>();
|
|
25
|
-
if (!string.IsNullOrEmpty(r.Positions))
|
|
26
|
-
{
|
|
27
|
-
var positions = GraphicsToolSupport.ParseVector3Array(r.Positions);
|
|
28
|
-
if (reflection && positions.Length != 1) throw new UnityCliBridge.BridgeCommandException("E_PROBE_POSITIONS_INVALID", "ReflectionProbe requires exactly one position.", "Pass one x,y,z position.");
|
|
29
|
-
ctx.CommitEffect();
|
|
30
|
-
UnityCliSceneMutation.RecordObject(component, "Set probe positions");
|
|
31
|
-
if (component is ReflectionProbe rp) { rp.center = positions.Length > 0 ? positions[0] : rp.center; effects.Add(new GraphicsPlannedEffect { Type = "graphics.probe-positions", Property = "reflectionCenter", Value = positions.Length.ToString() }); }
|
|
32
|
-
else if (component is LightProbeGroup lpg) { lpg.probePositions = positions; effects.Add(new GraphicsPlannedEffect { Type = "graphics.probe-positions", Property = "lightProbePositions", Value = positions.Length.ToString() }); }
|
|
33
|
-
UnityCliSceneMutation.MarkSceneObjectDirty(component);
|
|
34
|
-
UnityCliSceneMutation.MarkSceneDirty(component.gameObject.scene);
|
|
35
|
-
var observedObject = GameObjectToolSupport.ResolveUniqueTarget(component.gameObject.GetInstanceID().ToString(CultureInfo.InvariantCulture), "Probe target could not be re-resolved after mutation.");
|
|
36
|
-
var observedComponent = string.Equals(probeType, "reflection", System.StringComparison.OrdinalIgnoreCase) ? (Component)observedObject.GetComponent<ReflectionProbe>() : observedObject.GetComponent<LightProbeGroup>();
|
|
37
|
-
if (observedComponent == null || (observedComponent is ReflectionProbe observedReflection && (positions.Length == 0 || observedReflection.center != positions[0])) || (observedComponent is LightProbeGroup observedLight && !SamePositions(observedLight.probePositions, positions))) throw new UnityCliBridge.BridgeCommandException("E_PROBE_STATE_MISMATCH", "Probe positions did not retain the request.", "Retry after the editor is idle.");
|
|
38
|
-
component = observedComponent;
|
|
39
|
-
}
|
|
40
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { ProbeType = probeType, PlannedEffects = effects });
|
|
41
|
-
}
|
|
42
|
-
private static bool SamePositions(Vector3[] actual, Vector3[] expected)
|
|
43
|
-
{
|
|
44
|
-
if (actual == null || actual.Length != expected.Length) return false;
|
|
45
|
-
for (var index = 0; index < expected.Length; index++) if (actual[index] != expected[index]) return false;
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private static LightProbeGroup ResolveLightProbeGroup(string target)
|
|
50
|
-
{
|
|
51
|
-
var groups = UnityEngine.Object.FindObjectsOfType<LightProbeGroup>();
|
|
52
|
-
if (string.IsNullOrEmpty(target)) return groups.Length > 0 ? groups[0] : null;
|
|
53
|
-
foreach (var g in groups) if (GameObjectToolSupport.HierarchyPath(g.gameObject) == target || g.gameObject.name == target || g.GetInstanceID().ToString() == target) return g;
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
#endif
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using UnityEditor;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
using UnityEngine.Rendering;
|
|
6
|
-
|
|
7
|
-
namespace UnityCli
|
|
8
|
-
{
|
|
9
|
-
/// <summary>
|
|
10
|
-
/// graphics.settings — 读取/写入 QualitySettings + GraphicsSettings.defaultRenderPipeline。
|
|
11
|
-
/// </summary>
|
|
12
|
-
public class GraphicsSettingsTool : IUnityCliTool<GraphicsSettingsTool.Request, GraphicsSettingsTool.Result>
|
|
13
|
-
{
|
|
14
|
-
public sealed class Request
|
|
15
|
-
{
|
|
16
|
-
public int? AntiAliasing { get; set; }
|
|
17
|
-
public float? ShadowDistance { get; set; }
|
|
18
|
-
public int? VSyncCount { get; set; }
|
|
19
|
-
public int? MasterTextureLimit { get; set; }
|
|
20
|
-
public float? LodBias { get; set; }
|
|
21
|
-
public int? MaximumLODLevel { get; set; }
|
|
22
|
-
public string RenderPipeline { get; set; }
|
|
23
|
-
public string Property { get; set; }
|
|
24
|
-
public string Value { get; set; }
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public sealed class Result
|
|
28
|
-
{
|
|
29
|
-
public GraphicsSummary Graphics { get; set; }
|
|
30
|
-
public QualitySettingsInfo QualitySettings { get; set; }
|
|
31
|
-
public List<GraphicsPlannedEffect> PlannedEffects { get; set; }
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public ToolDescriptor Describe() => new()
|
|
35
|
-
{
|
|
36
|
-
Name = "graphics.settings", Summary = "Read and update graphics settings including render pipeline asset and quality fields.",
|
|
37
|
-
Description = "Read or update QualitySettings fields and GraphicsSettings.defaultRenderPipeline. renderPipeline='built-in' or 'null' resets to built-in.",
|
|
38
|
-
Group = "graphics", DestructiveHint = true, SideEffects = new[] { "settings-write" },
|
|
39
|
-
Target = "editor", PlayModeSupport = "editor-only",
|
|
40
|
-
DefaultTimeoutMs = 30000, MaxTimeoutMs = 600000,
|
|
41
|
-
Examples = new[] { new ToolExample { Description = "Read graphics settings", Input = new Request { } } }
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request request, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
45
|
-
{
|
|
46
|
-
var effects = new List<GraphicsPlannedEffect>();
|
|
47
|
-
var hasWrite = request.AntiAliasing.HasValue || request.ShadowDistance.HasValue || request.VSyncCount.HasValue || request.MasterTextureLimit.HasValue || request.LodBias.HasValue || request.MaximumLODLevel.HasValue || !string.IsNullOrEmpty(request.RenderPipeline) || (!string.IsNullOrEmpty(request.Property) && !string.IsNullOrEmpty(request.Value));
|
|
48
|
-
if (request.ShadowDistance.HasValue) GraphicsToolSupport.ParseFinite(request.ShadowDistance.Value.ToString(System.Globalization.CultureInfo.InvariantCulture), "shadowDistance", 0f, float.MaxValue);
|
|
49
|
-
if (request.LodBias.HasValue) GraphicsToolSupport.ParseFinite(request.LodBias.Value.ToString(System.Globalization.CultureInfo.InvariantCulture), "lodBias", 0.01f, 100f);
|
|
50
|
-
if (request.VSyncCount.HasValue && (request.VSyncCount.Value < 0 || request.VSyncCount.Value > 4)) throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTING_INPUT_INVALID", "vSyncCount must be from 0 to 4.", "Pass a vSyncCount from 0 to 4.");
|
|
51
|
-
if (request.AntiAliasing.HasValue && request.AntiAliasing.Value != 0 && request.AntiAliasing.Value != 2 && request.AntiAliasing.Value != 4 && request.AntiAliasing.Value != 8) throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTING_INPUT_INVALID", "antiAliasing must be 0, 2, 4, or 8.", "Pass a supported antiAliasing value.");
|
|
52
|
-
if (request.MasterTextureLimit.HasValue && !GraphicsToolSupport.IsValidTextureLod(request.MasterTextureLimit.Value)) throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTING_INPUT_INVALID", "masterTextureLimit must be from 0 to 8.", "Pass a masterTextureLimit from 0 to 8.");
|
|
53
|
-
if (request.MaximumLODLevel.HasValue && !GraphicsToolSupport.IsValidMaximumLod(request.MaximumLODLevel.Value)) throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTING_INPUT_INVALID", "maximumLODLevel must be from 0 to 100000.", "Pass a non-negative maximumLODLevel.");
|
|
54
|
-
RenderPipelineAsset requestedPipeline = null; var resetPipeline = false; string requestedPipelinePath = null; string requestedPipelineGuid = null;
|
|
55
|
-
if (!string.IsNullOrEmpty(request.RenderPipeline)) { resetPipeline = string.Equals(request.RenderPipeline, "null", System.StringComparison.OrdinalIgnoreCase) || string.Equals(request.RenderPipeline, "built-in", System.StringComparison.OrdinalIgnoreCase); if (!resetPipeline) { requestedPipelinePath = GraphicsToolSupport.NormalizeAssetPathRequired(request.RenderPipeline, ".asset"); requestedPipeline = AssetDatabase.LoadAssetAtPath<RenderPipelineAsset>(requestedPipelinePath); if (requestedPipeline == null) throw new UnityCliBridge.BridgeCommandException("E_RENDER_PIPELINE_NOT_FOUND", "RenderPipelineAsset not found: " + request.RenderPipeline, "Pass an existing Assets/*.asset RenderPipelineAsset path."); requestedPipelineGuid = AssetDatabase.AssetPathToGUID(requestedPipelinePath); if (string.IsNullOrEmpty(requestedPipelineGuid)) throw new UnityCliBridge.BridgeCommandException("E_RENDER_PIPELINE_NOT_FOUND", "RenderPipelineAsset has no stable GUID: " + request.RenderPipeline, "Pass an imported Assets/*.asset RenderPipelineAsset path."); } }
|
|
56
|
-
if (!string.IsNullOrEmpty(request.Property) || !string.IsNullOrEmpty(request.Value)) { if (string.IsNullOrEmpty(request.Property) || string.IsNullOrEmpty(request.Value)) throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTING_INPUT_INVALID", "property and value must be provided together.", "Use a supported setting member and value."); if (request.Property != "vSyncCount" && request.Property != "antiAliasing" && request.Property != "shadowDistance" && request.Property != "masterTextureLimit" && request.Property != "lodBias" && request.Property != "maximumLODLevel") throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTING_UNSUPPORTED", "Unsupported graphics setting: " + request.Property, "Use named graphics setting flags."); if (request.Property == "shadowDistance") GraphicsToolSupport.ParseFinite(request.Value, request.Property, 0f, float.MaxValue); else if (request.Property == "lodBias") GraphicsToolSupport.ParseFinite(request.Value, request.Property, 0.01f, 100f); else { int parsed; if (!int.TryParse(request.Value, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out parsed) || (request.Property == "vSyncCount" && (parsed < 0 || parsed > 4)) || (request.Property == "antiAliasing" && parsed != 0 && parsed != 2 && parsed != 4 && parsed != 8) || (request.Property == "masterTextureLimit" && !GraphicsToolSupport.IsValidTextureLod(parsed)) || (request.Property == "maximumLODLevel" && !GraphicsToolSupport.IsValidMaximumLod(parsed))) throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTING_INPUT_INVALID", "Invalid value: " + request.Value, "Pass a value within the supported range."); } }
|
|
57
|
-
if (hasWrite) ctx.CommitEffect();
|
|
58
|
-
if (request.AntiAliasing.HasValue) { QualitySettings.antiAliasing = request.AntiAliasing.Value; effects.Add(new GraphicsPlannedEffect { Type = "graphics.settings", Property = "antiAliasing", Value = request.AntiAliasing.Value.ToString() }); }
|
|
59
|
-
if (request.ShadowDistance.HasValue) { QualitySettings.shadowDistance = request.ShadowDistance.Value; effects.Add(new GraphicsPlannedEffect { Type = "graphics.settings", Property = "shadowDistance", Value = request.ShadowDistance.Value.ToString(System.Globalization.CultureInfo.InvariantCulture) }); }
|
|
60
|
-
if (request.VSyncCount.HasValue) { QualitySettings.vSyncCount = request.VSyncCount.Value; effects.Add(new GraphicsPlannedEffect { Type = "graphics.settings", Property = "vSyncCount", Value = request.VSyncCount.Value.ToString() }); }
|
|
61
|
-
if (request.MasterTextureLimit.HasValue) { QualitySettings.globalTextureMipmapLimit = request.MasterTextureLimit.Value; effects.Add(new GraphicsPlannedEffect { Type = "graphics.settings", Property = "masterTextureLimit", Value = request.MasterTextureLimit.Value.ToString() }); }
|
|
62
|
-
if (request.LodBias.HasValue) { QualitySettings.lodBias = request.LodBias.Value; effects.Add(new GraphicsPlannedEffect { Type = "graphics.settings", Property = "lodBias", Value = request.LodBias.Value.ToString(System.Globalization.CultureInfo.InvariantCulture) }); }
|
|
63
|
-
if (request.MaximumLODLevel.HasValue) { QualitySettings.maximumLODLevel = request.MaximumLODLevel.Value; effects.Add(new GraphicsPlannedEffect { Type = "graphics.settings", Property = "maximumLODLevel", Value = request.MaximumLODLevel.Value.ToString() }); }
|
|
64
|
-
if (!string.IsNullOrEmpty(request.RenderPipeline))
|
|
65
|
-
{
|
|
66
|
-
GraphicsSettings.defaultRenderPipeline = resetPipeline ? null : requestedPipeline;
|
|
67
|
-
effects.Add(new GraphicsPlannedEffect { Type = "graphics.settings", Property = "renderPipeline", Value = request.RenderPipeline });
|
|
68
|
-
}
|
|
69
|
-
if (!string.IsNullOrEmpty(request.Property) && !string.IsNullOrEmpty(request.Value))
|
|
70
|
-
{
|
|
71
|
-
ApplyGenericGraphicsSetting(request.Property, request.Value, effects);
|
|
72
|
-
}
|
|
73
|
-
if (effects.Count > 0) AssetDatabase.SaveAssets();
|
|
74
|
-
RenderPipelineAsset observedPipeline = null;
|
|
75
|
-
if (!string.IsNullOrEmpty(request.RenderPipeline) && !resetPipeline) observedPipeline = GraphicsToolSupport.ReloadAsset<RenderPipelineAsset>(requestedPipelinePath, requestedPipelineGuid);
|
|
76
|
-
var observed = GraphicsToolSupport.BuildQualitySettings();
|
|
77
|
-
if ((request.AntiAliasing.HasValue && observed.AntiAliasing != request.AntiAliasing.Value) || (request.VSyncCount.HasValue && observed.VSyncCount != request.VSyncCount.Value) || (request.ShadowDistance.HasValue && !Mathf.Approximately((float)observed.ShadowDistance, request.ShadowDistance.Value)) || (request.MasterTextureLimit.HasValue && observed.MasterTextureLimit != request.MasterTextureLimit.Value) || (request.LodBias.HasValue && !Mathf.Approximately((float)observed.LodBias, request.LodBias.Value)) || (request.MaximumLODLevel.HasValue && observed.MaximumLODLevel != request.MaximumLODLevel.Value) || (!string.IsNullOrEmpty(request.Property) && !GenericSettingMatches(observed, request.Property, request.Value)) || (!string.IsNullOrEmpty(request.RenderPipeline) && GraphicsSettings.defaultRenderPipeline != observedPipeline)) throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTINGS_STATE_MISMATCH", "Graphics settings readback did not match the request.", "Retry after the editor is idle.");
|
|
78
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { Graphics = GraphicsToolSupport.BuildGraphicsSummary(), QualitySettings = observed, PlannedEffects = effects });
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
private static bool GenericSettingMatches(QualitySettingsInfo observed, string property, string value)
|
|
82
|
-
{
|
|
83
|
-
if (property == "vSyncCount") return observed.VSyncCount == int.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
|
|
84
|
-
if (property == "antiAliasing") return observed.AntiAliasing == int.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
|
|
85
|
-
if (property == "shadowDistance") return Mathf.Approximately((float)observed.ShadowDistance, GameObjectToolSupport.ParseFloat(value, property));
|
|
86
|
-
if (property == "masterTextureLimit") return observed.MasterTextureLimit == int.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
|
|
87
|
-
if (property == "lodBias") return Mathf.Approximately((float)observed.LodBias, GameObjectToolSupport.ParseFloat(value, property));
|
|
88
|
-
return property == "maximumLODLevel" && observed.MaximumLODLevel == int.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private static void ApplyGenericGraphicsSetting(string property, string value, List<GraphicsPlannedEffect> effects)
|
|
92
|
-
{
|
|
93
|
-
if (property == "vSyncCount") QualitySettings.vSyncCount = int.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
|
|
94
|
-
else if (property == "antiAliasing") QualitySettings.antiAliasing = int.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
|
|
95
|
-
else if (property == "shadowDistance") QualitySettings.shadowDistance = GameObjectToolSupport.ParseFloat(value, property);
|
|
96
|
-
else if (property == "masterTextureLimit") QualitySettings.globalTextureMipmapLimit = int.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
|
|
97
|
-
else if (property == "lodBias") QualitySettings.lodBias = GameObjectToolSupport.ParseFloat(value, property);
|
|
98
|
-
else if (property == "maximumLODLevel") QualitySettings.maximumLODLevel = int.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
|
|
99
|
-
else throw new UnityCliBridge.BridgeCommandException("E_GRAPHICS_SETTING_UNSUPPORTED", "Unsupported graphics setting: " + property, "Use named flags such as --anti-aliasing, --shadow-distance or --render-pipeline.");
|
|
100
|
-
effects.Add(new GraphicsPlannedEffect { Type = "graphics.settings", Property = property, Value = value });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
#endif
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using UnityEditor;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace UnityCli
|
|
7
|
-
{
|
|
8
|
-
/// <summary>graphics.stats-counters — 读取渲染统计计数器列表。</summary>
|
|
9
|
-
public class GraphicsStatsCountersTool : IUnityCliTool<GraphicsStatsCountersTool.Request, GraphicsStatsCountersTool.Result>
|
|
10
|
-
{
|
|
11
|
-
public sealed class Request { }
|
|
12
|
-
public sealed class Result { public List<GraphicsPlannedEffect> Counters { get; set; } }
|
|
13
|
-
public ToolDescriptor Describe() => new() { Name = "graphics.stats-counters", Summary = "Read render stats as a flat counter list (drawCalls, batches, triangles, vertices, setPass, renderTextures).", Description = "Read-only: returns render stats as key-value counter entries.", Group = "graphics",DestructiveHint = false, Target = "editor", PlayModeSupport = "supported", DefaultTimeoutMs = 30000, MaxTimeoutMs = 600000, Examples = new[] { new ToolExample { Description = "Read counters", Input = new Request { } } } };
|
|
14
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request r, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
15
|
-
{
|
|
16
|
-
var s = GraphicsToolSupport.BuildRenderStats();
|
|
17
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { Counters = new List<GraphicsPlannedEffect> {
|
|
18
|
-
new GraphicsPlannedEffect { Property = "drawCalls", Value = s.DrawCalls.ToString() },
|
|
19
|
-
new GraphicsPlannedEffect { Property = "batches", Value = s.Batches.ToString() },
|
|
20
|
-
new GraphicsPlannedEffect { Property = "triangles", Value = s.Triangles.ToString() },
|
|
21
|
-
new GraphicsPlannedEffect { Property = "vertices", Value = s.Vertices.ToString() },
|
|
22
|
-
new GraphicsPlannedEffect { Property = "setPassCalls", Value = s.SetPassCalls.ToString() },
|
|
23
|
-
new GraphicsPlannedEffect { Property = "renderTextureCount", Value = s.RenderTextureCount.ToString() },
|
|
24
|
-
} });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
#endif
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using UnityEditor;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace UnityCli
|
|
7
|
-
{
|
|
8
|
-
/// <summary>graphics.stats-memory — 读取渲染内存统计。</summary>
|
|
9
|
-
public class GraphicsStatsMemoryTool : IUnityCliTool<GraphicsStatsMemoryTool.Request, GraphicsStatsMemoryTool.Result>
|
|
10
|
-
{
|
|
11
|
-
public sealed class Request { }
|
|
12
|
-
public sealed class Result { public long UsedTextureMemory { get; set; } public long RenderTextureBytes { get; set; } public long UsedVertexBuffer { get; set; } public long UsedVertexBufferVRAM { get; set; } public long RenderTextureCount { get; set; } }
|
|
13
|
-
public ToolDescriptor Describe() => new() { Name = "graphics.stats-memory", Summary = "Read render memory statistics (texture memory, render texture bytes, vertex buffer).", Description = "Read-only: returns GPU memory usage from render stats.", Group = "graphics",DestructiveHint = false, Target = "editor", PlayModeSupport = "supported", DefaultTimeoutMs = 30000, MaxTimeoutMs = 600000, Examples = new[] { new ToolExample { Description = "Read memory stats", Input = new Request { } } } };
|
|
14
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request r, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
15
|
-
{
|
|
16
|
-
var s = GraphicsToolSupport.BuildRenderStats();
|
|
17
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { UsedTextureMemory = s.UsedTextureMemory, RenderTextureBytes = s.RenderTextureBytes, UsedVertexBuffer = s.UsedVertexBuffer, UsedVertexBufferVRAM = s.UsedVertexBufferVRAM, RenderTextureCount = s.RenderTextureCount });
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
#endif
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using System.IO;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace UnityCli.Tools.Instances
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
/// instances.list 只读 Tool:读取当前 Unity Bridge 进程自身实例摘要。
|
|
10
|
-
/// </summary>
|
|
11
|
-
public class InstancesListTool : IUnityCliTool<InstancesListTool.Request, InstancesListTool.Result>
|
|
12
|
-
{
|
|
13
|
-
public sealed class Request { }
|
|
14
|
-
|
|
15
|
-
public sealed class InstanceInfo
|
|
16
|
-
{
|
|
17
|
-
public string InstanceId { get; set; }
|
|
18
|
-
public string ProjectPath { get; set; }
|
|
19
|
-
public string UnityVersion { get; set; }
|
|
20
|
-
public string Status { get; set; }
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public sealed class Result
|
|
24
|
-
{
|
|
25
|
-
public List<InstanceInfo> Instances { get; set; }
|
|
26
|
-
public long Count { get; set; }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public ToolDescriptor Describe() => new()
|
|
30
|
-
{
|
|
31
|
-
Name = "instances.list",
|
|
32
|
-
Summary = "Read the current logical Unity project instance summary from the live Editor process.",
|
|
33
|
-
Description = "Read the CanonicalPath v1 project identity, canonical project path, Unity version, and ready status visible to the current Editor process.",
|
|
34
|
-
DestructiveHint = false,
|
|
35
|
-
Group = "instances",
|
|
36
|
-
Target = "editor",
|
|
37
|
-
PlayModeSupport = "supported",
|
|
38
|
-
Examples = new[] { new ToolExample { Description = "Read the current Bridge instance", Input = new Request { } } }
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/// <summary>读取当前 Editor 的逻辑项目 identity 和业务 readiness 摘要。</summary>
|
|
42
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request request, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
43
|
-
{
|
|
44
|
-
var identity = UnityCliCanonicalProjectPath.Resolve(ProjectRoot(ctx));
|
|
45
|
-
var instances = new List<InstanceInfo>
|
|
46
|
-
{
|
|
47
|
-
new InstanceInfo
|
|
48
|
-
{
|
|
49
|
-
InstanceId = identity.InstanceId,
|
|
50
|
-
ProjectPath = identity.CanonicalProjectPath,
|
|
51
|
-
UnityVersion = Application.unityVersion,
|
|
52
|
-
Status = "ready"
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result
|
|
57
|
-
{
|
|
58
|
-
Instances = instances,
|
|
59
|
-
Count = instances.Count
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// 优先使用 registry 注入的项目路径;缺失时回退到当前 Unity project root。
|
|
64
|
-
private static string ProjectRoot(UnityCliProjectToolContext ctx)
|
|
65
|
-
{
|
|
66
|
-
if (ctx != null && !string.IsNullOrEmpty(ctx.ProjectPath)) return ctx.ProjectPath;
|
|
67
|
-
return Path.GetDirectoryName(Application.dataPath);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
#endif
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System;
|
|
3
|
-
using System.Collections.Generic;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace UnityCli
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
/// physics.raycast-all — 3D/2D 射线查询,返回所有命中。
|
|
10
|
-
/// </summary>
|
|
11
|
-
public class PhysicsRaycastAllTool : IUnityCliTool<PhysicsRaycastAllTool.Request, PhysicsRaycastAllTool.Result>
|
|
12
|
-
{
|
|
13
|
-
public sealed class Request
|
|
14
|
-
{
|
|
15
|
-
public string Mode { get; set; }
|
|
16
|
-
public float OriginX { get; set; }
|
|
17
|
-
public float OriginY { get; set; }
|
|
18
|
-
public float OriginZ { get; set; }
|
|
19
|
-
public float DirectionX { get; set; }
|
|
20
|
-
public float DirectionY { get; set; }
|
|
21
|
-
public float DirectionZ { get; set; } = 1f;
|
|
22
|
-
public float Distance { get; set; } = 100f;
|
|
23
|
-
public int? LayerMask { get; set; }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public sealed class Result
|
|
27
|
-
{
|
|
28
|
-
public long HitCount { get; set; }
|
|
29
|
-
public List<RaycastHitInfo> Hits { get; set; }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public ToolDescriptor Describe() => new()
|
|
33
|
-
{
|
|
34
|
-
Name = "physics.raycast-all",
|
|
35
|
-
Summary = "Cast a 3D or 2D ray and return all hits along the path.",
|
|
36
|
-
Description = "Cast a ray and return all collider hits, sorted by distance (3D). mode=3d (default) or 2d.",
|
|
37
|
-
Group = "physics",DestructiveHint = false,
|
|
38
|
-
Target = "editor", PlayModeSupport = "supported",
|
|
39
|
-
DefaultTimeoutMs = 30000, MaxTimeoutMs = 600000,
|
|
40
|
-
Examples = new[] { new ToolExample { Description = "All hits forward", Input = new Request { OriginY = 1f, DirectionZ = 1f } } }
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request request, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
44
|
-
{
|
|
45
|
-
var mode = PhysicsToolSupport.NormalizeMode(request.Mode);
|
|
46
|
-
var distance = Math.Max(0f, request.Distance);
|
|
47
|
-
var layerMask = request.LayerMask ?? Physics.DefaultRaycastLayers;
|
|
48
|
-
if (mode == "2d")
|
|
49
|
-
{
|
|
50
|
-
var origin = new Vector2(request.OriginX, request.OriginY);
|
|
51
|
-
var direction = PhysicsToolSupport.NormalizeVector2(new Vector2(request.DirectionX, request.DirectionY));
|
|
52
|
-
var hits = Physics2D.RaycastAll(origin, direction, distance, layerMask);
|
|
53
|
-
var hitList = new List<RaycastHitInfo>();
|
|
54
|
-
foreach (var h in hits) hitList.Add(PhysicsToolSupport.BuildRaycast2DHit(h));
|
|
55
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { HitCount = hits.Length, Hits = hitList });
|
|
56
|
-
}
|
|
57
|
-
var origin3d = new Vector3(request.OriginX, request.OriginY, request.OriginZ);
|
|
58
|
-
var direction3d = PhysicsToolSupport.NormalizeVector3(new Vector3(request.DirectionX, request.DirectionY, request.DirectionZ));
|
|
59
|
-
var hits3d = Physics.RaycastAll(origin3d, direction3d, distance, layerMask);
|
|
60
|
-
Array.Sort(hits3d, (a, b) => a.distance.CompareTo(b.distance));
|
|
61
|
-
var list = new List<RaycastHitInfo>();
|
|
62
|
-
foreach (var h in hits3d) list.Add(PhysicsToolSupport.BuildRaycast3DHit(h));
|
|
63
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { HitCount = hits3d.Length, Hits = list });
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
#endif
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using UnityEditor;
|
|
3
|
-
using UnityEngine.SceneManagement;
|
|
4
|
-
|
|
5
|
-
namespace UnityCli
|
|
6
|
-
{
|
|
7
|
-
/// <summary>
|
|
8
|
-
/// scene.build-settings — 列出 Editor Build Settings 中注册的场景(enabled 与路径)。
|
|
9
|
-
/// </summary>
|
|
10
|
-
public class SceneBuildSettingsTool : IUnityCliTool<SceneBuildSettingsTool.Request, SceneBuildSettingsTool.Result>
|
|
11
|
-
{
|
|
12
|
-
public sealed class Request
|
|
13
|
-
{
|
|
14
|
-
// scene.build-settings 无入参
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public sealed class Result
|
|
18
|
-
{
|
|
19
|
-
public System.Collections.Generic.List<BuildSceneEntry> Scenes { get; set; }
|
|
20
|
-
public long Count { get; set; }
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public sealed class BuildSceneEntry
|
|
24
|
-
{
|
|
25
|
-
public string Path { get; set; }
|
|
26
|
-
public bool Enabled { get; set; }
|
|
27
|
-
public long BuildIndex { get; set; }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public ToolDescriptor Describe() => new()
|
|
31
|
-
{
|
|
32
|
-
Name = "scene.build-settings",
|
|
33
|
-
Summary = "List scenes registered in the Editor Build Settings (enabled scenes and their paths).",
|
|
34
|
-
Description = "List scenes registered in the Editor Build Settings (enabled scenes and their paths). Read-only; use build.scene.add or build.scene.remove to change the build list.",
|
|
35
|
-
Group = "scene",
|
|
36
|
-
DestructiveHint = false,
|
|
37
|
-
Target = "editor",
|
|
38
|
-
PlayModeSupport = "supported",
|
|
39
|
-
DefaultTimeoutMs = 30000,
|
|
40
|
-
MaxTimeoutMs = 600000,
|
|
41
|
-
Examples = new[]
|
|
42
|
-
{
|
|
43
|
-
new ToolExample { Description = "List build settings scenes", Input = new Request { } }
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request request, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
48
|
-
{
|
|
49
|
-
var scenes = EditorBuildSettings.scenes ?? new EditorBuildSettingsScene[0];
|
|
50
|
-
var entries = new System.Collections.Generic.List<BuildSceneEntry>();
|
|
51
|
-
for (var index = 0; index < scenes.Length; index++)
|
|
52
|
-
{
|
|
53
|
-
var scene = scenes[index];
|
|
54
|
-
entries.Add(new BuildSceneEntry
|
|
55
|
-
{
|
|
56
|
-
Path = SceneToolSupport.NormalizeAssetPath(scene.path),
|
|
57
|
-
Enabled = scene.enabled,
|
|
58
|
-
BuildIndex = (long)index
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result
|
|
62
|
-
{
|
|
63
|
-
Scenes = entries,
|
|
64
|
-
Count = (long)scenes.Length
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
#endif
|