gpt4 book ai didi

ios - 在 iPad App 中动态加载 3D 模型

转载 作者:行者123 更新时间:2023-11-29 03:30:47 46 4
gpt4 key购买 nike

我需要创建一个 iPad 应用程序,它可以从服务器动态(从 URL)加载 3D 模型(使用 Unity 创建)并显示。在编译期间,3D 对象不会位于应用程序内部。

请指导我,有哪些选项可用于执行此操作,以及我应该查看哪些库/技术?我见过 iSGL3D Nineveh、Cocos3D 等库。但我不确定如何在运行时加载对象。

  • 我可以使用 WebService 来完成此操作吗?
  • 或者使用 Unity Asset Bundle?
  • 或者还有其他更好的方法吗?

================================================== ====

从我得到的回复来看, Assets 捆绑似乎是实现这一目标的方法。因此,我创建了一个 Unity 项目,然后使用它创建了一个 iOS 项目,并能够测试基础知识。

现在我想将其与我现有的应用程序集成。这是在 XCode 5 中使用 ARC、storybords 和 coredata 等。

从 Unity 创建的 iOS 项目未使用 ARC。因此,当我尝试集成这两个项目时,我遇到了单独运行这两个项目时不会遇到的不同错误。

我尝试为项目启用 ARC,并使用 -fno-objc-arc 从 Unity 相关类禁用 ARC。但仍然存在不同类型的错误。

所以我觉得有更好的方法来做到这一点。您能告诉我将 Unity 创建的项目与另一个 iOS 项目集成的最佳方法是什么吗?如果有任何文档或教程,将会非常有帮助。

最佳答案

当然可以!第一步是将 Assets 打包成 Assets 包:

In some situations, it is useful to make an asset available to a project without loading it in as part of a scene. For example, there may be a character or other object that can appear in any scene of the game but which will only be used infrequently (this might be a "secret" feature, an error message or a highscore alert, say). Furthermore, you may even want to load assets from a separate file or URL to reduce initial download time or allow for interchangeable game content.

An Asset Bundle is an external collection of assets. You can have many Asset Bundles and therefore many different external collections of assets. These files exist outside of the built Unity player, usually sitting on a web server for end-users to access dynamically.

查看完整的 Unity 开发人员知识库 article on Asset Bundles here .

一旦您学会了如何将 Assets 打包到包中,您就可以使用以下示例代码轻松加载它们以在运行时使用:

function Start () {
var www = WWW ("http:/myservermyBundle.unity3d");
yield www;
// Get the designated main asset and instantiate it.
Instantiate(www.assetBundle.mainAsset);
}

查看完整脚本引用 here获取更多信息。

关于ios - 在 iPad App 中动态加载 3D 模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19817684/

46 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com