Topic: Collection of UFE 1.6 Mods and Improvements
Fixing user-end debug mode options
Grab the OptionsScreen.prefab and drag it to a scene (any scene, it doesn't stay there)
Expand the prefab, then expand Background, and finally expand Control_Debug
Select the OptionsScreen prefab and scroll down to Debug Mode Toggle
Drag the newly visible Toggle_Debug to the field next to Debug Mode Toggle
Do not forget to drag the OptionsScreen back onto the one in the folder view to update it
You may now remove the OptionsScreen from the scene it was dragged into
Smoother mobile intro video support
Open VideoIntroScreen and find the OnShow methods.
Replace the code inside #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_WP8 || UNITY_IOS) with
public override void OnShow (){
base.OnShow ();
StartCoroutine(PlayVideoCoroutine());
}
and just below it (does not need to be inside the if), add
IEnumerator PlayVideoCoroutine()
{
Handheld.PlayFullScreenMovie(
this.mobilePlatformsPath,
Color.black,
FullScreenMovieControlMode.CancelOnInput,
FullScreenMovieScalingMode.AspectFill
);
yield return new WaitForEndOfFrame();
this.GoToMainMenu();
}
which will wait for the video to continue, but also support tapping the screen to skip
Mobile gamepad / touchscreen flexibility
If you are using Control Freak, you may notice the game will become a touch-only layout (or require a lot of additional configuration for Control Freak), which is not necessary with a quick edit to InputTouchController.cs
Find the function protected override void SelectInputType ()
Just below UnityEngine.Object touchController = null; add
string[] controllers = Input.GetJoystickNames();
Next find if (touchController != null){ and replace it with
#if UNITY_ANDROID
if (Application.platform == RuntimePlatform.Android &&
(SystemInfo.deviceModel == "NVIDIA SHIELD")) {
if (touchController != null){
((TouchController) touchController).HideController(-1);
}
base.SelectInputType();
} else
#endif
if (controllers.Length > 0) {
if (touchController != null){
((TouchController) touchController).HideController(-1);
}
base.SelectInputType();
} else if (touchController != null) {
Which will disable Control Freak if a controller is detected
The Android section also forces hardware controller support on the Nvidia Shield. This is because the Nvidia Shield uses Wifi Direct controller connections that are not detected as regular bluetooth controllers but will register as an HID (keyboard / mouse).
You will also want to make sure the Bluetooth permission is included in the AndroidManifest and with Unity 5.1 and higher, enabling the ForwardNativeEventsToDalvik flag helps to make sure input is not dismissed in the Unity core.
If you need a generic manifest to add the Bluetooth permission, a simple version is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity.plugin" android:versionName="1.0.0" android:versionCode="1">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:debuggable="false">
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:screenOrientation="landscape" android:launchMode="singleTask" android:configChanges="screenSize|orientation|keyboardHidden|keyboard">
<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="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
</manifest>
Save this as AndroidManifest.xml in the Plugins/Android folder (create if needed)