Git Product home page Git Product logo

unity-official-tutorials's Introduction

unity-official-tutorials

repository for unity tutorials from the unity site (https://unity3d.com/learn/tutorials)

  • Roll a Ball
    Unity Version: 5.6.1
    Link to tutorial
    Description: Create a simple rolling ball game that teaches you many of the principles of working with Unity. In your first foray into Unity development, create a simple rolling ball game that teaches you many of the principles of working with Game Objects, Components, Prefabs, Physics and Scripting. No asset download required.

  • Space Shooter
    Unity Version: 5.6.1
    Link to tutorial
    Description: Using basic assets provided by Unity Technologies, built-in components and writing simple custom code, understand how to work with imported Mesh Models, Audio, Textures and Materials while practicing more complicated Scripting principles.
    In-game image:
    image
    Improved version (already has powerupps (purple shield in the image, waves, stages and soon will have bosses):
    image

  • Survival Shooter
    Unity Version: 5.6.1
    Link to tutorial
    Description: Learn how to make an Isometric 3D shooter.
    In-game image:
    image

  • UFO 2D
    Unity Version: 5.6.1
    Link to tutorial
    image

  • 2D Unity Guide
    Collection of resources

unity-official-tutorials's People

Contributors

gsoster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

unity-official-tutorials's Issues

Unity Annotations

Commands/shortcuts

Duplicate Object = CTRL + D
Opens reference to documentation = CTRL + '
New Empty GameObject: CTRL + SHIFT + N
Write "inf" in the inspector textboxes transforms the value to Infinity

Projects Settings

Setup Github for Unity Projects: link
Gitignore for Unity: link
Check Infos: Edit > Project Settings > Input


NavMesh to define the walkable areas in the levels.
Event Systems to detect and handle user input and scripted interaction.
Animator state machine to control and play all of the character animations; including idle, walking and interaction.
Prefab system to save the character so it can be easily added and used in any scene in the game.


Scripting

Event functions / Default Mono Behaviour:

Initialization Events

Awake = The Awake function is called for each object in the scene at the time when the scene loads.
(it is called regardless if the script is enabled or not), all the Awakes will have finished before the first Start is called. This means that code in a Start function can make use of other initializations previously carried out in the Awake phase.
Start = The Start function is called before the first frame or physics update on an object.

Regular Update Events

Update = Update is called before the frame is rendered and also before animations are calculated.
FixedUpdate = FixedUpdate is called just before each physics update. It is important to note that the physics updates and frame updates do not occur with the same frequency.
LateUpdate = Runs at a point after the Update and FixedUpdate functions have been called for all objects in the scene and after all animations have been calculated.

Time and Framerate Management

Time.timeScale = Time Scale property that controls how fast game time proceeds relative to real time. It can produce effects like: Bullet time, slow motion or even stop the game.

void Pause() {
  Time.timeScale = 0;
}

void Resume() {
  Time.timeScale = 1;
}   

Creating and Destroying GameObjects

Instantiate = Create/make a copy of an object (the original object doesn't have to be in the scene).

GameObject enemy;
Instantiate(enemy);

Destroy = will destroy an object after the frame update has finished or optionally after a short time delay.

Destroy(enemy);
Destroy(enemy, .5f);//destroys it after short interval
Destroy(this);//destroy the current script and not the GameObject itself!

Attributes

Attributes are markers that can be placed above a class, property or function in a script to indicate special behaviour.
[System.Serializable] = add to class to make public fields visible in the editor.
[SerializeField] = add to private fields to show them in the editor/inspector.
[HideInInspector] = prevent the property being shown in the inspector, even if it is public.
[Range(float,float)] = displays a slider in the inspector using the defined values.
[Tooltip(string)] = provides information in the inspector about the related field/property.
tooltip


UI

Unity UI is based on Canvas.
UI Elements have Rect Transform instead of Transform.
It is good practice to add a canvas group to the main Canvas. Canvas group allows UI elements to have an alpha and it allows you to toggle whether they are interactables.

RENDER MODE = The render mode can be set to Screen Space - Overlay so it will fit the screen; Screen Space - Camera which can have UI perspective and World Space, which is for things that are intrinsically within the 3D scene. So for example you might have a speech bubble popping up from a 3D character.


Objects/Components Behaviours

#rigidbody
-->MovePosition

#Vector3
-->normalized

.setActive(bool); // GameObject
.enabled = bool; // component

Unity's coding good practices

Public variables always before private ones.
Use namespaces to separation of concerns.

To add later:

prefabs brief description;
use of forward instead of addForce;
Input.GetAxisRaw() != Input.GetAxis(): There is difference in the return values, check what it is;

[Space Shooter] Player Healthbar

Add a player healthbar that also displays the shield value. Right now the player is destroyed if touched by an enemy/asteroid without a shield.

Survival Shooter: Walking animation not working

The animation configuration is correct in the Animator window, the transitions exist and are configured as they should. The code in the PlayerMovement script is also correct, still the player doesn't play the walking animation.

[Space Shooter] Structure the HUD

Every Text that is presented on the screen has its own canvas. The HUD is disorganized and it is hard to work and add new features.
It is necessary to create a single canvas element, add a group and organize all the Texts inside it. Also, update the references in scripts to this new approach.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.