Recently in testing a small demo, using a lot of phone features. Posted here for later reference
Note: When packaging a release, plugins must import the following DLL files, otherwise the database <i18n,i18n cannot be connected after build. West,system.data,mysql.data>
1, the operation of mobile phone vibration; handheld.vibrate (); Judge yourself by adding conditions before shaking
2, input box call system input: Each plug-in TextBox control comes with this function, when practical, automatically call the phone input method.
3. Exit Application < Incomplete >:if (Input.getkeydown (keycode.escape) | | Input.getkeydown (Keycode.home))
{
OpenFileDialog ofd = new OpenFileDialog ();
if (OFD. ShowDialog () ==dialogresult.ok)
{
Exit program
UnityEngine.Application.Quit ();
}
}
4. Call Phone camera
IEnumerator opencamera (int whichone)
{
Yield return application.requestuserauthorization (USERAUTHORIZATION.WEBCAM);
if (Application.hasuserauthorization (Userauthorization.webcam))
{
Call the hardware to get the phone camera regardless of autofocus
webcamdevice[] devices = webcamtexture.devices;
if (Devices. Length <= Whichone)
{
Cameraname = Devices[0].name;
}
Else
{
Cameraname = Devices[whichone].name;
}
Cameratexture = new Webcamtexture (Cameraname, Screen.height, Screen.width, 15);
Cameratexture.play (); In Ongui, define a sprite to receive the image. Sprite = cameratexture;
Isplay = true; Similarly, if the video is taken in real-time image can also be achieved? Not verified
}
}
5, Unity3d connection MySQL, SQL Server, Sqllite database
Note: SQL Server, Sqllite needs to be in the Unity installation file in the system. Copy the Data.dll and System.sqllite.dll files to the plugins directory. The rest of the operation is consistent with ADO
When you operate MySQL, you need to download a MySQL online. Data.dll file. Recommended version 5.5, preferably 5.0-5.2, the version is too high, unity does not recognize the load. The remaining operations are as above.