Unity
Setting up Unity and Visual Studio
Here is a video about how to setup Unity and Visual Studio
- Install Visual Studio Community 2019 https://visualstudio.microsoft.com/ (C# language and Unity Tools) - you can skip this step for now. When you start installing Unity (step 3) it will ask you if you want to install the correct version of Visual Studio as well.
- Download Unity HUB https://unity3d.com/get-unity/download/
- Install Unity 2021.1.17f1 Personal Edition from hub.
- Make a test project and add a C# script to the Assets folder. Double click on the script to open it in Visual Studio. If on the left top corner it says "Miscellaneous file" then it means that your Visual Studio is not connected properly. If it says "Assembly-csharp" or something similar, then it is OK. In the former case, go to Edit->Preferences->External Tools in Unity and choose Visual Studio as your External Script Editor. Also press the Regenerate project file button. If that did not help, then check your Visual Studio installation to make sure that Unity Tools are added.
First time users
If you are using Unity first time, then I recommend to do the Bird game from Game Dev and Design course before the first practice https://courses.cs.ut.ee/2020/gamedev/fall/Main/Lab1.
Unity introduction
This is a class diagram of Unity's base classes:
![](https://courses.cs.ut.ee/2023/ge/fall/Main/Unity?action=download&upname=UnityClasses.png)
Practice 1
You could use the following asset packs:
Tasks:
- Create a character object with the following components:
- RigidBody2D
- CircleCollider2D
- Movement (custom monobehaviour)
- PlayerInput (custom monobehaviour)
- has annotation [RequireComponent(typeof(Movement))]
- moves the character with WASD keys using Movement script
- Create another character for the enemy with same components
- Instead of PlayerInput, add an AIInput (custom monobehaviour)
- has annotation [RequireComponent(typeof(Movement))]
- moves the character in random direction that changes every 2 seconds
- Instead of PlayerInput, add an AIInput (custom monobehaviour)
- Make characters fight
- Add Health component to all characters (custom monobehaviour)
- Add a ScriptableObject called TeamData and create two assets with it
- Add an annotation [CreateAssetMenu(menuName ="Game/TeamData")]
- Add a name and color variables or the scriptable object
- Create two data assets using this scriptable object
- Use this Team data as an enum in the Health component to determine the character's team
- Move the AI characters towards the closest enemy. (Implement the CharacterController to access them quickly)
- " Destroy the character when health reaches to zero
- Add a floating healtbar to the character
- Add a world space canvas with corresponding subimages
- Add a BarPresenter script to the canavas
- Add a BarPresenter variable to the health component and connect it in the editor
- Make the bar change when health changes
- Decrease the health over time when characters from different teams collide
- Use the team color as the color of healthbar
- Edit the AIInput script so it finds the nearest enemy and moves towards it.
- Extra
- Create a separate fighting script and move all the fighting functionality into it
- Extra:''' Implement stats like attack and defence for fighting.
Play around with the fighting simulation, add more teams and fighters.
Practice 2
Practice 3
Threading by Kristo Männa
Practice 4 consultation
During the consulation you should continue implementing your Unity project. The project can be a remake of a simple classical game like Tetris, Pacman, Space invaders etc. or your own game idea that should not take more than 12h to implement.
Submission
Submit a compiled version of your game (Windows 64 build). Zip your build folder into a single package and make sure that all the additional files and sub-folders (that were created when building the game) are also included in this package. Don't submit your source code.
Deadline: 1.11 (before midnight)