Я делаю игру, названную UnityCraft, и я попытался сделать способ переключения блоков!
Вот мой код:C# Ошибка Parsing
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);
}
}
}
}
У меня есть сборный под названием кирпич и один под названием грязи, и они связаны с блоками.
Приходит с ошибкой синтаксического анализа – jezza23
В чем вопрос? – SLaks
В какой строке это ошибка? Что такое сообщение об ошибке? –