「Unity/URLからアプリ起動」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==Androidの場合== BuildProfilesのAndroid/PlayerSettingで、CustomMainManifestをonにする。 Assets/Plugins/Android/AndroidManifest.xml にintent-filterを追加...」) |
|||
| 行50: | 行50: | ||
</manifest> | </manifest> | ||
</pre> | </pre> | ||
| + | |||
| + | Unity の Player Settings の "ApplicationEntryPoint" の GameActivity にチェックがついてることを確認。 | ||
2025年12月3日 (水) 08:01時点における版
Androidの場合
BuildProfilesのAndroid/PlayerSettingで、CustomMainManifestをonにする。
Assets/Plugins/Android/AndroidManifest.xml にintent-filterを追加する。
例:ttp://example.com/hogehogeで起動させたい場合。
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application>
<!--Used when Application Entry is set to Activity, otherwise remove this activity block-->
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<!--Used when Application Entry is set to GameActivity, otherwise remove this activity block-->
<activity android:name="com.unity3d.player.UnityPlayerGameActivity"
android:theme="@style/BaseUnityGameActivityTheme"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<meta-data android:name="android.app.lib_name" android:value="game" />
<!-- DeepLink / App Links -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="example.com"
android:pathPrefix="/hogehoge" />
</intent-filter>
</activity>
</application>
</manifest>
Unity の Player Settings の "ApplicationEntryPoint" の GameActivity にチェックがついてることを確認。
