Update() Method

Update() Method
– called every frame
– For VR, this might be called 60, 90, or even 120 times per second.

This speed depends on hardware and a variety of software factors

Time.deltaTime
– Gives you smooth framerate-independent animation
– Contains the amount of time it took to render the previous frame
– Changes every frame

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using UnityEngine;
using System.Collections;
 
public class NewBehaviourScript : MonoBehaviour {
 
    // Use this for initialization
    void Start () {
     
    }
     
    // Update is called once per frame
    void Update () {
        if (transform.position.y > 0.5f){
            transform.Translate (0, -2.5 * Time.daltaTime, 0, Space.World);
        }      
    }
}

unity manual
https://docs.unity3d.com/ja/current/Manual/index.html
scripting API
https://docs.unity3d.com/ja/current/ScriptReference/index.html

-Divided into namespaces.
-Namespaces establish a groupings between related objects
-Almost all scripts start with using UnityEngine;
-This gives you access to all the objects in the UnityEngine namespace

Camera.background-Color
https://docs.unity3d.com/ScriptReference/Camera-backgroundColor.html