约定和语法

Tutorial

Beginner

+0XP

5 mins

404

Unity Technologies

约定和语法

了解编写代码的一些基本约定和语法:点运算符、分号、缩进和注释。

本教程包含在“初级编程”项目中。

上一教程:变量和函数

下一教程:If 语句

Languages available:

1. 约定和语法

using UnityEngine;
using System.Collections;

public class BasicSyntax : MonoBehaviour
{
    void Start ()
    {
        Debug.Log(transform.position.x);
        
        if(transform.position.y <= 5f)
        {
            Debug.Log ("I'm about to hit the ground!");
        }
    }
}

Complete this Tutorial