找回密码
 立即注册
查看: 4474|回复: 88

[手机] 跨平台解决unity3d读取本地文件教程

[复制链接]
发表于 2013-4-2 19:36 | 显示全部楼层 |阅读模式
资源信息 Tutorial Information
教程名称: 跨平台解决unity3d读取本地文件教程(发帖教程)
适用引擎:   (适用引擎,为空默认为Unity)
教程语种: 中文
教程等级: 1
教程格式: 图文(请用IE9以上浏览器访问本版块)
教程作者: 转载自互联网 (如有问题请短消息联系作者或发表回复)
下载地址: (兑换积分)
点击查看原图
美丽分割线
[code=csharp]using UnityEngine;
using System.Collections;

public class VIPMainController : MonoBehaviour {
    public TextAsset AssetText;
    // Use this for initialization
    void Start () {
        print(AssetText.text);
    }
   
    // Update is called once per frame
    void Update () {
   
    }
    void ClickMainCloseBtn()
    {
        Application.Quit();
    }
}

[/code]


或者读取Resources文件夹:[code=csharp]
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
  void Start() {

    TextAsset asset = (TextAsset) Resources.Load("filename", typeof(TextAsset));
    print(asset.text);
  }
}[/code]


读取xml:
    public TextAsset AssetText;

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(AssetText.text);

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 4鲜花 +4 +1 收起 理由
mmcluoguan + 1 + 1 神马都是浮云
1287537617aa + 1
aa1287537617 + 1
失落的羽翼 + 1

查看全部评分

发表于 2013-5-6 05:44 | 显示全部楼层

感谢楼主的无私分享!{:soso__11402694654016840197_7:}
发表于 2016-9-23 16:12 | 显示全部楼层
好用吗哇咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔卡
发表于 2017-1-20 16:07 | 显示全部楼层

感谢楼主的无私分享!
发表于 2017-2-9 21:02 | 显示全部楼层
楼主是超人
发表于 2017-2-9 21:17 | 显示全部楼层
好帖就是要顶
发表于 2017-2-9 21:15 | 显示全部楼层
顶顶多好
发表于 2017-2-9 20:56 | 显示全部楼层
难得一见的好帖
发表于 2017-2-9 21:47 | 显示全部楼层
LZ真是人才
发表于 2017-3-6 22:26 | 显示全部楼层
好帖就是要顶
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-29 05:34 , Processed in 0.108061 second(s), 36 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表