zoukankan      html  css  js  c++  java
  • unity3d游戏无法部署到windows phone8手机上的解决方法

    今天搞了个unity3d游戏,准备部署到自己的lumia 920上,数据线连接正常,操作正常,但是“build”以后,始终无法部署到手机上,也没有在选择的目录下生产任何相关文件。(你的系统必须是win8)

    但是提示有一个错误:

     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).
     
    意思是NGUITools.cs里面的Load()方法有问题,导致无法部署。
    解决方案:找到NGUITools.cs,找到Load()方法。代码如下:
    	/// <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
    	}
    

      只要在#if UNITY_WEBPLAYER || UNITY_FLASH后面加个“UNITY_WP8”就可以了。

    完整代码:

    	/// <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
    	}
    

      之后,按照部署步骤,Build以后就可以看到游戏安装到手机上了。

    参考资料:

    http://www.tasharen.com/forum/index.php?topic=6625.0

    unity3d部署到wp手机:

    http://game.ceeger.com/Manual/wp8-deployment.html

     
  • 相关阅读:
    成长之思考题
    HP LaserJet P2055dn 通过网络连接打印机用户指南
    【转载】大牛给计算机专业学生的7个建议
    CMake 复制文件方法
    Gitee Git bash VSCode操作简易说明
    Qwt 编译 配置 使用
    Clion+Cmake+Qt5+Qwt+msys2+MinGW在Windows下的安装配置使用教程
    基于Cmake+QT+VS的C++项目构建开发编译简明教程
    在WINDOWS中安装使用GSL(MinGW64+Sublime Text3 & Visual Studio)
    JavaScript学习(2)call&apply&bind&eval用法
  • 原文地址:https://www.cnblogs.com/zhibolife/p/3715247.html
Copyright © 2011-2022 走看看