- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 UnityWebRequest 从服务器下载 assetBundle,它在 unity 编辑器中运行良好,但在 andriod 中它给出空值,有人可以帮忙吗
public IEnumerator DownloadAsset(string url, string assetName)
{
using (UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(url))
{
yield return www.SendWebRequest();
AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
if (bundle != null)
{
AGUIMisc.ShowToast("Not Null");
GameObject temp = bundle.LoadAsset(assetName) as GameObject;
var newobjj = Instantiate(temp);
newobjj.transform.parent = maleparent.transform;
}
else
{
AGUIMisc.ShowToast("Null");
}
}
}
最佳答案
AssetBundle 需要在稍后使用的目标平台中构建。由于您想在 Android 中使用 AssetBundle,因此当您构建 AssetBundle 时,目标平台 也应该是Android。
另请检查:
你应该设置UnityWebRequest.downloadHandler打电话前先UnityWebRequest.SendWebRequest()使用 DownloadHandlerAssetBundle .
public System.Collections.IEnumerator DownloadAsset(string url, string assetName)
{
using (var uwr = new UnityEngine.Networking.UnityWebRequest(url, UnityEngine.Networking.UnityWebRequest.kHttpVerbGET))
{
uwr.downloadHandler = new UnityEngine.Networking.DownloadHandlerAssetBundle(url, 0);
yield return uwr.SendWebRequest();
AssetBundle bundle = UnityEngine.Networking.DownloadHandlerAssetBundle.GetContent(uwr);
if (bundle != null)
{
AGUIMisc.ShowToast("Not Null");
GameObject temp = bundle.LoadAsset<GameObject>(assetName);
var newobj = GameObject.Instantiate(temp);
newobj.transform.parent = maleparent.transform;
}
else
{
AGUIMisc.ShowToast("Null");
}
}
}
关于c# - assetBundle 返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57354408/
在提出问题之前,我将解释我需要什么样的要求。 在我的游戏中,玩它需要很多纹理。由于这一点以及 ipa 大小(iOS)的限制,我认为使用assetbundle 是必须的。因为现有的代码实现,我创建了 A
我正在 Unity 中为 iPhone 开发一个 AR 应用程序,它从网络服务器下载 Assets 包并将它们附加到图像目标。到目前为止,几乎一切正常——除了当应用程序尝试加载 Assets 包时,我
我想在 AR 相机中播放视频。我总共有 10 个视频和一个视频播放器。我正在从服务器下载视频播放器作为名称为 videoplayer.unit3d 的 Assets 包并存储到 SD 卡中。当我扫描
我正在使用 UnityWebRequest 从服务器下载 assetBundle,它在 unity 编辑器中运行良好,但在 andriod 中它给出空值,有人可以帮忙吗 public IEnumera
据此manual我可以将脚本包含为二进制数据并通过反射加载它们。我了解所有步骤,除了一个:如何编译脚本以获取二进制数据以将其存储在 .binary 文件中?有教程/帮助吗? 更新: 实际问题可以重述为
我是 Unity 的新手,我开始在我的项目中使用 AssetBundle 从服务器下载它们。我使用 UnityWebRequestAssetBundle 下载资源,因为 WWW 已过时。一切正常,我可
我有一个非常简单的 AssetBundle: use yii\web\AssetBundle; /** * ImagizerAsset */ class ImagizerAsset extends
我正在做一个项目,它使用 Unity WebGL 以 3D 形式显示不同的机器/零件/..,这些零件或机器由用户选择,然后加载到场景中(目前只有一个场景,但我们可能还想动态加载场景)。 由于有大量选择
我无法在 iOS 构建中使用 Unity Assetbundle。 在 Unity 中我构建了 Assets 包: using UnityEditor; public class CreateAsse
编辑: 这个问题是关于使用 AssetBundle 的,而那个问题 ( List of files in flutter ) 是关于使用目录的。它们因类别不同而不同。另外:我删除了一个部分,它可能与上
题: 我想在完成下载文件之前获取 assetBundle 的大小。我可以向用户显示剩余时间。在Unity2018.2中,我们可以得到吗?文件大小 或 下载文件大小 让我乘以 进度 ?或者还有其他方法来
我对来自 unity 的 Assets 包有疑问。我有一个包含多个 Assets 的 bundle ,名称相同但扩展名不同,例如 bonus.png bonus.prefab。 当我尝试实例化一个名为
本文介绍了使用 Yii2 AssetBundle 中 $publishOptions 的正确姿势,分享给大家,具体如下: 官方文档:http://www.yiiframework.com/doc-
很难找到有关 AssetBundles 实际工作原理的大量信息。找不到任何有关如何通过游戏构建管理资源包的说明。 基本上,我的项目窗口中有一个名为 AssetBundles 的文件夹。我放入此文件夹中
我已将一些迷你游戏分离到另一个项目中,以便将它们全部加载到一个项目中。我已经使用Unity 2018.4.9版本成功创建了资源包并将它们放入StreamingAssets文件夹中。 Unity编辑器成
我正在尝试为我目前正在开发的游戏测试一些 AssetBundle。我想使用它是因为我不想让游戏占用太多空间。我仍然不知道服务器如何工作以及如何将它们上传到那里。我正在搜索如何执行此操作,并在此处找到了
我试图在运行时将一个已经创建的 FBX 对象加载到场景中,我四处搜索并发现可以使用 assetbundle 来执行此操作。我试过这段代码,但它似乎没有实例化场景中的对象,也没有弹出错误。 这是代码 u
我想知道 AssetBundle 已经在缓存中。这通常通过 Caching.IsVersionCached 函数完成。 Unity 2017.1 不再支持 Caching.IsVersionCache
我正在以这种方式使用我的 AppAsset。 AppAsset.php .但是,没有 type='text/css' . 如何添加type='text/css'我所有的 CSS? 最佳答案 @Mop
我的托管帐户存在写入权限问题。在布局文件中添加脚本和链接标签而不是使用AssetBundle或registerJs可以吗? 有什么优点和缺点? 编辑: 我正在使用 Google App Engine,
我是一名优秀的程序员,十分优秀!