Compare commits

..

15 Commits
1.0.4 ... main

Author SHA1 Message Date
ld
a199fa95ae Update Unity framework to version 1.1.4 2025-12-16 16:39:31 +08:00
ld
61efc13d03 Update Unity framework to version 1.1.3 2025-12-16 15:48:47 +08:00
ld
a7957867f4 Update Unity framework to version 1.1.2 2025-12-16 15:19:23 +08:00
ezio
40a91c66f3 Update Unity framework to version 1.1.1 2025-12-15 17:02:33 +08:00
ezio
1cb2262a19 Update Unity framework to version 1.1.1 2025-12-15 16:51:56 +08:00
zj
d53ab475f9 更新1.1.0 2025-12-10 10:54:55 +08:00
zj
c284469c56 update. 1.0.9 2025-11-29 15:37:26 +08:00
zj
452cbcd1d1 update。 2025-11-28 18:02:46 +08:00
zj
37da4172fb Remove build directory from version control and add to .gitignore
The build directory contains temporary build artifacts that are
regenerated by build_xcframework.sh and upgrade_framework.sh scripts.
These files should not be tracked in version control.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 18:00:49 +08:00
zj
33f24003d9 update 1.0.8 2025-11-28 16:58:17 +08:00
zj
f312144cc4 update。 2025-11-25 15:07:37 +08:00
zj
d8ff714ad8 文档; 2025-11-25 14:14:57 +08:00
zj
1256b5db50 升级到 XCFramework,添加模拟器支持
- 创建支持真机和模拟器的 XCFramework
- 模拟器版本使用空壳实现,用于开发调试
- 真机版本包含完整 Unity 运行时
- 更新 podspec 版本到 1.0.7
- 移除所有架构排除配置,XCFramework 自动处理
2025-11-25 13:37:00 +08:00
zj
e6e3231876 调整; 2025-11-25 11:26:33 +08:00
zj
ea26cae08b unity库。 2025-11-25 10:15:55 +08:00
67 changed files with 1368 additions and 22 deletions

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Build output
build/
# macOS
.DS_Store
# Backup directories
backup_*/

149
README.md
View File

@ -1 +1,148 @@
"Unity 集成iOS工程"
# UnityFramework Pod
Unity iOS Framework 打包为 CocoaPods支持真机和模拟器。
## 特性
- ✅ 支持真机运行(完整 Unity 运行时)
- ✅ 支持模拟器运行(空壳实现,用于开发调试)
- ✅ XCFramework 格式,自动处理不同平台
- ✅ 简单的升级流程
## 架构支持
| 平台 | 架构 | 说明 |
|------|------|------|
| 真机 | arm64 | 完整的 Unity 运行时 |
| 模拟器 | arm64, x86_64 | 空壳实现,方便开发 |
## 使用方法
### 在 Podfile 中引入
#### 使用 Git 仓库(推荐)
```ruby
pod 'UnityFramework', :git => 'https://gitea.sdws.shop/xim/flutter_unity_pod.git', :tag => '1.0.7'
```
#### 使用本地路径(开发调试)
```ruby
pod 'UnityFramework', :path => '/path/to/flutter_unity_pod'
```
### 安装
```bash
cd ios
pod install
```
## 升级 Framework
当有新的 Unity Framework 导出时,使用自动化脚本升级:
```bash
./upgrade_framework.sh /path/to/new/UnityFramework.framework
```
详细步骤请参考 [UPGRADE_GUIDE.md](./UPGRADE_GUIDE.md)
## 项目结构
```
flutter_unity_pod/
├── UnityLibrary/
│ └── UnityFramework.xcframework/ # 主 XCFramework
│ ├── ios-arm64/ # 真机版本
│ │ └── UnityFramework.framework/
│ └── ios-arm64_x86_64-simulator/ # 模拟器版本
│ └── UnityFramework.framework/
├── simulator_stub/
│ └── UnityFrameworkStub.m # 模拟器空壳实现
├── build_xcframework.sh # 初始构建脚本
├── upgrade_framework.sh # 升级脚本
├── UPGRADE_GUIDE.md # 升级指南
└── UnityFramework.podspec # Pod 配置文件
```
## 开发说明
### 模拟器行为
模拟器版本是空壳实现,所有 Unity 相关方法都会返回空或不执行。当尝试在模拟器运行 Unity 时,会输出日志:
```
UnityFramework: Simulator stub - Unity not available
```
在 Flutter 代码中也有检测:
```dart
// lib/common/utils/unitygame/unity_game_manager.dart:997-1004
if (Platform.isIOS) {
final isSimulator =
Platform.environment.containsKey('SIMULATOR_DEVICE_NAME') ||
Platform.environment.containsKey('SIMULATOR_UDID');
if (isSimulator) {
showToast('Unity 游戏仅支持真机运行,请在真机上体验。');
return;
}
}
```
### 构建流程
1. 编译模拟器空壳arm64 + x86_64
2. 合并真机 framework
3. 创建 XCFramework
4. 打包为 CocoaPod
## 版本历史
### 1.0.7 (2024-11-25)
- 升级到 XCFramework
- 添加模拟器支持
- 简化配置,移除架构排除
### 1.0.6
- 初始版本
- 仅支持真机
## 故障排除
### 模拟器构建失败
确保 XCFramework 包含模拟器架构:
```bash
lipo -info UnityLibrary/UnityFramework.xcframework/ios-arm64_x86_64-simulator/UnityFramework.framework/UnityFramework
```
### 真机构建失败
检查真机 framework 是否完整:
```bash
ls UnityLibrary/UnityFramework.xcframework/ios-arm64/UnityFramework.framework/
```
### Pod install 失败
清理缓存重试:
```bash
pod cache clean UnityFramework --all
rm -rf Pods Podfile.lock
pod install
```
## License
MIT
## 联系方式
- 仓库https://gitea.sdws.shop/xim/flutter_unity_pod
- 问题反馈:请创建 Issue

255
UPGRADE_GUIDE.md Normal file
View File

