unity Playmaker文档_unity Playmaker文档

unity 程序员技能

Many teachers around the world struggle with delivering introductory workshops on making games. Tools like Unity are complex pieces of software and offer a wide range of possibilities. However, the Unity editor also assumes that the students know many concepts that are hard to deliver in just a few lessons.

世界各地的许多老师都在努力举办有关制作游戏的入门讲习班。 诸如Unity之类的工具是复杂的软件,提供了广泛的可能性。 但是,Unity编辑器还假设学生知道许多概念,仅在几节课中很难讲授这些概念。

One of my first “missions” as Technical Evangelist at Unity was to present a 2-day workshop to absolute game development beginners in a town near Brighton. The attendees didn’t know Unity before, but had received some lessons in basic programming. As such, the easiest way to introduce them to Unity would be a step-by-step tutorial. But after the first day I decided that this approach wouldn’t allow them to express the creativity I saw they had right away. So on the train back I started working on a small framework that would allow them to build a variety of games, fast, and without necessarily knowing about programming.

我在Unity担任技术布道者的第一个“任务”之一是在布莱顿附近的一个小镇为绝对游戏开发初学者提供为期2天的研讨会。 与会者以前并不了解Unity,但是已经接受了一些基础编程方面的课程。 因此,将它们引入Unity的最简单方法是分步教程。 但是在第一天之后,我决定这种方法将不允许他们表达我立即看到的创造力。 因此,在火车上,我开始研究一个小型框架,该框架使他们可以快速构建各种游戏,而不必了解编程。

The “Unity Playground” was born.

“ Unity Playground ”诞生了。

(Needs and solutions)

When I set off to create the framework, I had a few goals in mind. First, I wanted to teach people that making games can be fun. I wanted to give them the full game creation experience, but at the same time trying not to overwhelm them with the technical concerns that come with it. Most importantly, I didn’t want to constrain their creativity.

完整的游戏创作体验

I also decided it would be cool to allow them to play with the parameters of the game, to allow some sort of game tuning

游戏调整

Another key goal was to minimise my intervention

最大程度地减少我 作为老师的 干预

So I came up with a small framework that revolves around a few cornerstones around which I make every decision:

因此,我想出了一个小型框架,该框架围绕着我做出每个决定的几个基石:

  • A set of one-task Components that are easy to use and mix 一组易于使用和混合的单任务组件
  • Extremely simple scene setup 极其简单的场景设置
  • Physics-based gameplay = more fun! 基于物理的游戏玩法=更有趣!
  • 2D for simplicity (other graphics can be imported from the web) 2D为简单起见(其他图形可从Web导入)
  • Custom Inspectors to perform error detection in the setup 定制检查器在设置中执行错误检测
  • Pre-made UI to visualise health and score 预制的UI可以直观显示健康状况和得分

Going into more detail, the Components are all simple scripts that perform mostly one task, so they can be mixed to produce more refined gameplay. For instance, you can use together the scripts RotateWithArrows and PushWithButton to create a character that rotates with the Left/Right keys and move forward with the Up key, such as a spaceship or a car seen from above.

更详细地讲,组件都是执行大部分任务的简单脚本,因此可以将它们混合在一起以产生更精致的游戏玩法。 例如,可以将脚本 RotateWithArrows 和 PushWithButton 一起使用 来创建一个字符,该字符可以使用向左/向右键旋转, 并 可以使用 向上键向前移动,例如太空船或从上方看的汽车。

Their inspectors are heavily customised with the help of Editor code and provide plenty of guidance in setting up. This component for example shows some tips at the bottom, and will hide the option Look axis if the Orient to direction

定向到方向” 布尔值 ,则将隐藏“ 查找轴

unity Playmaker文档_python_02

(User Interface)

Talking about the UI, I made it a prefab that can be dropped into the scene without any setup. It will accommodate different kinds of gameplay, and will change depending if the game is for one or two players. This is its Inspector:

谈到UI,我把它做成了一个预制件,无需任何设置就可以放到场景中。 它会适应不同类型的游戏玩法,并且会根据游戏是针对一个还是两个玩家而变化。 这是它的检查器:

unity Playmaker文档_游戏_03

And this is how it looks in-game:

这就是游戏中的样子:

unity Playmaker文档_unity Playmaker文档_04

Additionally, it will automatically display a small inventory in the bottom-left corner for games that have objects that can be picked up. In this example, the player has 0 coins and 1 key:

此外,对于具有可拾取对象的游戏,它会自动在左下角显示少量库存。 在此示例中,玩家有0个硬币和1个钥匙:

unity Playmaker文档_python_05

(Conditions, Actions, Attributes)

After the first iteration proposed in the original workshop, I tried to give some structure to the Playground, so I came up with some key groups of scripts that try to serve specific classes of problems.

