UNITY의 간단한 코드 쓰기
새 스크립트 파일 만들기
Inspector 화면에서 AddCompanent 버튼을 클릭합니다.
New Script 입력 파일의 이름을 선택합니다.그런 다음 Assets 화면에 새 스크립트 파일이 나타납니다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerMovement : MonoBehaviour {
    // Use this for initialization
    void Start () {
    }
    // Update is called once per frame
    void Update () {
    }
}
・void Start 코드는 게임을 시작할 때 한 번 이동합니다.
・void Update 코드는 프레임마다 이동합니다.
게임 스타트에서 코드를 이동합니다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerMovement : MonoBehaviour {
  // このコードはオブジェクトのパブリック変数作る。
    public Rigidbody rb;
    // Use this for initialization
    void Start () {
      //オブジェクトの動きを上げる(X、Y、Z)
          rb.AddForce(0,200,500);
    }
    // Update is called once per frame
    void Update () {
    }
}
 
 ↑의 그림은 어떤 대상이 동작을 주고 싶은지 선택할 수 있습니다.
프레임마다 코드 이동
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerMovement : MonoBehaviour {
  // このコードはオブジェクトのパブリック変数作る。
    public Rigidbody rb;
    // Use this for initialization
    void Start () {
    }
    // 毎1秒はオブジェクトはz-axisで動く
    void FixedUpdate () {
        rb.AddForce(0, 0, 2000 * Time.deltaTime);
    }
}
수첩: "FixedUpdate"이름을 사용하는 이유그 이름이 피지컬 렌더러를 위한 거니까.
GITHUB: https://github.com/andybit-okutama/Unity_Learn/
FILE: https://github.com/andybit-okutama/Unity_Learn/blob/master/2%20programming/Assets/playerMovement.cs
비디오: https://www.youtube.com/watch?v=9ZEu_I-ido4
Reference
이 문제에 관하여(UNITY의 간단한 코드 쓰기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/andy1dx/items/a84f1d8a5d8bea371396텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)