A simple save system in Unity

Saving game data is a task that I need regularly. Using serialization and writing data to a file is an approach that I have used much, but that does not work in WebGL builds. Instead, I wrote data in a PlayerPrefs string. In this way I do not need to keep a details about whatContinue reading “A simple save system in Unity”

Tutorial: 1st-person sneak in Unity 5, part 8

It is time to create a start menu for the game. For that, we need a scene. After creating the scene, rename the scene file to “start_screen” or something like that. (Scroll down for the links to previous parts of this tutorial.) Add the scene to the build settings (File->Build Settings…) Make sure that start_screen sceneContinue reading “Tutorial: 1st-person sneak in Unity 5, part 8”

Tutorial: 1st-person sneak in Unity 5, part 5

This part adds logic for the PC and keep track of things such as health, dying. I also add functionality for invisibility (that have already partly added in Guard class).  I also add HUD using the new GUI system to show health and energy (that is used to maintain invisibility). Previous parts: part 1 partContinue reading “Tutorial: 1st-person sneak in Unity 5, part 5”

Testing Public Variables in Unity

Edit 2012/12/08: A bug fix (End() did not show correct error count); change reporting: now EndCase() and End() use Debug.LogError() fuction in reporting if there were errors (otherwise Debug.Log() is used). It is easy to forget to set a public variable of a script in Inspector and it might take some time to figure out whereContinue reading “Testing Public Variables in Unity”

Unity Examples

EDIT 20130525: updated links to Escape package. I have created a small Unity package for teaching unity basics. You can download it at http://www.mediafire.com/download/y5i38txo42fj8i3/escape.unitypackage.zip (requires Pro, as it uses Image Effects and Sound Effects). http://www.mediafire.com/download/2bdmrn5j4vcikpa/escape_stripped.unitypackage.zip (work in free). To use this create new unity project (File->New Project…). Select  Toon Shading (and Image Effects if you have Pro) package(s) before creating theContinue reading “Unity Examples”

Simple Perception System (Unity, C#)

Here is a very simple perception C# code that I used my lecture today for Unity. Function that can be added to the Enemy class to check if the enemy sees the player object or not (the code for other functionality can be found on the post /2011/10/29/intro-to-gameplay-programming-with-unity/). With this code, an enemy can perceiveContinue reading “Simple Perception System (Unity, C#)”

Intro to Gameplay Programming with Unity

This post contains an solutions  to my Unity programming exercises and classes I showed at the lectures. This post cover coding following game logic: a waypoint track an agent following a waypoint track display two meters  for energy and health collectable powerups for gaining health and power

Intro to Unity GUI

This post contains an solutions  to my Unity programming exercises and classes I showed at the lectures. This post cover coding some basic things about using Unity GUI system. StartScreenGUI (C#) This class creates simple re-sizable and skinnable start screen for a game with main screen, credits screen, and confirm screen for quitting. The mainContinue reading “Intro to Unity GUI”