在 iOS 中将 Unity 生成的代码与 Objective-C 混合?

发布于 2024-10-04 11:16:36 字数 235 浏览 2 评论 0原文

是否可以将 iOS 代码和界面元素与 Unity 生成的 iOS 代码混合在一起?

例如,如果我正在与一位正在 Unity 中开发游戏的游戏开发人员合作,我可以采用他的 xCode 项目(由 Unity 生成),并添加我自己使用 Objective-C 和 XCode 编写的界面元素吗?界面生成器等?

据我所知,这是不可能的,因为一切都是通过 Unity 创建的......但希望我错了......

谢谢!

Is it possible to mix iOS code and interface elements with Unity generated iOS code?

For example if I am working with a game developer who is developing a game in Unity, could I take his xCode project (generated by Unity), and add interface elements which I code myself using Objective-C & Interface Builder etc?

From what I can see this isn't possible as everything is created via Unity.... but hopefully I am wrong...

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

柠檬色的秋千 2024-10-11 11:16:36

您甚至可以在 XCode 中使用第 3 方库并将它们集成到构建过程中。在摆弄正确的设置后,我写了一篇关于此的博客文章:

iPhone & Unity3D:在 Unity3D 生成的 XCode 项目中集成第 3 方静态库

You can even use 3rd party libraries in XCode and integrate them in the build process. After fiddling around with the right settings I wrote a blog entry about this:

iPhone & Unity3D: Integrating 3rd Party Static Libraries in Unity3D Generated XCode Projects

鹤仙姿 2024-10-11 11:16:36

您应该能够生成本机插件来与 Unity 代码交互。不过,您需要编写一个包装器。了解更多信息:http://unity3d.com/support/documentation/Manual/Plugins.html

阅读 iOS 上的部分:)

You should be able to generate Native plug ins to interact with the Unity code. You would need to write a wrapper though. Read more at: http://unity3d.com/support/documentation/Manual/Plugins.html

Read the part at iOS :)

三人与歌 2024-10-11 11:16:36

我发现了这个在 OSX 中使用 Unity 原生插件的一般指南,它很有用,并且可能是您需要寻找答案的地方,正如 Zophiel 所说

https://blog.reigndesign.com/blog/unity-native-plugins-os-x

I came across this general guide to working with Unity native plugins in OSX which was useful and is probably where you need to be looking for your answer, as Zophiel said

https://blog.reigndesign.com/blog/unity-native-plugins-os-x

情深已缘浅 2024-10-11 11:16:36

你可以只设计一个视图和按钮来触发unity运行或停止,但是unity中的模型不能使用Obj-C来控制,虽然unity已经导入到Xcode,但它只导入启动代码,游戏脚本取决于无法修改的链接库。

You can just design a view and button to trigger the unity to run or stop, but models in unity can't be controlled using Obj-C, although unity has import to Xcode, it only import the start code, game scripts depending on the link libraries which couldn't be modified.

朕就是辣么酷 2024-10-11 11:16:36

我认为您可以像我使用 Objective-C 一样进行操作,无需任何更改。 Unity 的代码生成器保留了类下的本机代码。

此外,还有另一种方法可以做到这一点,称为“插件”。

但我希望Unity的开发者能够像Apple的员工一样找到更好的与Xcode无缝结合的方式。

将IB和Unity的集成编辑器结合起来,将来会更好,更受欢迎。

I think you can do it as the same way I probably has been working with Objective-C without any changes. For Unity's code generator preserves the native codes under Classes.

And furthermore there is an another way to do this which is called "Plug-in".

But I hope the developers in Unity find a better way seamlessly combined with Xcode as staffs in Apple usually does.

Combining IB and Unity's integrated editor would be better and more welcomed in future.

把昨日还给我 2024-10-11 11:16:36

可能是的。适合初学者或中级开发人员吗?可能不会。每次推送构建时都会生成并重新生成 Unity 项目。现在我相信,如果您在构建时使用 Append,它应该保留对 Xcode 项目的现有更改......但“应该”是那里的操作词。如果您尝试在一个大型项目中执行此操作,并且在该项目中您会看到来自 Unity 端和 Xcode 端的持续更新流,那么您可能需要实现像 Jeeves 这样的某种构建系统,以将麻烦降到最低。

现在,如果您要集成位于其自己的文件中的代码,并且不会重叠或重写 Unity 生成的代码,那么追加功能确实适合您,但如果您要删除、更改或添加代码到 Unity 生成的任何文件,然后在每次新的 Unity 重新编译/Xcode 生成之前和之后肯定会使用 SVN 或某种其他形式的源代码控制和快照。

另外,请查看 Unity 资源商店。无论您尝试在 Xcode 中实现什么功能,都可以在 Unity 上用 C# 编写。其他人可能已经解决了您要解决的问题,并以 5 美元的价格将其放置在资源商店中。

希望有帮助。

Possible yes. Advisable for beginner or intermediate level Devs? Probably not. The Unity project is generated and regenerated every time you push a build. Now I believe that if you use Append when you do builds that it should keep existing changes to the Xcode project... but 'should' is the operative word there. You may need to implement some sort of build system like Jeeves to keep the headaches to a minimum if you are trying to do this on a large project in which you for see a constant stream of updates from both the Unity side and the Xcode side.

Now if you're integrating code that is in it's own files and doesn't overlap or rewrite the code Unity has generated, then the Append feature is really going to work for you, but if you're deleting, altering, or adding code to any of the files that Unity generated then definitely use SVN or some other form of source control and snap shot before and after every new Unity recompile / Xcode generation.

Also, take a look in the Unity Asset store. Whatever functionality you are trying to home brew in Xcode can definitely be written in C# on Unity. Someone else may have already conquered the problem you're trying to solve and placed it in the asset store for $5.

Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文