C#

MonoBehaviour (Unity scripts)

Në shqip: Skriptet e Unity-t

ShpjegimiSQ

Në Unity, çdo skript që i ngjitet një objekti të lojës trashëgon nga MonoBehaviour. Start() ekzekutohet një herë kur fillon loja, dhe Update() çdo kuadër (dhjetëra herë në sekondë) — aty lexon tastierën dhe lëviz personazhin.

EnglishEN

In Unity, every script attached to a game object inherits from MonoBehaviour. Start() runs once when the game begins, and Update() every frame (dozens of times a second) — that's where you read the keyboard and move the character.

Si ta mendosh

Start() është si fishkëllima e fillimit të ndeshjes; Update() është si çdo sekondë e lojës, ku lojtarët reagojnë vazhdimisht.

Lexoje në anglisht

Start() is like the kick-off whistle; Update() is like every second of the match, where players keep reacting.

Shembull kodicsharp

public class Lojtari : MonoBehaviour {
    public float shpejtesia = 5f;
    void Update() => transform.Translate(
        Input.GetAxis("Horizontal") * shpejtesia * Time.deltaTime, 0, 0);
}

Terma të lidhur