0
저는 UnityCraft라는 게임을 만들고 블록을 전환하는 방법을 만들려고했습니다! 나는 조립식라는 벽돌과 하나라는 먼지를 가지고 있고, 그들은 블록에 연결되어C# 구문 분석 오류
using UnityEngine;
using System.Collections;
public class BuildScript : MonoBehaviour {
RaycastHit hit;
public int blockSelected = 1;
public Transform prefab;
// Use this for initialization
void Start() {
}
// Update is called once per frame
void Update() {
if(Input.GetButtonDown(1)){
blockSelected = 1;
}
if(Input.GetButtonDown(2)){
blockSelected = 2;
}
if(blockSelected == 1){
prefab = dirt;
}
if(blockSelected == 2){
prefab = brick;
}
Ray ray = camera.ViewportPointToRay (new Vector3 (0.5f, 0.5f, 0));
Vector3 G = new Vector3 (Mathf.Round (hit.point.x), Mathf.Ceil (hit.point.y), Mathf.Round (hit.point.z));
if (Physics.Raycast (ray, out hit)) {
if (Input.GetMouseButtonDown (0)) {
Destroy (hit.collider.gameObject);
print ("Block Destroyed!");
}
if (Input.GetMouseButtonDown (1)) {
Instantiate (prefab, G, Quaternion.identity);
}
}
}
}
:
다음은 내 코드입니다. GetButtonDown 정수 인수를 가지고 있지 않기 때문에
구문 분석 오류가 발생합니다. – jezza23
무엇이 당신의 질문입니다. – SLaks
어떤 줄에 오류가 있습니까? 오류 메시지 란 무엇입니까? –