游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

开发者分享项目如何使用Unity工具

发布时间:2014-03-22 11:08:08 Tags:,,,

作者:Alistair Doulin

我们在Bane Games对Unity这一工具情有独钟。有许多人问我们使用什么工具,如何配置我们的项目。今天我就简要概括这一内容,希望也能听听大家推荐的第三方工具,以及你们如何用Unity制作游戏。

第三方工具

我们喜欢Asset Store并认为它是Unity最大的卖点之一。我认识不少Asset Store开发者对这一工具的评价极高,尤其是在扩展Unity和创收这方面的开发易用性。我们有4种主要使用工具。

2D Toolkit

2D Toolkit(from moddb.com)

2D Toolkit(from moddb.com)

我们的头三款游戏使用了我所创造的简单渲染系统。虽然这很适用于我们的前几款游戏,但这是我想利用他人的技术以便我们访问批处理、更健全的动画以及一般性能提升的主要领域之一。在2013年的一些调查之后,我发现2D Toolkit就是三大主要竞争者之一。经过一些试验,我发现它正是我们所需的工具。

我们开始使用2D Toolkit开发一系列原型以筛选下一个游戏项目。我们现在已经完全掌握了这一工具,并使用它来制作原型和完整的游戏开发(例如《Battle Group 2》,简称BG2以及我们的太空游戏)。我们发现它很易于使用,几乎没有漏洞,并且极具表现性。

随着Unity 2D系统的问世,我们将在开发下一款游戏时使用自己的选择。经过一系列快速调查我发现2D Toolkit超越了我们的一切需求,并且还进行更新,使用了Unity 2D的一些新功能,例如排序图层和2D视口。

NGUI

Unity中的GUI支持在对于2011年刚开始开发游戏时的我来说一直是个问题。当我谈到Unity时我就会习惯性地将它列为数项负面开发问题之一,到2014年时它成了唯一未能解决的问题。我们期待Unity在未来数月的新GUI系统,但目前最佳选择却是NGUI。

我试过了Asset Store中的每一个GUI库,不幸的是我还没有发现满意的GUI。NGUI是最佳选择,但是我们对它也存在大量问题(游戏邦注:例如地图集中的图像精灵交换位置没有在游戏中更新)。我们希望这些情况能够得到改善,也会在自己的太空游戏中评估Unity的新GUI系统。

Autopilot

Autopilot对于任何瞄准iOS平台的开发者来说都是无价的工具。它整合了TestFlight,允许开发者一键点击发布一个模版。我们曾花了20多分钟创建一个模版并上传到TestFlight,现在可以自动完成这整个过程了。

我向任何面向iOS开发内容的人强烈推荐TestFlight以及AutoPilot。

UnityVS

UnityVS对于任何在开发Unity游戏过程中将Visual Studio作为主要IDE的人来说都是一项重要工具。UnityVS允许你将一个调试器附加到Unity,两者设置断点并单步调度代码。它并不支持调试器的完整功能(例如更改电源执行线)但它确实完成了调试所需的大量任务。它是找到代码漏洞的标准Debug.Log()的出色替代性选择。它与Unity和Visual Studio的整合相当妥当,尽管还是存在一点小怪癖。

项目结构

我们的项目结构与周围所知的人的Unity设置相比显得相当标准。我们将场景、脚本、图片等元素打入特定目录以尽量在项目发展过程中保持条理性。我们还使用了一些我认为值得一提的关键技巧。

单个场景文件

我喜欢将场景文件数量控制在最小范围内。如果有可能的话,我们习惯将主菜单、游戏内部和暂停状态纳入单个场景中。这让我们得以完全控制关卡之间的加载时间,并让我们无缝隙地从游戏切换到菜单。我们过去在制作原型的过程中曾因此获得成功,但BG2会成为我们使用单个场景的首款发布游戏。

除了单个游戏场景,我们还有一个简单的启动画面,以便确保能够在iOS要求的时间内载入内容,这样我们的应用才不会被中止。我们通常还有一个展示公司logo和电影的介绍电影场景。

开发过程中的多场景文件

单个场景文件设置的一个注意要点就是,我们在开发过程中将菜单和游戏内部状态划分成不同场景。当Menu.scene处于编辑状态时,我们就使用LoadLevelAdditive()载入游戏内部状态。这得以让我们在快速访问玩法,而无需通过InGame.scene文件处理菜单的情况下,从Menu.scene中体验完整的游戏。

全局目标

我们有一个用于存储游戏中相关共享目标的“Global Object”GameObject。这可以在无需在运行时间中查找,就能让多个GameObject分享一个引用,并允许你在无需记住和找到每个访问它们的GameObject的前提下更改引用到单个场所中的目标。

未来计划

我们目前还有一些未能使用,但会在未来项目中运用到的计划。

单元测试

Unity最近发布了一系列单元测试功能。我是单元测试和Test Driven Development(TDD)的超级粉丝,这也是游戏开发落后其他软件开发的领域之一。对于我们使用MVC模式的项目,我尽量使用TDD。我认为内置单元测试功能可以填补这个空缺,并允许我们的更多代码在未来进行单元测试。我们还没有开始使用这一方法的唯一原因就在于,它对我们来说太新了。

Asset Store工具

我习惯将我们内部使用的一些工具推向Asset Store销售。这可以促使我将它们制作得更健全,并令我们所完成的工作产生二次收益。正如我之前所言,我从自己的好友听说过一些向Asset Store发布产品的好处,我将其视为回馈Unity社区的一个绝佳途径。

总结

