Today we have a unity3d game, ready to deploy to their Lumia 920, the data cable connection is normal, the operation is normal, but "build" after, always can not be deployed to the phone, nor in the selected directory to produce any related files.
But there is an error in the hint:
Error Building Player:Exception:Error:method ' system.byte[] system.io.file::readallbytes (System.String) ' doesn ' T exist in Target framework. It is referenced from Assembly-csharp.dll at system.byte[] Nguitools::load (System.String).It means there is a problem with the load () method inside the NGUITools.cs, which makes it impossible to deploy. Solution: Find the NGUITools.cs and find the Load () method. The code is as follows:?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/// <summary>
/// Load all binary data from the specified file.
/// </summary>
static public byte
[] Load (
string fileName)
{ #if UNITY_WEBPLAYER || UNITY_FLASH
return null
; #else
if (!NGUITools.fileAccess)
return null
;
string path = Application.persistentDataPath +
"/" + fileName;
if (File.Exists(path))
{
return File.ReadAllBytes(path);
}
return null
; #endif
}
|
As long as the #if Unity_webplayer | | Add a "UNITY_WP8" to the back of the Unity_flash.
Full code:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/// <summary>
/// Load all binary data from the specified file.
/// </summary>
static public byte
[] Load (
string fileName)
{ #if UNITY_WEBPLAYER || UNITY_FLASH||UNITY_WP8
return null
; #else
if (!NGUITools.fileAccess)
return null
;
string path = Application.persistentDataPath +
"/" + fileName;
if (File.Exists(path))
{
return File.ReadAllBytes(path);
}
return null
; #endif
}
|
Then, following the deployment steps, build will see the game installed on your phone.
Resources:
http://www.tasharen.com/forum/index.php?topic=6625.0
Unity3d deployed to WP Mobile:
Http://game.ceeger.com/Manual/wp8-deployment.html