如何从Unity中的StreamingAssets文件夹加载textasset

时间:2018-11-24 21:21:49

标签: c# unity3d

您好,当文件位于资源文件夹中时,我正在尝试将文件作为文本资源加载

    var a = new ScreenerPage();
    a.onScreenListChange();

工作顺利

但是当我尝试从该文件夹(streamingAssets文件夹)外部加载文件时,出现此错误消息

 TextAsset asset1 = (TextAsset)Resources.Load(Filename, typeof(TextAsset))

Unity建议我使用它,但是它也不起作用

 TextAsset asset1 = (TextAsset)Resources.Load(Application.streamingAssetsPath + "/" + Filename, typeof(TextAsset))
 >NullReferenceException: Object reference not set to an instance of an object

有关如何从streamingassets文件夹导入文本资产的任何想法,将在发行版中使用,因此仅编辑器解决方案是不可行的

谢谢

0 个答案:

没有答案