UnityMobileInput
Unity Mobile Input Plugin for iOS and Android (Unity UI compatible)
You can use default InputField UI component on iOS and Android without additional field
above keyboard
It's deep refactor and bug fix of UnityNativeEdit (https://github.com/kmbang/UnityNativeEdit)
Installation
Add url https://github.com/mopsicus/UnityMobileInput.git
to Package Manager, or add the following line to Packages/manifest.json: "ru.mopsicus.mobileinput": "https://github.com/mopsicus/UnityMobileInput.git"
Features
- Native input field and keyboard on iOS and Android
- Hiding additional mobile input box (Android)
- Show "Done", "Clear" buttons (iOS)
- Return button type: Default, Next, Done, Search, Send
- Detect keyboard show/hide (with height)
- Custom fonts support
How to use
- Copy the files into your existing unity project asset folder
- Make empty Gameobject and attach
Plugins
to your new GameObject - Attach
MobileInputField
script to your Unity UIInputField
object - For more options set
ContentType
toCustom
to yourInputField
object - For
Android
make sure yourAndroidManifest.xml
has the following setting
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name">
...
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
...
</activity>
- To prevent screen slide up on
Android
when keyboard show, add this option to yourAndroidManifest.xml
<activity ... android:windowSoftInputMode="adjustNothing">
...
</activity>
How to use custom fonts
- Copy font TTF to StreamingAssets folder
- Input font name in property instead "default"
- You are cool
Demo
Open Demo scene and build, to try how it works
Example
Etc
JSON library for C# is NiceJson (https://github.com/AngelQuirogaM/NiceJson)