@ -0,0 +1,255 @@
# Unity Framework 升级指南
本指南说明如何在导出新的真机 UnityFramework 后,将其升级到 Pod 库中。
## 前置条件
- 已从 Unity 导出新的 iOS Framework真机版本
- 该 Framework 包含 arm64 架构
## 快速升级(推荐)
### 使用自动化脚本
```bash
cd /Users/apple/Desktop/work/flutter_unity_pod
./upgrade_framework.sh /path/to/new/UnityFramework.framework
```
脚本会自动完成以下步骤:
1. ✅ 验证新 Framework 的架构
2. 📦 备份当前 XCFramework
3. 🔨 编译模拟器空壳版本
4. 🔄 合并真机和模拟器版本
5. 📥 替换旧的 XCFramework
## 手动升级步骤
如果需要手动升级,请按以下步骤操作:
### 1. 替换真机 Framework
```bash
# 进入 Pod 仓库
cd /Users/apple/Desktop/work/flutter_unity_pod
# 备份当前版本(可选)
cp -r UnityLibrary/UnityFramework.xcframework backup/
# 删除旧的 XCFramework
rm -rf UnityLibrary/UnityFramework.xcframework
```
### 2. 运行构建脚本
```bash
# 先将新的 framework 放到临时位置
cp -r /path/to/new/UnityFramework.framework /tmp/
# 修改 build_xcframework.sh 中的路径
# 将 DEVICE_FRAMEWORK 变量改为新的 framework 路径
# 运行构建脚本
./build_xcframework.sh
```
### 3. 更新版本号(如果需要)
编辑 `UnityFramework.podspec`
```ruby
s.version = '1.0.8' # 更新版本号
```
### 4. 提交到 Git
```bash
# 添加所有更改
git add -A
# 提交
git commit -m "更新 Unity framework 到版本 x.x.x
- 更新游戏资源到最新版本
- 修复 xxx bug
- 添加 xxx 功能"
# 打标签(使用与 podspec 相同的版本号)
git tag 1.0.8
# 推送到远程
git push origin main
git push origin 1.0.8
```
## 在主项目中使用新版本
### 使用本地路径(开发测试)
在主项目的 `ios/Podfile` 中:
```ruby
pod 'UnityFramework', :path => '/Users/apple/Desktop/work/flutter_unity_pod'
```
然后运行:
```bash
cd ios
rm -rf Pods Podfile.lock
pod install
```
### 使用 Git 仓库(正式发布)
在主项目的 `ios/Podfile` 中:
```ruby
pod 'UnityFramework', :git => 'https://gitea.sdws.shop/xim/flutter_unity_pod.git', :tag => '1.0.8'
```
然后运行:
```bash
cd ios
rm -rf Pods Podfile.lock
pod install
```
## 验证升级
### 1. 验证 XCFramework 结构
```bash
# 查看 XCFramework 包含的平台
xcodebuild -checkFirstLaunchStatus \
/Users/apple/Desktop/work/flutter_unity_pod/UnityLibrary/UnityFramework.xcframework
```
应该看到:
- ✅ ios-arm64真机
- ✅ ios-arm64_x86_64-simulator模拟器
### 2. 测试模拟器构建
```bash
cd /path/to/main/project
flutter build ios --simulator --debug
```
### 3. 测试真机构建
```bash
cd /path/to/main/project
flutter build ios --release --no-codesign
```
## 常见问题
### Q: 升级后模拟器无法运行?
A: 检查模拟器空壳是否正确编译:
```bash
cd /Users/apple/Desktop/work/flutter_unity_pod
file UnityLibrary/UnityFramework.xcframework/ios-arm64_x86_64-simulator/UnityFramework.framework/UnityFramework
```
应该显示包含 `arm64``x86_64` 架构。
### Q: 升级后真机无法运行?
A: 检查真机 framework 是否包含所有必需的文件:
```bash
ls -la UnityLibrary/UnityFramework.xcframework/ios-arm64/UnityFramework.framework/
```
应该包含:
- Headers/
- Data/
- UnityFramework二进制文件
- Info.plist
- Modules/
### Q: Git 推送失败(权限不足)?
A: 联系仓库管理员配置写权限,或者先在本地测试通过后再推送。
## 版本管理建议
### 版本号规则
遵循语义化版本:`major.minor.patch`
- **major**: Unity 主版本升级(如 2021 -> 2022
- **minor**: 游戏功能更新、重大修改
- **patch**: Bug 修复、小优化
### 示例
- `1.0.7`: 初始 XCFramework 版本
- `1.0.8`: 修复 bug
- `1.1.0`: 添加新游戏
- `2.0.0`: Unity 版本升级
## 自动化 CI/CD可选
如果希望自动化升级流程,可以创建 CI 脚本:
```yaml
# .github/workflows/upgrade-framework.yml
name: Upgrade Unity Framework
on:
workflow_dispatch:
inputs:
framework_url:
description: 'Unity Framework 下载 URL'
required: true
jobs:
upgrade:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Download Framework
run: |
curl -L ${{ github.event.inputs.framework_url }} -o framework.zip
unzip framework.zip
- name: Upgrade Framework
run: ./upgrade_framework.sh ./UnityFramework.framework
- name: Commit and Tag
run: |
git config user.name "CI Bot"
git config user.email "ci@example.com"
git add -A
git commit -m "Auto upgrade framework"
git tag 1.0.${{ github.run_number }}
git push origin main --tags
```
## 回滚步骤
如果升级后出现问题,可以快速回滚:
```bash
# 查看备份
ls backup/
# 恢复备份
cp -r backup/backup_YYYYMMDD_HHMMSS/UnityFramework.xcframework \
UnityLibrary/
# 回退 git 提交
git reset --hard HEAD~1
# 删除标签
git tag -d 1.0.x
git push origin :refs/tags/1.0.x
```
## 支持
如有问题,请联系开发团队或查看:
- 项目 README
- Unity 导出文档
- CocoaPods 官方文档

View File

@ -1,8 +1,8 @@
Pod::Spec.new do |s|
s.name = 'UnityFramework'
s.version = '1.0.4'
s.summary = 'Unity iOS Framework for Flutter integration'
s.description = 'Unity iOS framework packaged as CocoaPod for Flutter projects.'
s.version = '1.1.4'
s.summary = 'Unity iOS Framework for Flutter integration (XCFramework with simulator support)'
s.description = 'Unity iOS framework packaged as XCFramework for Flutter projects. Includes simulator support for development.'
s.homepage = 'https://gitea.sdws.shop/xim/flutter_unity_pod'
s.license = { :type => 'MIT' }
s.author = { 'xim' => 'dev@local' }
@ -13,9 +13,15 @@ Pod::Spec.new do |s|
# iOS 13 起
s.platform = :ios, '13.0'
# UnityFramework.framework仅真机
s.vendored_frameworks = 'UnityLibrary/UnityFramework.framework'
s.preserve_paths = 'UnityLibrary/UnityFramework.framework'
# UnityFramework.xcframework支持真机和模拟器
s.vendored_frameworks = 'UnityLibrary/UnityFramework.xcframework'
# 明确保留 Unity Data 目录和所有资源文件
# 这对于从 git 安装时保持框架完整性至关重要
s.preserve_paths = [
'UnityLibrary/UnityFramework.xcframework/**/*',
'UnityLibrary/UnityFramework.xcframework/ios-arm64/UnityFramework.framework/Data/**/*'
]
# 链接依赖
s.frameworks = [
@ -27,21 +33,13 @@ Pod::Spec.new do |s|
s.libraries = 'z', 'c++'
# 允许非模块化头
# XCFramework 会自动处理不同平台的架构和链接,无需额外配置
s.pod_target_xcconfig = {
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
'ENABLE_BITCODE' => 'NO'
}
# 弱链接配置只在真机上链接UnityFramework模拟器完全不链接
s.user_target_xcconfig = {
'OTHER_LDFLAGS[sdk=iphoneos*]' => '$(inherited) -weak_framework UnityFramework',
'OTHER_LDFLAGS[sdk=iphonesimulator*]' => '$(inherited)',
# 模拟器上不搜索UnityFramework
'FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]' => '$(inherited)'
}
# 仅支持真机:
# - 真机arm64
# - 模拟器:不支持(弱链接,运行时检查)
# 支持架构说明:
# - 真机arm64完整 Unity 运行时)
# - 模拟器arm64, x86_64空壳实现用于开发调试
end

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>UnityFramework.framework/UnityFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>UnityFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>UnityFramework.framework/UnityFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>UnityFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@ -1 +1 @@
{"root":[{"assemblyName":"Assembly-CSharp","nameSpace":"","className":"SkipUnityLogo","methodName":"BeforeSplashScreen","loadTypes":3,"isUnityClass":false},{"assemblyName":"AudioKit","nameSpace":"QFramework","className":"Architecture","methodName":"AutoInit","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIEffect","nameSpace":"Coffee.UIEffectInternal","className":"UIExtraCallbacks","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIEffect","nameSpace":"Coffee.UIEffects","className":"ImageProxy","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIEffect","nameSpace":"Coffee.UIEffects","className":"TmpProxy","methodName":"RuntimeInitializeOnLoadMethod","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIEffect","nameSpace":"Coffee.UIEffects","className":"TmpProxy","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIParticle","nameSpace":"Coffee.UIParticleInternal","className":"UIExtraCallbacks","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIParticle","nameSpace":"Coffee.UIExtensions","className":"UIParticleUpdater","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"IngameDebugConsole.Runtime","nameSpace":"IngameDebugConsole","className":"DebugLogConsole","methodName":"ResetStatics","loadTypes":4,"isUnityClass":false},{"assemblyName":"QFramework.CoreKit","nameSpace":"QFramework","className":"DeprecateActionKit","methodName":"InitNodeSystem","loadTypes":0,"isUnityClass":false},{"assemblyName":"QFramework.CoreKit","nameSpace":"QFramework","className":"LocaleKit","methodName":"AutoInit","loadTypes":1,"isUnityClass":false},{"assemblyName":"QFramework","nameSpace":"QFramework","className":"ComparerAutoRegister","methodName":"AutoRegister","loadTypes":1,"isUnityClass":false},{"assemblyName":"ResKit","nameSpace":"QFramework","className":"Architecture","methodName":"AutoInit","loadTypes":1,"isUnityClass":false},{"assemblyName":"spine-unity","nameSpace":"Spine.Unity.AttachmentTools","className":"AtlasUtilities","methodName":"Init","loadTypes":4,"isUnityClass":false},{"assemblyName":"SupportOldQF","nameSpace":"QFramework","className":"AudioKitWithResKitInit","methodName":"Init","loadTypes":1,"isUnityClass":false},{"assemblyName":"SupportOldQF","nameSpace":"QFramework","className":"UIKitWithResKitInit","methodName":"Init","loadTypes":1,"isUnityClass":false},{"assemblyName":"Unity.2D.Animation.Runtime","nameSpace":"","className":"$BurstDirectCallInitializer","methodName":"Initialize","loadTypes":2,"isUnityClass":true},{"assemblyName":"Unity.Collections","nameSpace":"","className":"$BurstDirectCallInitializer","methodName":"Initialize","loadTypes":2,"isUnityClass":true},{"assemblyName":"Unity.RenderPipelines.Core.Runtime","nameSpace":"UnityEngine.Experimental.Rendering","className":"XRSystem","methodName":"XRSystemInit","loadTypes":3,"isUnityClass":true},{"assemblyName":"Unity.RenderPipelines.Core.Runtime","nameSpace":"UnityEngine.Rendering","className":"DebugUpdater","methodName":"RuntimeInit","loadTypes":0,"isUnityClass":true},{"assemblyName":"Unity.VisualScripting.Core","nameSpace":"Unity.VisualScripting","className":"RuntimeVSUsageUtility","methodName":"RuntimeInitializeOnLoadBeforeSceneLoad","loadTypes":1,"isUnityClass":true}]}
{"root":[{"assemblyName":"Assembly-CSharp","nameSpace":"","className":"SkipUnityLogo","methodName":"BeforeSplashScreen","loadTypes":3,"isUnityClass":false},{"assemblyName":"AudioKit","nameSpace":"QFramework","className":"Architecture","methodName":"AutoInit","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIEffect","nameSpace":"Coffee.UIEffectInternal","className":"UIExtraCallbacks","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIEffect","nameSpace":"Coffee.UIEffects","className":"ImageProxy","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIEffect","nameSpace":"Coffee.UIEffects","className":"TmpProxy","methodName":"RuntimeInitializeOnLoadMethod","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIEffect","nameSpace":"Coffee.UIEffects","className":"TmpProxy","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIParticle","nameSpace":"Coffee.UIParticleInternal","className":"UIExtraCallbacks","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"Coffee.UIParticle","nameSpace":"Coffee.UIExtensions","className":"UIParticleUpdater","methodName":"InitializeOnLoad","loadTypes":1,"isUnityClass":false},{"assemblyName":"IngameDebugConsole.Runtime","nameSpace":"IngameDebugConsole","className":"DebugLogConsole","methodName":"ResetStatics","loadTypes":4,"isUnityClass":false},{"assemblyName":"QFramework.CoreKit","nameSpace":"QFramework","className":"DeprecateActionKit","methodName":"InitNodeSystem","loadTypes":0,"isUnityClass":false},{"assemblyName":"QFramework.CoreKit","nameSpace":"QFramework","className":"LocaleKit","methodName":"AutoInit","loadTypes":1,"isUnityClass":false},{"assemblyName":"QFramework","nameSpace":"QFramework","className":"ComparerAutoRegister","methodName":"AutoRegister","loadTypes":1,"isUnityClass":false},{"assemblyName":"ResKit","nameSpace":"QFramework","className":"Architecture","methodName":"AutoInit","loadTypes":1,"isUnityClass":false},{"assemblyName":"spine-unity","nameSpace":"Spine.Unity.AttachmentTools","className":"AtlasUtilities","methodName":"Init","loadTypes":4,"isUnityClass":false},{"assemblyName":"SupportOldQF","nameSpace":"QFramework","className":"AudioKitWithResKitInit","methodName":"Init","loadTypes":1,"isUnityClass":false},{"assemblyName":"SupportOldQF","nameSpace":"QFramework","className":"UIKitWithResKitInit","methodName":"Init","loadTypes":1,"isUnityClass":false},{"assemblyName":"Unity.2D.Animation.Runtime","nameSpace":"","className":"$BurstDirectCallInitializer","methodName":"Initialize","loadTypes":2,"isUnityClass":true},{"assemblyName":"Unity.Collections","nameSpace":"","className":"$BurstDirectCallInitializer","methodName":"Initialize","loadTypes":2,"isUnityClass":true},{"assemblyName":"Unity.MemoryProfiler","nameSpace":"Unity.MemoryProfiler","className":"MetadataInjector","methodName":"PlayerInitMetadata","loadTypes":3,"isUnityClass":true},{"assemblyName":"Unity.RenderPipelines.Core.Runtime","nameSpace":"UnityEngine.Experimental.Rendering","className":"XRSystem","methodName":"XRSystemInit","loadTypes":3,"isUnityClass":true},{"assemblyName":"Unity.RenderPipelines.Core.Runtime","nameSpace":"UnityEngine.Rendering","className":"DebugUpdater","methodName":"RuntimeInit","loadTypes":0,"isUnityClass":true},{"assemblyName":"Unity.VisualScripting.Core","nameSpace":"Unity.VisualScripting","className":"RuntimeVSUsageUtility","methodName":"RuntimeInitializeOnLoadBeforeSceneLoad","loadTypes":1,"isUnityClass":true}]}

View File

@ -1 +1 @@
{"names":["UnityEngine.dll","UnityEngine.AIModule.dll","UnityEngine.ARModule.dll","UnityEngine.AccessibilityModule.dll","UnityEngine.AndroidJNIModule.dll","UnityEngine.AnimationModule.dll","UnityEngine.AssetBundleModule.dll","UnityEngine.AudioModule.dll","UnityEngine.ClothModule.dll","UnityEngine.ContentLoadModule.dll","UnityEngine.CoreModule.dll","UnityEngine.CrashReportingModule.dll","UnityEngine.DSPGraphModule.dll","UnityEngine.DirectorModule.dll","UnityEngine.GIModule.dll","UnityEngine.GameCenterModule.dll","UnityEngine.GridModule.dll","UnityEngine.HotReloadModule.dll","UnityEngine.IMGUIModule.dll","UnityEngine.ImageConversionModule.dll","UnityEngine.InputModule.dll","UnityEngine.InputLegacyModule.dll","UnityEngine.JSONSerializeModule.dll","UnityEngine.LocalizationModule.dll","UnityEngine.ParticleSystemModule.dll","UnityEngine.PerformanceReportingModule.dll","UnityEngine.PhysicsModule.dll","UnityEngine.Physics2DModule.dll","UnityEngine.ProfilerModule.dll","UnityEngine.PropertiesModule.dll","UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll","UnityEngine.ScreenCaptureModule.dll","UnityEngine.SharedInternalsModule.dll","UnityEngine.SpriteMaskModule.dll","UnityEngine.SpriteShapeModule.dll","UnityEngine.StreamingModule.dll","UnityEngine.SubstanceModule.dll","UnityEngine.SubsystemsModule.dll","UnityEngine.TLSModule.dll","UnityEngine.TerrainModule.dll","UnityEngine.TerrainPhysicsModule.dll","UnityEngine.TextCoreFontEngineModule.dll","UnityEngine.TextCoreTextEngineModule.dll","UnityEngine.TextRenderingModule.dll","UnityEngine.TilemapModule.dll","UnityEngine.UIModule.dll","UnityEngine.UIElementsModule.dll","UnityEngine.UmbraModule.dll","UnityEngine.UnityAnalyticsModule.dll","UnityEngine.UnityAnalyticsCommonModule.dll","UnityEngine.UnityConnectModule.dll","UnityEngine.UnityCurlModule.dll","UnityEngine.UnityTestProtocolModule.dll","UnityEngine.UnityWebRequestModule.dll","UnityEngine.UnityWebRequestAssetBundleModule.dll","UnityEngine.UnityWebRequestAudioModule.dll","UnityEngine.UnityWebRequestTextureModule.dll","UnityEngine.UnityWebRequestWWWModule.dll","UnityEngine.VFXModule.dll","UnityEngine.VRModule.dll","UnityEngine.VehiclesModule.dll","UnityEngine.VideoModule.dll","UnityEngine.WindModule.dll","UnityEngine.XRModule.dll","Assembly-CSharp.dll","Unity.2D.IK.Runtime.dll","HybridCLR.Runtime.dll","Unity.RenderPipelines.Core.Runtime.dll","Utilities.dll","YooAsset.dll","Unity.ScriptableBuildPipeline.dll","QFramework.CoreKit.dll","Coffee.UIEffect.dll","spine-csharp.dll","FlutterUnityIntegration.Runtime.dll","Unity.RenderPipelines.Universal.Config.Runtime.dll","Unity.VisualScripting.Flow.dll","SupportOldQF.dll","Unity.RenderPipelines.Core.ShaderLibrary.dll","ResKit.dll","Unity.Collections.dll","UIKit.dll","Unity.2D.PixelPerfect.dll","spine-unity.dll","Unity.TextMeshPro.dll","Unity.VisualScripting.DocCodeExamples.dll","Coffee.UIParticle.dll","DOTween.Modules.dll","QFramework.dll","Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll","UnlimitedScrollUI.dll","Unity.RenderPipelines.Universal.Runtime.dll","Unity.Burst.dll","MEC.dll","UnlimitedScrollUIExample.dll","Unity.VisualScripting.Core.dll","Unity.2D.Animation.Runtime.dll","UnityEngine.UI.dll","Unity.RenderPipelines.Universal.2D.Internal.dll","SimpleInspectorAttributes.dll","Unity.InternalAPIEngineBridge.001.dll","Unity.2D.Common.Runtime.dll","Unity.RenderPipeline.Universal.ShaderLibrary.dll","Unity.Timeline.dll","AudioKit.dll","Builtin.dll","Unity.Mathematics.dll","UnityWebSocket.Runtime.dll","Unity.RenderPipelines.Universal.Shaders.dll","IngameDebugConsole.Runtime.dll","Unity.VisualScripting.State.dll","SimpleScrollSnap.dll","Unity.Collections.LowLevel.ILSupport.dll","DOTween.dll","System.Runtime.CompilerServices.Unsafe.dll","Coffee.UIEffect.R.dll","Unity.VisualScripting.Antlr3.Runtime.dll","Unity.Burst.Unsafe.dll","Newtonsoft.Json.dll","Coffee.UIParticle.R.dll","Google.Protobuf.dll","GameCommon.dll","Game104.dll"],"types":[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]}
{"names":["UnityEngine.dll","UnityEngine.AIModule.dll","UnityEngine.ARModule.dll","UnityEngine.AccessibilityModule.dll","UnityEngine.AndroidJNIModule.dll","UnityEngine.AnimationModule.dll","UnityEngine.AssetBundleModule.dll","UnityEngine.AudioModule.dll","UnityEngine.ClothModule.dll","UnityEngine.ContentLoadModule.dll","UnityEngine.CoreModule.dll","UnityEngine.CrashReportingModule.dll","UnityEngine.DSPGraphModule.dll","UnityEngine.DirectorModule.dll","UnityEngine.GIModule.dll","UnityEngine.GameCenterModule.dll","UnityEngine.GridModule.dll","UnityEngine.HotReloadModule.dll","UnityEngine.IMGUIModule.dll","UnityEngine.ImageConversionModule.dll","UnityEngine.InputModule.dll","UnityEngine.InputLegacyModule.dll","UnityEngine.JSONSerializeModule.dll","UnityEngine.LocalizationModule.dll","UnityEngine.ParticleSystemModule.dll","UnityEngine.PerformanceReportingModule.dll","UnityEngine.PhysicsModule.dll","UnityEngine.Physics2DModule.dll","UnityEngine.ProfilerModule.dll","UnityEngine.PropertiesModule.dll","UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll","UnityEngine.ScreenCaptureModule.dll","UnityEngine.SharedInternalsModule.dll","UnityEngine.SpriteMaskModule.dll","UnityEngine.SpriteShapeModule.dll","UnityEngine.StreamingModule.dll","UnityEngine.SubstanceModule.dll","UnityEngine.SubsystemsModule.dll","UnityEngine.TLSModule.dll","UnityEngine.TerrainModule.dll","UnityEngine.TerrainPhysicsModule.dll","UnityEngine.TextCoreFontEngineModule.dll","UnityEngine.TextCoreTextEngineModule.dll","UnityEngine.TextRenderingModule.dll","UnityEngine.TilemapModule.dll","UnityEngine.UIModule.dll","UnityEngine.UIElementsModule.dll","UnityEngine.UmbraModule.dll","UnityEngine.UnityAnalyticsModule.dll","UnityEngine.UnityAnalyticsCommonModule.dll","UnityEngine.UnityConnectModule.dll","UnityEngine.UnityCurlModule.dll","UnityEngine.UnityTestProtocolModule.dll","UnityEngine.UnityWebRequestModule.dll","UnityEngine.UnityWebRequestAssetBundleModule.dll","UnityEngine.UnityWebRequestAudioModule.dll","UnityEngine.UnityWebRequestTextureModule.dll","UnityEngine.UnityWebRequestWWWModule.dll","UnityEngine.VFXModule.dll","UnityEngine.VRModule.dll","UnityEngine.VehiclesModule.dll","UnityEngine.VideoModule.dll","UnityEngine.WindModule.dll","UnityEngine.XRModule.dll","Assembly-CSharp.dll","Unity.2D.IK.Runtime.dll","HybridCLR.Runtime.dll","Unity.RenderPipelines.Core.Runtime.dll","Utilities.dll","YooAsset.dll","UniRx.dll","Unity.ScriptableBuildPipeline.dll","QFramework.CoreKit.dll","Coffee.UIEffect.dll","spine-csharp.dll","FlutterUnityIntegration.Runtime.dll","Unity.RenderPipelines.Universal.Config.Runtime.dll","Unity.Formats.Fbx.Runtime.dll","Unity.VisualScripting.Flow.dll","SupportOldQF.dll","Unity.RenderPipelines.Core.ShaderLibrary.dll","ResKit.dll","Unity.Collections.dll","UIKit.dll","Unity.2D.PixelPerfect.dll","spine-unity.dll","Unity.TextMeshPro.dll","Unity.VisualScripting.DocCodeExamples.dll","Coffee.UIParticle.dll","DOTween.Modules.dll","FbxBuildTestAssets.dll","QFramework.dll","Unity.Profiling.Core.dll","Unity.MemoryProfiler.dll","Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll","UnlimitedScrollUI.dll","Unity.RenderPipelines.Universal.Runtime.dll","Unity.Burst.dll","MEC.dll","Unity.VisualScripting.Core.dll","Unity.2D.Animation.Runtime.dll","UnityEngine.UI.dll","Unity.RenderPipelines.Universal.2D.Internal.dll","SimpleInspectorAttributes.dll","Unity.InternalAPIEngineBridge.001.dll","Unity.2D.Common.Runtime.dll","Unity.RenderPipeline.Universal.ShaderLibrary.dll","Unity.Timeline.dll","unity.webp.dll","AudioKit.dll","Builtin.dll","Unity.Mathematics.dll","Unity.RenderPipelines.Universal.Shaders.dll","UnityWebSocket.Runtime.dll","IngameDebugConsole.Runtime.dll","Unity.VisualScripting.State.dll","SimpleScrollSnap.dll","Unity.Collections.LowLevel.ILSupport.dll","DOTween.dll","System.Runtime.CompilerServices.Unsafe.dll","Coffee.UIEffect.R.dll","Unity.VisualScripting.Antlr3.Runtime.dll","Unity.Burst.Unsafe.dll","Newtonsoft.Json.dll","Coffee.UIParticle.R.dll","Google.Protobuf.dll","GameCommon.dll","Game102.dll","Game104.dll","Game111.dll","Game601.dll","Game602.dll","Game603.dll","Game604.dll","Game605.dll","Game606.dll","Game607.dll","Game608.dll","Game609.dll","Game610.dll"],"types":[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]}

View File

@ -1,4 +1,4 @@
wait-for-native-debugger=0
hdr-display-enabled=0
gc-max-time-slice=3
build-guid=581c492e0cd84ddabe612acfa49a91d3
build-guid=7ef4146e43344fc0a7da8943abd304da

View File

@ -0,0 +1,29 @@
#pragma once
// important app life-cycle events
@protocol LifeCycleListener<NSObject>
@optional
- (void)didFinishLaunching:(NSNotification*)notification;
- (void)didBecomeActive:(NSNotification*)notification;
- (void)willResignActive:(NSNotification*)notification;
- (void)didEnterBackground:(NSNotification*)notification;
- (void)willEnterForeground:(NSNotification*)notification;
- (void)willTerminate:(NSNotification*)notification;
- (void)unityDidUnload:(NSNotification*)notification;
- (void)unityDidQuit:(NSNotification*)notification;
@end
void UnityRegisterLifeCycleListener(id<LifeCycleListener> obj);
void UnityUnregisterLifeCycleListener(id<LifeCycleListener> obj);
#ifdef __cplusplus
extern "C" {
#endif
extern __attribute__((visibility("default"))) NSString* const kUnityDidUnload;
extern __attribute__((visibility("default"))) NSString* const kUnityDidQuit;
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -0,0 +1,186 @@
// DO NOT PUT #pragma once or include guard check here
// This header is designed to be able to be included multiple times
// This header is used to redefine platforms after they were temporary undefined by UndefinePlatforms.h
// Please make sure to always use this paired with the UndefinePlatforms.h header.
//
// ex.
//
// #include "UndefinePlatforms.h"
// #include "Some3rdParty.h"
// #include "RedefinePlatforms.h"
#ifndef DETAIL__PLATFORMS_HAD_BEEN_UNDEFINED_BY_UNDEFINEPLATFORMS_H
#error "RedefinePlatforms.h can only be used after UndefinePlatforms.h got included before."
#endif
#undef DETAIL__PLATFORMS_HAD_BEEN_UNDEFINED_BY_UNDEFINEPLATFORMS_H
// define all other platforms to 0
#undef PLATFORM_WIN
#if defined(DETAIL__TEMP_PLATFORM_WIN_WAS_1)
#undef DETAIL__TEMP_PLATFORM_WIN_WAS_1
#define PLATFORM_WIN 1
#else
#define PLATFORM_WIN 0
#endif
#undef PLATFORM_OSX
#if defined(DETAIL__TEMP_PLATFORM_OSX_WAS_1)
#undef DETAIL__TEMP_PLATFORM_OSX_WAS_1
#define PLATFORM_OSX 1
#else
#define PLATFORM_OSX 0
#endif
#undef PLATFORM_LINUX
#if defined(DETAIL__TEMP_PLATFORM_LINUX_WAS_1)
#undef DETAIL__TEMP_PLATFORM_LINUX_WAS_1
#define PLATFORM_LINUX 1
#else
#define PLATFORM_LINUX 0
#endif
#undef PLATFORM_WINRT
#if defined(DETAIL__TEMP_PLATFORM_WINRT_WAS_1)
#undef DETAIL__TEMP_PLATFORM_WINRT_WAS_1
#define PLATFORM_WINRT 1
#else
#define PLATFORM_WINRT 0
#endif
#undef PLATFORM_FAMILY_WINDOWSGAMES
#if defined(DETAIL__TEMP_PLATFORM_FAMILY_WINDOWSGAMES_WAS_1)
#undef DETAIL__TEMP_PLATFORM_FAMILY_WINDOWSGAMES_WAS_1
#define PLATFORM_FAMILY_WINDOWSGAMES 1
#else
#define PLATFORM_FAMILY_WINDOWSGAMES 0
#endif
#undef PLATFORM_WEBGL
#if defined(DETAIL__TEMP_PLATFORM_WEBGL_WAS_1)
#undef DETAIL__TEMP_PLATFORM_WEBGL_WAS_1
#define PLATFORM_WEBGL 1
#else
#define PLATFORM_WEBGL 0
#endif
#undef PLATFORM_WASI
#if defined(DETAIL__TEMP_PLATFORM_WASI_WAS_1)
#undef DETAIL__TEMP_PLATFORM_WASI_WAS_1
#define PLATFORM_WASI 1
#else
#define PLATFORM_WASI 0
#endif
#undef PLATFORM_ANDROID
#if defined(DETAIL__TEMP_PLATFORM_ANDROID_WAS_1)
#undef DETAIL__TEMP_PLATFORM_ANDROID_WAS_1
#define PLATFORM_ANDROID 1
#else
#define PLATFORM_ANDROID 0
#endif
#undef PLATFORM_PS4
#if defined(DETAIL__TEMP_PLATFORM_PS4_WAS_1)
#undef DETAIL__TEMP_PLATFORM_PS4_WAS_1
#define PLATFORM_PS4 1
#else
#define PLATFORM_PS4 0
#endif
#undef PLATFORM_PS5
#if defined(DETAIL__TEMP_PLATFORM_PS5_WAS_1)
#undef DETAIL__TEMP_PLATFORM_PS5_WAS_1
#define PLATFORM_PS5 1
#else
#define PLATFORM_PS5 0
#endif
#undef PLATFORM_IPHONE
#if defined(DETAIL__TEMP_PLATFORM_IPHONE_WAS_1)
#undef DETAIL__TEMP_PLATFORM_IPHONE_WAS_1
#define PLATFORM_IPHONE 1
#else
#define PLATFORM_IPHONE 0
#endif
#undef PLATFORM_IOS
#if defined(DETAIL__TEMP_PLATFORM_IOS_WAS_1)
#undef DETAIL__TEMP_PLATFORM_IOS_WAS_1
#define PLATFORM_IOS 1
#else
#define PLATFORM_IOS 0
#endif
#undef PLATFORM_TVOS
#if defined(DETAIL__TEMP_PLATFORM_TVOS_WAS_1)
#undef DETAIL__TEMP_PLATFORM_TVOS_WAS_1
#define PLATFORM_TVOS 1
#else
#define PLATFORM_TVOS 0
#endif
#undef PLATFORM_VISIONOS
#if defined(DETAIL__TEMP_PLATFORM_VISIONOS_WAS_1)
#undef DETAIL__TEMP_PLATFORM_VISIONOS_WAS_1
#define PLATFORM_VISIONOS 1
#else
#define PLATFORM_VISIONOS 0
#endif
#undef PLATFORM_XBOXONE
#if defined(DETAIL__TEMP_PLATFORM_XBOXONE_WAS_1)
#undef DETAIL__TEMP_PLATFORM_XBOXONE_WAS_1
#define PLATFORM_XBOXONE 1
#else
#define PLATFORM_XBOXONE 0
#endif
#undef PLATFORM_SWITCH
#if defined(DETAIL__TEMP_PLATFORM_SWITCH_WAS_1)
#undef DETAIL__TEMP_PLATFORM_SWITCH_WAS_1
#define PLATFORM_SWITCH 1
#else
#define PLATFORM_SWITCH 0
#endif
#undef PLATFORM_LUMIN
#if defined(DETAIL__TEMP_PLATFORM_LUMIN_WAS_1)
#undef DETAIL__TEMP_PLATFORM_LUMIN_WAS_1
#define PLATFORM_LUMIN 1
#else
#define PLATFORM_LUMIN 0
#endif
#undef PLATFORM_STADIA
#if defined(DETAIL__TEMP_PLATFORM_STADIA_WAS_1)
#undef DETAIL__TEMP_PLATFORM_STADIA_WAS_1
#define PLATFORM_STADIA 1
#else
#define PLATFORM_STADIA 0
#endif
#undef PLATFORM_NETBSD
#if defined(DETAIL__TEMP_PLATFORM_NETBSD_WAS_1)
#undef DETAIL__TEMP_PLATFORM_NETBSD_WAS_1
#define PLATFORM_NETBSD 1
#else
#define PLATFORM_NETBSD 0
#endif
#undef PLATFORM_EMBEDDED_LINUX
#if defined(DETAIL__TEMP_PLATFORM_EMBEDDED_LINUX_WAS_1)
#undef DETAIL__TEMP_PLATFORM_EMBEDDED_LINUX_WAS_1
#define PLATFORM_EMBEDDED_LINUX 1
#else
#define PLATFORM_EMBEDDED_LINUX 0
#endif
#undef PLATFORM_QNX
#if defined(DETAIL__TEMP_PLATFORM_QNX_WAS_1)
#undef DETAIL__TEMP_PLATFORM_QNX_WAS_1
#define PLATFORM_QNX 1
#else
#define PLATFORM_QNX 0
#endif

View File

@ -0,0 +1,68 @@
#pragma once
#include "LifeCycleListener.h"
struct UnityDisplaySurfaceBase; // Unity/UnityRendering.h
struct RenderingSurfaceParams; // Unity/DisplayManager.h
// due to delicate nature of render loop we have just one delegate in app
// if you need to use several rendering delegates you need to do one of:
// 1. create custom delegate that will have code to combine effects by itself
// 2. use helper that simply holds array of delegates (which will work only in easiest cases)
@protocol RenderPluginDelegate<LifeCycleListener, NSObject>
@required
// this will be called right after gles intialization.
// surface pointer will never be changed, so you should keep it.
// the only valid fields in there as of now are layer and context
- (void)mainDisplayInited:(struct UnityDisplaySurfaceBase*)surface;
@optional
// this will be called before recreating main display surface (from [UnityView recreateRenderingSurface])
// you can tweak params here.
// use it for enabling CVTextureCache support and the likes
- (void)onBeforeMainDisplaySurfaceRecreate:(struct RenderingSurfaceParams*)params;
// this will be called right after recreating main display surface (from [UnityView recreateRenderingSurface])
// as [UnityView recreateRenderingSurface] is the only place where unity itself will trigger surface recreate
// you can use this method to update your rendering depending on changes
- (void)onAfterMainDisplaySurfaceRecreate;
// this will be called after frame render and msaa resolve but before blitting to system FB
// you can expect that frame contents are ready (though still in target resolution)
// use it for anylizing/postprocessing rendered frame, taking screenshot and the like
// you should use targetFB if it is not 0
// otherwise use systemFB (covers case of intermediate fb not needed: no msaa, native res, no CVTextureCache involved)
- (void)onFrameResolved;
@end
// simple helper for common plugin stuff
// you can implement protocol directly, but subclassing this will provide some common implementation
@interface RenderPluginDelegate : NSObject<RenderPluginDelegate>
{
struct UnityDisplaySurfaceBase* mainDisplaySurface;
}
- (void)mainDisplayInited:(struct UnityDisplaySurfaceBase*)surface;
@end
// simple helper to have an array of render delegates.
// be warned that it works in simplest cases only, when there is no interop between delegates
@interface RenderPluginArrayDelegate : RenderPluginDelegate
{
NSArray* delegateArray;
}
@property(nonatomic, retain) NSArray* delegateArray;
- (void)mainDisplayInited:(struct UnityDisplaySurfaceBase*)surface;
- (void)onBeforeMainDisplaySurfaceRecreate:(struct RenderingSurfaceParams*)params;
- (void)onAfterMainDisplaySurfaceRecreate;
- (void)onFrameResolved;
- (void)didBecomeActive:(NSNotification*)notification;
- (void)willResignActive:(NSNotification*)notification;
- (void)didEnterBackground:(NSNotification*)notification;
- (void)willEnterForeground:(NSNotification*)notification;
- (void)willTerminate:(NSNotification*)notification;
@end

View File

@ -0,0 +1,123 @@
// DO NOT PUT #pragma once or include guard check here
// This header is designed to be able to be included multiple times
// This header is used to temporary undefine all platform definitions in case there is a naming conflict with
// 3rd party code. Please make sure to always use this paired with the RedefinePlatforms.h header.
//
// ex.
//
// #include "UndefinePlatforms.h"
// #include "Some3rdParty.h"
// #include "RedefinePlatforms.h"
#ifdef DETAIL__PLATFORMS_HAD_BEEN_UNDEFINED_BY_UNDEFINEPLATFORMS_H
#error "UndefinePlatforms.h has been included more than once or RedefinePlatforms.h is missing."
#endif
// define all other platforms to 0
#if PLATFORM_WIN
#define DETAIL__TEMP_PLATFORM_WIN_WAS_1
#endif
#undef PLATFORM_WIN
#if PLATFORM_OSX
#define DETAIL__TEMP_PLATFORM_OSX_WAS_1
#endif
#undef PLATFORM_OSX
#if PLATFORM_LINUX
#define DETAIL__TEMP_PLATFORM_LINUX_WAS_1
#endif
#undef PLATFORM_LINUX
#if PLATFORM_WINRT
#define DETAIL__TEMP_PLATFORM_WINRT_WAS_1
#endif
#undef PLATFORM_WINRT
#if PLATFORM_FAMILY_WINDOWSGAMES
#define DETAIL__TEMP_PLATFORM_FAMILY_WINDOWSGAMES_WAS_1
#endif
#undef PLATFORM_FAMILY_WINDOWSGAMES
#if PLATFORM_WEBGL
#define DETAIL__TEMP_PLATFORM_WEBGL_WAS_1
#endif
#undef PLATFORM_WEBGL
#if PLATFORM_WASI
#define DETAIL__TEMP_PLATFORM_WASI_WAS_1
#endif
#undef PLATFORM_WASI
#if PLATFORM_ANDROID
#define DETAIL__TEMP_PLATFORM_ANDROID_WAS_1
#endif
#undef PLATFORM_ANDROID
#if PLATFORM_PS4
#define DETAIL__TEMP_PLATFORM_PS4_WAS_1
#endif
#undef PLATFORM_PS4
#if PLATFORM_PS5
#define DETAIL__TEMP_PLATFORM_PS5_WAS_1
#endif
#undef PLATFORM_PS5
#if PLATFORM_IPHONE
#define DETAIL__TEMP_PLATFORM_IPHONE_WAS_1
#endif
#undef PLATFORM_IPHONE
#if PLATFORM_IOS
#define DETAIL__TEMP_PLATFORM_IOS_WAS_1
#endif
#undef PLATFORM_IOS
#if PLATFORM_TVOS
#define DETAIL__TEMP_PLATFORM_TVOS_WAS_1
#endif
#undef PLATFORM_TVOS
#if PLATFORM_VISIONOS
#define DETAIL__TEMP_PLATFORM_VISIONOS_WAS_1
#endif
#undef PLATFORM_VISIONOS
#if PLATFORM_XBOXONE
#define DETAIL__TEMP_PLATFORM_XBOXONE_WAS_1
#endif
#undef PLATFORM_XBOXONE
#if PLATFORM_SWITCH
#define DETAIL__TEMP_PLATFORM_SWITCH_WAS_1
#endif
#undef PLATFORM_SWITCH
#if PLATFORM_LUMIN
#define DETAIL__TEMP_PLATFORM_LUMIN_WAS_1
#endif
#undef PLATFORM_LUMIN
#if PLATFORM_STADIA
#define DETAIL__TEMP_PLATFORM_STADIA_WAS_1
#endif
#undef PLATFORM_STADIA
#if PLATFORM_NETBSD
#define DETAIL__TEMP_PLATFORM_NETBSD_WAS_1
#endif
#undef PLATFORM_NETBSD
#if PLATFORM_EMBEDDED_LINUX
#define DETAIL__TEMP_PLATFORM_EMBEDDED_LINUX_WAS_1
#endif
#undef PLATFORM_EMBEDDED_LINUX
#if PLATFORM_QNX
#define DETAIL__TEMP_PLATFORM_QNX_WAS_1
#endif
#undef PLATFORM_QNX
#define DETAIL__PLATFORMS_HAD_BEEN_UNDEFINED_BY_UNDEFINEPLATFORMS_H

View File

@ -0,0 +1,140 @@
#pragma once
#import <QuartzCore/CADisplayLink.h>
#include "RenderPluginDelegate.h"
// Edited by https://github.com/juicycleff/flutter-unity-view-widget
// Added by https://github.com/juicycleff/flutter-unity-view-widget
typedef void(^unitySceneLoadedCallbackType)(const char* name, const int* buildIndex, const bool* isLoaded, const bool* IsValid);
typedef void(^unityMessageCallbackType)(const char* message);
// Added by https://github.com/juicycleff/flutter-unity-view-widget
@protocol UnityEventListener <NSObject>
- (void)onSceneLoaded:(NSString *)name buildIndex:(NSInteger *)bIndex loaded:(bool *)isLoaded valid:(bool *)IsValid;
- (void)onMessage:(NSString *)message;
@end
@class UnityView;
@class UnityViewControllerBase;
@class DisplayConnection;
__attribute__ ((visibility("default")))
@interface UnityAppController : NSObject<UIApplicationDelegate>
{
UnityView* _unityView;
CADisplayLink* _displayLink;
UIWindow* _window;
UIView* _rootView;
UIViewController* _rootController;
UIViewController* _snapshotViewController;
DisplayConnection* _mainDisplay;
// CODE ARCHEOLOGY: we were caching view controllers, both autorotation one and per-fixed-orientation ones
// CODE ARCHEOLOGY: we stopped doing this as the performance impact is negligible,
// CODE ARCHEOLOGY: yet it introduces corner cases and in general lots of code
#if UNITY_SUPPORT_ROTATION
UIInterfaceOrientation _curOrientation;
#endif
id<RenderPluginDelegate> _renderDelegate;
}
// override it to add your render plugin delegate
- (void)shouldAttachRenderDelegate;
// this one is called at the very end of didFinishLaunchingWithOptions:
// after views have been created but before initing engine itself
// override it to register plugins, tweak UI etc
- (void)preStartUnity;
// this one is called at at the very end of didFinishLaunchingWithOptions:
// it will start showing unity view and rendering unity content
- (void)startUnity:(UIApplication*)application;
// this is a part of UIApplicationDelegate protocol starting with ios5
// setter will be generated empty
@property (retain, nonatomic) UIWindow* window;
@property (readonly, copy, nonatomic) UnityView* unityView;
@property (readonly, copy, nonatomic) CADisplayLink* unityDisplayLink;
@property (readonly, copy, nonatomic) UIView* rootView;
@property (readonly, copy, nonatomic) UIViewController* rootViewController;
@property (readonly, copy, nonatomic) DisplayConnection* mainDisplay;
#if UNITY_SUPPORT_ROTATION
@property (readonly, nonatomic) UIInterfaceOrientation interfaceOrientation;
#endif
@property (nonatomic, retain) id renderDelegate;
@property (nonatomic, copy) void (^quitHandler)(void);
@property (nonatomic, copy) void(^unitySceneLoadedHandler)(const char* name, const int* buildIndex, const bool* isLoaded, const bool* IsValid);
@property (nonatomic, copy) void(^unityMessageHandler)(const char* message);
@end
// accessing app controller
#ifdef __cplusplus
extern "C" {
#endif
extern UnityAppController* _UnityAppController;
extern UnityAppController* GetAppController(void);
#ifdef __cplusplus
} // extern "C"
#endif
// Put this into mm file with your subclass implementation
// pass subclass name to define
#define IMPL_APP_CONTROLLER_SUBCLASS(ClassName) \
@interface ClassName(OverrideAppDelegate) \
{ \
} \
+(void)load; \
@end \
@implementation ClassName(OverrideAppDelegate) \
+(void)load \
{ \
extern const char* AppControllerClassName; \
AppControllerClassName = #ClassName; \
} \
@end \
// plugins
#define APP_CONTROLLER_RENDER_PLUGIN_METHOD(method) \
do { \
id<RenderPluginDelegate> delegate = GetAppController().renderDelegate; \
if([delegate respondsToSelector:@selector(method)]) \
[delegate method]; \
} while(0)
#define APP_CONTROLLER_RENDER_PLUGIN_METHOD_ARG(method, arg) \
do { \
id<RenderPluginDelegate> delegate = GetAppController().renderDelegate; \
if([delegate respondsToSelector:@selector(method:)]) \
[delegate method:arg]; \
} while(0)
// these are simple wrappers about ios api, added for convenience
void AppController_SendNotification(NSString* name);
void AppController_SendNotificationWithArg(NSString* name, id arg);
void AppController_SendUnityViewControllerNotification(NSString* name);
// in the case when apple adds new api that has easy fallback path for old ios
// we will add new api methods at runtime on older ios, so we can switch to new api universally
// in that case we still need actual declaration: we will do it here as it is the most convenient place
// history:
// [CADisplayLink preferredFramesPerSecond], [UIScreen maximumFramesPerSecond], [UIView safeAreaInsets]
// were removed after we started to enforce xcode9 (sdk 11)

View File

@ -0,0 +1,67 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <UnityFramework/UnityAppController.h>
// this is coming from mach-o/ldsyms.h
// we were including this header header here directly
// alas we were including <mach-o/ldsyms.h> directly in UnityFramework.h (for mach_header definition)
// instead of doing forward declaration and using, say, void pointers in unity c-interface
// and this resulted in code in the wild that uses _mh_execute_header directly without this include
// now, with C++/ObjC++ modules support we end up in a funny situation,
// where we need to include UndefinePlatforms/RedefinePlatforms quoted which gives a warning
// thankfully, we can easily provide the definition of _mh_execute_header ourselves
typedef struct mach_header_64 MachHeader;
extern const struct mach_header_64 _mh_execute_header;
//! Project version number for UnityFramework.
FOUNDATION_EXPORT double UnityFrameworkVersionNumber;
//! Project version string for UnityFramework.
FOUNDATION_EXPORT const unsigned char UnityFrameworkVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <UnityFramework/PublicHeader.h>
#pragma once
// important app life-cycle events
__attribute__ ((visibility("default")))
@protocol UnityFrameworkListener<NSObject>
@optional
- (void)unityDidUnload:(NSNotification*)notification;
- (void)unityDidQuit:(NSNotification*)notification;
@end
__attribute__ ((visibility("default")))
@interface UnityFramework : NSObject
{
}
- (UnityAppController*)appController;
- (UITextField*)keyboardTextField;
+ (UnityFramework*)getInstance;
- (void)setDataBundleId:(const char*)bundleId;
- (void)runUIApplicationMainWithArgc:(int)argc argv:(char*[])argv;
- (void)runEmbeddedWithArgc:(int)argc argv:(char*[])argv appLaunchOpts:(NSDictionary*)appLaunchOpts;
- (void)unloadApplication;
- (void)quitApplication:(int)exitCode;
- (void)registerFrameworkListener:(id<UnityFrameworkListener>)obj;
- (void)unregisterFrameworkListener:(id<UnityFrameworkListener>)obj;
- (void)showUnityWindow;
- (void)pause:(bool)pause;
- (void)setAbsoluteURL:(const char *)url;
- (void)setExecuteHeader:(const MachHeader*)header;
- (void)sendMessageToGOWithName:(const char*)goName functionName:(const char*)name message:(const char*)msg;
@end

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>UnityFramework</string>
<key>CFBundleIdentifier</key>
<string>com.unity3d.framework</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>UnityFramework</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>MinimumOSVersion</key>
<string>13.0</string>
</dict>
</plist>

View File

@ -0,0 +1,5 @@
framework module UnityFramework {
umbrella header "UnityFramework.h"
export *
module * { export * }
}

View File

@ -0,0 +1,94 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
// Stub implementation for simulator
typedef struct mach_header_64 MachHeader;
@protocol UnityFrameworkListener<NSObject>
@optional
- (void)unityDidUnload:(NSNotification*)notification;
- (void)unityDidQuit:(NSNotification*)notification;
@end
@interface UnityAppController : NSObject
@end
@implementation UnityAppController
@end
@interface UnityFramework : NSObject
@end
@implementation UnityFramework
+ (instancetype)getInstance {
static UnityFramework *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[self alloc] init];
});
return instance;
}
- (id)appController {
return nil;
}
- (UITextField*)keyboardTextField {
return nil;
}
- (void)setDataBundleId:(const char*)bundleId {
// Stub
}
- (void)runUIApplicationMainWithArgc:(int)argc argv:(char*[])argv {
// Stub
}
- (void)runEmbeddedWithArgc:(int)argc argv:(char*[])argv appLaunchOpts:(NSDictionary*)appLaunchOpts {
// Stub - Unity
NSLog(@"UnityFramework: Simulator stub - Unity not available");
}
- (void)unloadApplication {
// Stub
}
- (void)quitApplication:(int)exitCode {
// Stub
}
- (void)registerFrameworkListener:(id)obj {
// Stub
}
- (void)unregisterFrameworkListener:(id)obj {
// Stub
}
- (void)showUnityWindow {
// Stub
}
- (void)pause:(bool)pause {
// Stub
}
- (void)setAbsoluteURL:(const char *)url {
// Stub
}
- (void)setExecuteHeader:(const MachHeader*)header {
// Stub
}
- (void)sendMessageToGOWithName:(const char*)goName functionName:(const char*)name message:(const char*)msg {
// Stub
}
@end
// Export version symbols
double UnityFrameworkVersionNumber = 1.0;
const unsigned char UnityFrameworkVersionString[] = "1.0";

160
upgrade_framework.sh Executable file
View File

@ -0,0 +1,160 @@
#!/bin/bash
set -e
echo "=== UnityFramework 升级脚本 ==="
echo ""
# 检查参数
if [ "$#" -ne 1 ]; then
echo "用法: $0 <新的真机Framework路径>"
echo "示例: $0 /path/to/new/UnityFramework.framework"
exit 1
fi
NEW_FRAMEWORK="$1"
REPO_DIR="/Users/ezio/Documents/work/project/flutter_unity_pod"
STUB_DIR="$REPO_DIR/simulator_stub"
BUILD_DIR="$REPO_DIR/build"
# 验证新的 framework 是否存在
if [ ! -d "$NEW_FRAMEWORK" ]; then
echo "❌ 错误: Framework 不存在: $NEW_FRAMEWORK"
exit 1
fi
# 验证是否是真机架构
ARCH=$(lipo -info "$NEW_FRAMEWORK/UnityFramework" 2>/dev/null | grep "arm64" || echo "")
if [ -z "$ARCH" ]; then
echo "❌ 错误: Framework 不包含 arm64 架构,请确保是真机版本"
exit 1
fi
echo "✅ 验证通过: 找到真机 Framework"
echo ""
# 清理之前的构建
echo "1. 清理旧构建..."
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
# 备份当前 XCFramework可选
if [ -d "$REPO_DIR/UnityLibrary/UnityFramework.xcframework" ]; then
BACKUP_DIR="$REPO_DIR/backup_$(date +%Y%m%d_%H%M%S)"
echo "2. 备份当前 XCFramework 到: $BACKUP_DIR"
mkdir -p "$BACKUP_DIR"
cp -r "$REPO_DIR/UnityLibrary/UnityFramework.xcframework" "$BACKUP_DIR/"
fi
echo "3. 编译模拟器空壳 framework..."
cd "$STUB_DIR"
# 编译 arm64 模拟器版本
xcrun clang -arch arm64 \
-isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) \
-target arm64-apple-ios13.0-simulator \
-dynamiclib \
-o "$BUILD_DIR/UnityFramework_sim_arm64" \
-framework Foundation -framework UIKit \
-install_name @rpath/UnityFramework.framework/UnityFramework \
UnityFrameworkStub.m
# 编译 x86_64 模拟器版本
xcrun clang -arch x86_64 \
-isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) \
-target x86_64-apple-ios13.0-simulator \
-dynamiclib \
-o "$BUILD_DIR/UnityFramework_sim_x86_64" \
-framework Foundation -framework UIKit \
-install_name @rpath/UnityFramework.framework/UnityFramework \
UnityFrameworkStub.m
echo "4. 合并模拟器架构..."
lipo -create \
"$BUILD_DIR/UnityFramework_sim_arm64" \
"$BUILD_DIR/UnityFramework_sim_x86_64" \
-output "$BUILD_DIR/UnityFramework_sim"
echo "5. 创建模拟器 framework 结构..."
SIM_FRAMEWORK="$BUILD_DIR/UnityFramework-sim.framework"
mkdir -p "$SIM_FRAMEWORK/Headers"
mkdir -p "$SIM_FRAMEWORK/Modules"
# 复制二进制
cp "$BUILD_DIR/UnityFramework_sim" "$SIM_FRAMEWORK/UnityFramework"
# 从新的真机 framework 复制头文件
cp -r "$NEW_FRAMEWORK/Headers/" "$SIM_FRAMEWORK/Headers/"
# 创建 module.modulemap
cat > "$SIM_FRAMEWORK/Modules/module.modulemap" << 'EOF'
framework module UnityFramework {
umbrella header "UnityFramework.h"
export *
module * { export * }
}
EOF
# 创建 Info.plist
cat > "$SIM_FRAMEWORK/Info.plist" << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>UnityFramework</string>
<key>CFBundleIdentifier</key>
<string>com.unity3d.framework</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>UnityFramework</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>MinimumOSVersion</key>
<string>13.0</string>
</dict>
</plist>
EOF
echo "6. 创建 XCFramework..."
# 创建临时目录
DEVICE_BUILD="$BUILD_DIR/device"
SIM_BUILD="$BUILD_DIR/simulator"
mkdir -p "$DEVICE_BUILD" "$SIM_BUILD"
# 复制新的真机 framework
cp -r "$NEW_FRAMEWORK" "$DEVICE_BUILD/UnityFramework.framework"
echo "6.5. 优化 framework 大小strip 符号表)..."
# 移除本地符号和调试信息保留外部符号减少约100MB
strip -x "$DEVICE_BUILD/UnityFramework.framework/UnityFramework"
echo " 优化后大小: $(du -sh "$DEVICE_BUILD/UnityFramework.framework/UnityFramework" | awk '{print $1}')"
# 移动模拟器 framework
mv "$SIM_FRAMEWORK" "$SIM_BUILD/UnityFramework.framework"
# 创建 XCFramework
xcodebuild -create-xcframework \
-framework "$DEVICE_BUILD/UnityFramework.framework" \
-framework "$SIM_BUILD/UnityFramework.framework" \
-output "$BUILD_DIR/UnityFramework.xcframework"
echo "7. 替换旧的 XCFramework..."
rm -rf "$REPO_DIR/UnityLibrary/UnityFramework.xcframework"
cp -r "$BUILD_DIR/UnityFramework.xcframework" "$REPO_DIR/UnityLibrary/"
echo ""
echo "✅ 升级完成!新的 XCFramework 已创建在:"
echo " $REPO_DIR/UnityLibrary/UnityFramework.xcframework"
echo ""
echo "📝 后续步骤:"
echo " 1. 检查 XCFramework 是否正常"
echo " 2. 更新 podspec 版本号(如果需要)"
echo " 3. 提交到 git: git add -A && git commit -m 'Update Unity framework'"
echo " 4. 打标签: git tag 1.0.x"
echo " 5. 推送: git push origin main && git push origin 1.0.x"
echo ""