Unity3D中插入C#脚本

1.打开项目,project下新建一个名叫scripts的文件夹。(注意,在Unity3D中,包含script的文件夹必须有script的关键字)请输入图片描述
2.在scripts文件夹下新建一个C#脚本。请输入图片描述

3.代码如下。请输入图片描述

using UnityEngine;
using System.Collections;

public class move : MonoBehaviour {
    public float speed = 40;
    public float rotSpeed = 40;

    // Use this for initialization
    void Start () {

    }   

    // Update is called once per frame
    void Update () {
        print (Time.deltaTime);
        transform.Translate (new Vector3 (0, 0, speed * Time.deltaTime));
        transform.Rotate (new Vector3 (0, rotSpeed * Time.deltaTime));
       }
}

4.把C#脚本添加进要运行脚本的层级。请输入图片描述请输入图片描述
5.点击运行请输入图片描述请输入图片描述请输入图片描述

标签: Unity3D, 游戏, C#
返回文章列表 文章二维码
本页链接的二维码
打赏二维码
Title - Artist
0:00
    bst g22 jinniu lilai opebet orange88 vinbet xbet yuebo zunlong shijiebei bet007 hg0088 ju111 letiantang m88 mayaba qg777 qianyiguoji sbf777 tengbohui tlc ule weilianxier waiweitouzhu xingfayule xinhaotiandi yinheyule youfayule zhongying 2018shijiebei w88 18luck 188bet beplay manbet 12bet 95zz shenbo weide1946 ca88 88bifa aomenxinpujing betway bodog bt365 bwin tongbao vwin weinisiren 88jt fenghuangyule hongyunguoji 918botiantang huanyayule jianada28 jixiangfang libo long8 hongzuyishi zuqiutouzhu </