Advanced Concepts

Revisado con versión: 2017.4


Dificultad: Principiante

Are you a teacher or educator? This section is a must-read for you! Also suggested for advanced users who want to understand the Playground better.


It might be hard to understand how many scripts are in the Playground at first glance. For this, the Playground comes with a series of "cheatsheets", which consists of 6 pages with the icons for all of the scripts and a one-line description. They are organised in categories (Movement, Gameplay, etc.) and are colour-coded.


A preview of some pages

The Cheatsheets are included in the Unity project in both .pdf, for printing, and individual .jpgs for the screen. In workshops with users very new to Unity, it might be nice to print out a few copies and bind them together, to give the users a sense of the scope and show them all the possibilities they have.

In addition to these, a seventh page features some extra challenges of different nature. If you are running a workshop, you can use these to encourage participants to try something new, or give them constraints (kind of like the theme of a game jam).

Project Structure

To use the project in a workshop, you can either have people download it from the Asset Store (free of charge) or, if internet access is an issue, you can manually distribute the Assets and ProjectSettings folders to the students.

Assets folder

The Documentation folder contains documentation in .pdf, including this very document. You can use this "Getting Started" doc as a starting point, then dig into the details of each script by opening the “Reference Guide”. Finally, the “Cheat Sheets” is a document you can print out and distribute to the learners, so they can have a quick glance at the scripts and what they do, for inspiration.

Images and Particles folders contain graphic assets which could be used as character, enemies, or to compose the scene, but the developers are free to import new graphics if they so desire.

The heart of the Playground, the scripts, is located in the Scripts folder organised by category. Most of them should work out of the box, although some require objects to be tagged in a specific way to work (read more about them in the Tags section below.

There’s also a folder called Examples, in which you can find a handful of little games already made. You can use them as learning material, or as a starting point to customise.

There’s a "special" folder in the project called INTERNAL. As the name implies, it shouldn’t be touched unless you want to mess with the inner workings of the Playground. It contains base scripts, fonts, gizmos, and other things that students shouldn’t really care about. It needs to be in the project though, for the Playground to work correctly.

This section goes a bit deeper into some of the parts of the Playground, to better understand its inner workings. Recommended for educators who have to assist students and fix problems in their games.


Tags are used by some scripts to filter objects and decide when to produce their effects. Some scripts filter objects OnCollisionEnter2D or OnTriggerEnter2D, while others (like HealthSystemAttribute) behave differently depending if the object is tagged as Player or not.

If you import the ProjectSettings folder at the start, some extra tags are already defined. Specifically:

  • Player and Player2 have to be used on the two players to enable the UI to work properly, damaging of players, scoring points, etc.

  • Enemy, though not currently used in any script, is useful to define enemies on which to apply the effects of bullets and weapons.

  • Bullet for projectiles.

  • Ground used for checking what is ground when the player jumps.

With the exception of the Player tags, many scripts allow you to define which tag to look for. For instance, the Jump script asks you to define what is considered ground, so you don’t necessarily need to chose the "Ground" tag. Take them only as a suggestion.

You can filter Tags in Condition scripts, so you can have something happen only when you collide with objects tagged in a certain way, etc. The tag list updates automatically to show the whole list of Tags so there's no possibility of making typos.

User Interface

The UI is implemented in a prefab, contained in the Prefabs folder. By just dragging the UI into the scene, you automatically get health and score displayed for Player 1, but you can also choose that the game is for 2 players, and then score or health will be displayed for both players, depending on which game mode.


The UI Canvas against an empty Scene background

The UI also allows to define the type of game, between Score, Life and Endless. Depending on the condition, the Game Over and You Win screens will be displayed:

  • In Score mode, if the Player reaches the score chosen, the Win screen will be displayed. When two players are present, the UI will only display scores and the first one to reach the score wins.

  • In Life mode, if the player reaches 0 health, Game Over will be displayed. With two players, the health of both is displayed. There’s no way to win.

  • In Endless mode, no end game screen will be displayed and there’s no way of winning or losing the game.

Custom game types

When using Condition scripts, you can wire the GameWon and GameOver functions of the UIScript to a UnityEvent. This way, you can create custom win and lose conditions by leveraging collisions and other events.

Similarly, you can tap into the AddOnePoint and RemoveOnePoint functions to do the same with score.

Custom Inspectors

Unity Playground makes heavy use of custom Inspectors, both for the Playground’s own scripts (Move, Jump, etc.) and the default Unity Components (Transform, Collider, SpriteRenderer etc.). The goal is to remove some complexity from the Unity UI, giving an easier time to new users.

For this reason, some variable names have been changed too (i.e. Drag in the Rigidbody2D has been changed to "Friction").

Disabling the Playground

You can turn the custom Inspectors on and off from the top menu bar. This allows you to visualise what the Playground scripts are hiding. You can always make your changes, and then turn the Playground back on. Since Playground is only customising Inspectors, it will keep working fine.


Turn Playground off from the top menu bar

This trick is recommended for teachers who need to temporarily make changes to properties that the Playground is hiding (for instance, editing the shape of a Collider of any type).


Included in the graphic assets there is a series of tile Sprites (grass, cobblestone, wood) that have been used to build the example games, and that you can use to build your own levels using Unity’s Tilemap feature.

If you want to know more about Tilemap, you can find a detailed guide in the Unity Manual.

The Learn website is also full of good tutorials about it: we recommend starting with the Intro to 2D World Building video, or you can find a short text explanation in the Painting a Level section from the 2D Gamekit.