You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin is used to retrieve distribution channel identifiers for iOS and Android platforms in Unity projects. It is a submodule of the `https://github.com/GameFrameX/GameFrameX` project.
In your C# scripts, use the `BlankGetChannel.GetChannelName(string key)` method to retrieve channel information. The `key` parameter is the key name you used when setting up the channel information on the corresponding platform.
42
47
43
-
**示例代码:**
48
+
**Example Code:**
44
49
45
50
```csharp
46
51
using UnityEngine;
@@ -49,30 +54,30 @@ public class MyGameScript : MonoBehaviour
For iOS, tvOS, and visionOS platforms, the plugin includes a build post-processor (`PostProcessBuildHandler.cs`). When building, if the project's `Info.plist`file:
75
+
-**Does not**have a key named `channel`, the script will automatically add an entry with key `channel` and value `default`.
76
+
-**Already has**a key named `channel`, no modifications will be made.
You can modify the `channel` value in the Xcode project's`Info.plist`file, or use your custom key name when calling `BlankGetChannel.GetChannelName()`(ensure that key name exists in `Info.plist`).
74
79
75
-
**Info.plist 配置示例:**
80
+
**Info.plist Configuration Example:**
76
81
77
82
```xml
78
83
<key>channel</key>
@@ -82,11 +87,11 @@ public class MyGameScript : MonoBehaviour
For the Android platform, you need to define channel information in the `AndroidManifest.xml`file. This is typically done by adding `<meta-data>`tags within the `<application>`tag.
88
93
89
-
例如,如果您想使用键名 `channel`和值为 `android_cn_taptap`:
94
+
For example, if you want to use the key name `channel`and value `android_cn_taptap`:
90
95
91
96
```xml
92
97
<application ...>
@@ -102,33 +107,33 @@ public class MyGameScript : MonoBehaviour
For Editor, PC (Windows/Mac/Linux), WebGL, UWP, PS4, PS5, Xbox One, Nintendo Switch, and other platforms, you need to create a text file named `app_info.txt`in the `Resources` folder of your Unity project.
114
119
115
-
**app_info.txt 文件格式示例:**
120
+
**app_info.txt File Format Example:**
116
121
117
122
```
118
123
channel=editor_cn_test
119
124
sub_channel=beta
120
125
other_key=other_value
121
126
```
122
127
123
-
每行格式为:`键名=值`
128
+
Each line format is: `key=value`
124
129
125
-
插件会自动读取该文件中的键值对,并缓存起来供后续使用。
130
+
The plugin will automatically read the key-value pairs from this file and cache them for subsequent use.
-**Editor / PC / WebGL / UWP / 主机平台**:`Resources/app_info.txt`文件
133
-
-插件包含 `link.xml`文件以防止代码被 Unity 的代码裁剪功能移除。
134
-
-`GetChannelName()`方法会缓存渠道信息,避免重复读取配置文件,提高性能。
134
+
-Ensure that the `key` you use when calling `BlankGetChannel.GetChannelName(string key)`matches the key name you set in the corresponding platform's configuration file:
135
+
-**iOS / tvOS / visionOS**: `Info.plist`file
136
+
-**Android**: `<meta-data>`tags in `AndroidManifest.xml` file
0 commit comments