这是我们第4款游戏如何使用Unity的快速总结。你推荐哪些第三方工具呢?你如何布署自己的Unity项目,对其他开发者又有什么建议呢?(本文为游戏邦/gamerboom.com编译,拒绝任保不保留版权的转载,如需转载请联系:游戏邦

How We Use Unity

by Alistair Doulin

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.

The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

Battle Group 2 EditorWe’re using Unity exclusively at Bane Games and are absolutely loving it. I get asked a lot about what tools we use and how we lay out our projects. Today I discuss this briefly and would love to hear about the 3rd party tools you recommend and how you make your games in Unity.

3rd Party Tools

We love the Asset Store and think this is one of the big selling points of Unity. I know a couple of Asset Store developers and they speak highly of the ease of development when extending Unity as well as the revenue generated. There are four main tools we use.

2D Toolkit

Our first three games used a simple rendering system that I created. While this worked well for our first few games, it was one of the main areas I wanted to make use of someone else’s technology to give us access to atlasing/batching, more robust animations and general performance improvements. After some investigation back in 2013 I found that 2D Toolkit was one of the two or three major contenders. After some experimentation I found it to be exactly what we were after.

We began using 2D toolkit for a number of prototypes we were developing as we decided on the next game to create. We have now embraced it fully and are using it both for prototyping and the full games we are working on (Battle Group 2 (BG2) and our space game). We’ve found it easy to use, almost entirely bug free and extremely performant. We’ve gone from 90+ draw calls in Battle Group 1 (which used my custom, simple, rendering system) to less than 10 in Battle Group 2.

With the release of Unity’s 2D system we will access our options when we begin work on our next game. After some quick investigation though I’ve found that 2D Toolkit overs everything we need and has been updated to make use of some of the new features in Unity’s 2D, such as sorting layers and the 2D viewport.

NGUI

GUI support in Unity has been an issue for me from the time I started developing in it in 2011. When I used to give talks on Unity I would list it among the few negatives to development and as of 2014 it’s the only remaining issue that has not been resolved. We can expect Unity’s new GUI system in the coming months, but until then, the best choice is NGUI.

I’ve tried every GUI library on the Asset Store and unfortunately I have not found one I’m happy with. NGUI is the best of the options, however we are having a bunch of issues with it (such as image sprites swapping place in the atlas without updating in game). We’re hoping things will improve in time and we will definitely be reviewing Unity’s new GUI system for our space game.
Autopilot

Autopilot is invaluable for anyone who targets iOS. It integrates with TestFlight and allows you to publish a build with a single click. Where we used to take ~20 minutes to make a build and upload to TestFlight, we can now complete the whole process automatically. I highly recommend Test Flight and AutoPilot to anyone who requires build to be created for iOS.

UnityVS

UnityVS is an invaluable tool for anyone who uses Visual Studio as their primary IDE while developing Unity games. UnityVS lets you attach a debugger to Unity as it runs on your development PC and both set breakpoints and step through the code. It doesn’t support the full functionality of the debugger (such as changing current source execution line) however it does do the majority of tasks required for debugging. It’s a great alternative to the standard Debug.Log() way of finding bugs in code. It integrates well with Unity and Visual Studio and despite it’s minor quirks is highly recommended.

Project Structure

Our project structure is fairly standard from those I’ve talked to about their Unity setup. We break scenes, scripts, images, etc up into specific directories to keep things as organized as possible as the project grows. There are a few key techniques we use that I think are worth mentioning.

A Single Scene File

As much as I can, I like to keep the scene file count to a minimum. When possible we like to have a single scene for the game including main menu, in-game and pause states. This gives us full control over load times between levels and lets us seamlessly switch from game to menu. We’ve had success with this in the past during our prototypes, however BG2 will be our first published game that uses a single scene.

In addition to this single game scene, we do have a splash screen that is as simple as possible to make sure it loads within the required time on iOS so our application is not termianated. We also usually have an intro movie scene which displays our intro logos and movie.

Multiple Scene Files During Development

One caveat to the single scene file setup is that we do break the menu and in-game up into separate scenes during development. We use a LoadLevelAdditive() to load the in-game in when the Menu.scene file is being edited. This allows us to play the full game from the Menu.scene while still quickly accessing the gameplay without bothering with the menu through the InGame.scene file.

Global Object

We have a “Global Object” GameObject that is used for storing references to shared objects within the game. This allows multiple GameObject’s to share a reference without having to look them up at run-time and allows changing the object referenced in a single place without having to remember and find every GameObject that accesses them.

Future Plans

There are a few things we’re not currently using that we would like to begin using on future projects.

Unit Testing

Unity has recently released a sweet of unit testing functionality within Unity. I’m a huge fan of Unit Testing and Test Driven Development (TDD) and it’s one of the areas game development has lagged a long way behind other software development. For our projects that use the MVC pattern I’ve used TDD as much as I can with great success. I see the built-in Unit Testing functionality filling the gap and allowing much more of our code to be unit tested in the future. The only reason we haven’t begun using this is that it’s too new for us to have adopted yet.

Asset Store Tools

I would like to roll up some of the tools we use internally and offer them for sale on the Asset Store. This will encourage me to make them as robust as I can as well as generate some secondary income from the work we’ve completed. As I mentioned previously, I’ve heard good things from my friends that have released products on the Asset Store and I see it as a great way of giving back to the Unity community.

Conclusion

This is a quick wrap up of how we are using Unity for our 4th title in the engine. What 3rd Party Tools do you recommend? How do you lay out your Unity Projects and what tips do you have for other developers?(source:gamasutra


上一篇:

下一篇: