slothsoft/unity
Composer 安装命令:
composer require slothsoft/unity
包简介
Slothsoft's Unity API
关键字:
README 文档
README
Unity automation helpers for slothsoft packages and CI jobs.
This package wraps Unity Hub, Unity Editor batchmode, Unity project/package metadata, Steam build file generation, DocFX setup, and Farah executable assets behind PHP classes and Composer binaries. It is primarily used for repeatable CI workflows around Unity projects: install the required editor, prepare licensing, install modules, run tests, build players, execute editor methods, inspect project settings, and create temporary projects for local packages.
This is an older slothsoft package with active Unity automation code and some historical compatibility code. Most classes in src/ are still live; the Slothsoft\Unity\MLAgents namespace is legacy and should not be used for new code.
Compatibility Policy
Semantic versioning is in effect. Public classes are public API, including public constructors, methods, constants, and properties. Public signatures must remain backward-compatible unless an API-breaking change is specifically requested for a major release.
All code in this package must remain syntactically valid on the PHP version declared by PHP_VERSION in .env and behaviorally compatible with every PHP version covered by CI.
Bug fixes are allowed in every area of the package, including legacy APIs. Legacy APIs should not be used for new code, but they are still expected to keep working for existing consumers when practical.
Adding dependencies is acceptable when the dependency is justified by the change and remains compatible with this package's supported PHP versions.
Current / Supported Areas
These parts are suitable for use in new or maintained Unity automation code:
Slothsoft\Unity\UnityHub- Process-wide Unity Hub facade for locating Unity Hub, listing installed editors, installing editors and modules, resolving Unity changesets, preparing license files, and finding Unity projects or packages.
- Uses
HubLocatorInterfaceimplementations for platform-specific Unity Hub command discovery.
Slothsoft\Unity\UnityEditor- Wrapper around one Unity Editor installation.
- Executes editor batchmode commands, installs editor modules, creates empty projects, and handles license activation retries.
Slothsoft\Unity\UnityProjectandUnityProjectInfo- Unity project model loaded from
ProjectSettings/ProjectVersion.txt,ProjectSettings/ProjectSettings.asset,Packages/manifest.json, andPackages/packages-lock.json. - Supports project version reads/writes, PlayerSettings lookup, asset iteration, editor-method execution, Unity Test Runner execution, player builds, editor/module installation, and licensing checks.
- Unity project model loaded from
Slothsoft\Unity\UnityPackageandUnityPackageInfo- Unity package model loaded from
package.json. - Creates temporary empty Unity projects with a local package installed under
Packages/.
- Unity package model loaded from
Slothsoft\Unity\UnityBuildTarget- Maps package build targets (
windows,linux,mac) and scripting backends to Unity module IDs, build output names, and batchmode build arguments.
- Maps package build targets (
Slothsoft\Unity\UnityEnvironment- Reads Unity-related environment variables for no-graphics mode, Accelerator configuration, and log routing.
- Provides colored formatting for command, stdout, stderr, license, and cache logs.
Slothsoft\Unity\UnityLicensor- Browser-style workflow for signing Unity manual activation files when Unity credentials are available in the environment.
Slothsoft\Unity\ExecutionError,JUnit,JsonUtils, andMailboxAccess- Shared support utilities for process failures, JUnit date formatting, JSON reads/writes, and mailbox lookup for external verification codes.
Slothsoft\Unity\LocateHubFromCommand,LocateHubFromWindowsRegistry, andLocateHubNull- Unity Hub locator strategies used by
UnityHub.
- Unity Hub locator strategies used by
Slothsoft\Unity\SteamAppBuildgenerates Steam VDF app build files.SteamCMDsigns in throughsteamcmd, optionally retrieving Steam Guard codes throughMailboxAccess.
Slothsoft\Unity\DocFXSettingscreates DocFX configuration and table-of-contents files for Unity projects and supported documentation templates.
Slothsoft\Unity\DotNetFormatLogconvertsdotnet formatJSON reports into DOM documents that can be transformed to JUnit XML.
Slothsoft\Unity\GitGitProjectis a small git process wrapper used by older automation flows. It is live code, but be careful when using its mutating operations.
Slothsoft\Unity\Assets- Farah executable builders and parameter filters that back the command-line tools and
farah://slothsoft@unity/...asset URLs. - Project assets cover method execution, builds, tests, module installation, project version reads/writes, and project setting lookup.
- Package assets cover temporary project creation with a local package installed.
- Hub assets expose Unity Hub help output.
- Farah executable builders and parameter filters that back the command-line tools and
assets/- Farah manifest, XSLT transformation assets, and DocFX templates used by the Composer binaries and Farah URLs.
scripts/- Composer binaries for Unity, Steam, DocFX, version, and report-conversion workflows.
Legacy Areas
These components are included for historical reasons. Do not use them for new code unless you are maintaining an existing workflow.
Slothsoft\Unity\MLAgents- Legacy helpers for Python virtualenv setup and Unity ML-Agents training runs.
- New ML-Agents workflows should use maintained Python and Unity tooling directly.
Farah Assets
The package registers a Farah module with executable assets for Unity automation. Those assets are the implementation layer behind most Composer binaries.
Example asset groups:
farah://slothsoft@unity/hub/help
farah://slothsoft@unity/project/method
farah://slothsoft@unity/project/method-junit
farah://slothsoft@unity/project/build
farah://slothsoft@unity/project/build-junit
farah://slothsoft@unity/project/tests
farah://slothsoft@unity/project/tests-junit
farah://slothsoft@unity/project/module
farah://slothsoft@unity/project/module-junit
farah://slothsoft@unity/project/version
farah://slothsoft@unity/project/setting
farah://slothsoft@unity/package/install
farah://slothsoft@unity/package/install-junit
See assets/manifest.xml for the canonical asset definitions and parameter filters.
Command-Line Usage
Install dependencies first:
composer install
All commands are executed through Composer:
composer exec <command> -- <arguments>
Composer also accepts the historical form without --; the examples below keep that shorter style because the bundled scripts document it.
autoversion
Determine the version of a repository based on its tags and commits.
composer exec autoversion plastic|git "path/to/repository"
steam-buildfile
Create a Steam app build VDF file.
composer exec steam-buildfile "path/to/root" "path/to/logs" AppID [DepotID=path/to/depot]+ [SetLive]
steam-login
Sign in to Steam through steamcmd.
Uses STEAM_CREDENTIALS_USR and STEAM_CREDENTIALS_PSW. If mailbox credentials are configured, EMAIL_CREDENTIALS_USR and EMAIL_CREDENTIALS_PSW may be used to retrieve a Steam Guard code.
composer exec steam-login
transform-dotnet-format
Transform a dotnet format JSON report to JUnit XML and write the XML to stdout.
composer exec transform-dotnet-format "path/to/format-report.json"
unity-build
Build a Unity project.
composer exec unity-build "path/to/project" ["path/to/build"] [Platform]
unity-documentation
Create a DocFX documentation template in .Documentation below the project root. The generated template can be built from there with dotnet tool run docfx; generated HTML is written to .Documentation/html.
composer exec unity-documentation "path/to/project" [template=default+mermaid]
Supported templates:
defaultdefault+mermaidunitysingulinkfx+mermaid
unity-help
Call unityhub help. This is a quick way to verify that Unity Hub can be located.
composer exec unity-help
unity-method
Run a specific editor method inside a Unity project and quit Unity afterward.
composer exec unity-method "path/to/project" "Method.To.Execute" ["additional params", ...]
unity-start
Start a specific editor method inside a Unity project without forcing -quit.
The method must call EditorApplication.Quit() or otherwise arrange for Unity to exit.
composer exec unity-start "path/to/project" "Method.To.Execute" ["additional params", ...]
unity-module-install
Install Unity modules for the editor used by a Unity project. Use unity-help to inspect available module IDs for the installed Unity Hub version.
composer exec unity-module-install "path/to/project" [module-id]+
unity-package-install
Create a new Unity project and install a local package into it.
composer exec unity-package-install "path/to/project/Packages/path-to-package" "path/to/new-project"
unity-project-setting
Read one PlayerSettings value from a Unity project.
composer exec unity-project-setting "path/to/project" "setting-name"
unity-project-version
Read or write the bundleVersion of a Unity project.
composer exec unity-project-version "path/to/project" get|set ["new-version"]
unity-tests
Run Unity Test Runner tests inside a Unity project.
composer exec unity-tests "path/to/project" [EditMode|PlayMode|Platform]+
Environment
Useful environment variables:
UNITY_NO_GRAPHICS- Set to
1to pass-nographicsto Unity Editor commands.
- Set to
UNITY_ACCELERATOR_ENDPOINT- Unity Accelerator endpoint in
ip:portform.
- Unity Accelerator endpoint in
UNITY_ACCELERATOR_PARAMS- Additional Unity Accelerator command-line parameters.
UNITY_LOGGING- Whitespace-separated log channels. Supported values are
all,none,stdin,stdout,stderr,licensor, andcache.
- Whitespace-separated log channels. Supported values are
UNITY_EMPTY_MANIFEST- Path to the empty package manifest copied into temporary package-install projects.
UNITY_CREDENTIALS_USRandUNITY_CREDENTIALS_PSW- Unity account credentials for manual activation signing.
STEAM_CREDENTIALS_USRandSTEAM_CREDENTIALS_PSW- Steam credentials for
steam-login.
- Steam credentials for
EMAIL_CREDENTIALS_USRandEMAIL_CREDENTIALS_PSW- Mailbox credentials used to retrieve Steam Guard codes.
Development Notes
Some APIs use global or static process state, especially UnityHub, UnityEnvironment, UnityPackage, the Hub locator configuration, and license/cache folders. Tests that exercise stateful behavior should isolate side effects with @runInSeparateProcess.
Tests may create temporary files through temp_file, temp_dir, or Slothsoft\Core\IO\FileInfoFactory::createTempFile; those helpers do not require manual cleanup. Files in test-files/ are canonical fixtures.
The local development environment should provide the Composer development extensions. If an optional extension or platform feature is unavailable, affected tests may be skipped or impossible to run locally. Skipped tests should be treated as intentionally skipped unless the task is specifically about test skipping.
Use .editorconfig for coding style. Additional formatter or static-analysis tooling may be added later, but none is required right now.
Run tests with:
vendor/bin/phpunit
Generate API documentation with:
vendor/bin/phpdoc
Installation
composer require slothsoft/unity
Requirements
See composer.json for required PHP extensions and optional development extensions.
slothsoft/unity 适用场景与选型建议
slothsoft/unity 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.16k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 12 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「docs」 「unity」 「slothsoft」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 slothsoft/unity 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 slothsoft/unity 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 slothsoft/unity 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
Files and Resources and Hypertext: A content management system.
A Farah module for editing arbitrary savegame files.
Api documentation generator for Laravel 5
Replacement for Swagger. It is built for Laravel
A Farah module for server-sent events.
统计信息
- 总下载量: 1.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-25