在最初的工作坊中提出第一轮迭代之后,我尝试为Playground提供一些结构,因此我提出了一些关键的脚本组,试图解决特定类别的问题。

At the heart of the framework are the Conditions, which are basically if statements made components. They check for a specific condition and, if this is verified, execute some actions. The Condition scripts available for now are Area Conditions (basically triggers, enter, exit, and stay), the Collision Condition (fires on collision), and a configurable Key Condition to capture input. More may be added in the future.

该框架的核心是 Condition ,基本上是 如果语句 构成组件的条件。 他们检查特定条件,如果经过验证,则执行一些操作。 现在可用的条件脚本是 区域条件 (基本上是触发器,进入,退出和停留), 碰撞条件 (碰撞时触发)和可配置的 关键条件, 用于捕获输入。 将来可能会添加更多。

In the first iteration, I grouped the actions under an UnityEvent. Despite its power though, the UnityEvent block in the Inspector is huge and complicated to setup, because it exposes ALL the public properties and methods of the target objects:

在第一个迭代中,我将动作归为一个UnityEvent。 尽管具有检查功能,但Inspector中的UnityEvent块仍然庞大且设置复杂,因为它公开了目标对象的所有公共属性和方法:

unity Playmaker文档_游戏_06

So, I decided to implement a series of mini-scripts that contain one action. Conditions now have a simplified block (made with the useful ReorderableList, check it out on Valentin’s blog!) where you can connect them easily by drag-and-drop. I grouped these scripts under the name Gameplay Actions, and they all implement the IGameplayAction

因此,我决定实施一系列包含一个动作的微型脚本。 现在,条件有了一个简化的块(使用有用的ReorderableList制成,请在 Valentin的博客 上查看 !),您可以通过拖放轻松地将它们连接起来。 我将这些脚本归类为 Gameplay Actions ,它们都实现了 IGameplayAction

Following this simplification, a ConditionKeyPress Inspector with the Gameplay Actions block looks like this:

经过这种简化,带有Gameplay Actions块的ConditionKeyPress Inspector如下所示:

unity Playmaker文档_unity Playmaker文档_07

The bool Use custom actions

使用自定义动作

Finally, some scripts are grouped under Attributes, as they effectively work as if they were mere properties of an object. For instance, adding a Resource Attribute to an gameObject makes it an object that can be picked up and stacked, shown in the UI as an icon or amount, and later on consumed by a ConsumeResource GameplayAction script.

最后,一些脚本被归类为 Attributes ,因为它们有效地工作,就好像它们只是对象的属性一样。 例如,将 资源 属性 添加 到gameObject使其成为可以拾取和堆叠的对象,在UI中以图标或金额显示,然后由 ConsumeResource GameplayAction脚本使用。

(Example games)

The Scenes

幕后

The Defender

后卫

unity Playmaker文档_编程语言_08

Football game is a 2-player football game that shows how to use ConditionCollision scripts to setup goals, and reset players and ball position when the players score a goal. 足球

unity Playmaker文档_unity Playmaker文档_09

The Maze game shows the use of Collectables (for the coins), how to setup Area Conditions, and load another level through the LoadLevelAction.

迷宫 游戏节目使用藏饰的(对硬币的),如何建立区域条件,并加载通过另一个层面 LoadLevelAction 。

unity Playmaker文档_java_10

The Lander

各州

unity Playmaker文档_游戏_11

Finally, the Roguelike

Roguelike

unity Playmaker文档_java_12

I suggest to remove the example games before distributing the framework, so that users won’t see them. We said this framework was made to make their imagination go wild, right?

我建议在分发框架之前删除示例游戏,以免用户看到它们。 我们说这个框架是为了让他们的想象力变得疯狂,对吧?

(Try the framework!)

Together with the rest of the evangelism team at Unity we have decided to release the Playground on Github. You can clone the repository, modify it in any way, and use it in your workshops.

我们与Unity的其他布道团队一起决定 在Github上 发布Playground 。 您可以克隆存储库,以任何方式对其进行修改,然后在您的工作室中使用它。

I’m still working on the framework, trying to balance the addition of new scripts and possibilities while still keeping the whole thing accessible and understandable (for both the beginners, but also for teachers!), while keeping the documentation up to date with the changes.

我仍在研究框架,尝试在增加新脚本和可能性之间取得平衡,同时仍使整个内容易于访问和理解(对于初学者而言,对于老师也是如此!),同时使文档与变化。

Keep in mind that the project is maintained only by me, so for suggestions, doubts or (hopefully not) bugs you can ping me on Twitter.

请记住,该项目仅由我维护,因此对于建议,疑问或(希望不是)错误,您可以 在Twitter上 ping我 。

翻译自: https://blogs.unity3d.com/2016/09/20/teaching-unity-to-non-programmers-playground-project/

unity 程序员技能