Синтаксис:
Используется csharp
using UnityEngine;
using System.Collections;
public class Constructor : MonoBehaviour {
// Public variables
public GameObject player_example;
public Transform drednoughtBody;
// Private variables
private GameObject drednought;
private GameObject skelet;
private Transform player_torso;
// Construction
void Start () {
drednought = new GameObject("drednought");
player_example = Instantiate(player_example, drednought.transform.position, drednought.transform.rotation) as GameObject;
player_torso = Instantiate(drednoughtBody.Find("player_torso_flamer"), player_example.transform.position, player_example.transform.rotation) as Transform;
player_example.name = "base";
player_torso.name = "player_torso_flamer";
player_torso.parent = player_example.transform;
player_example.transform.parent = GameObject.Find("drednought").transform;
}
// Construction
void Update () {
if (Input.GetKeyDown ("KeyCode.Space"))
{
if (player_torso.name == "player_torso_flamer") {
Destroy(GameObject.Find(drednought.name + "/base/player_torso_flamer"));
player_torso = Instantiate(drednoughtBody.Find("player_torso_minigun"), player_torso.position, player_example.transform.rotation) as Transform;
player_torso.name = "player_torso_minigun";
}
else
{
Destroy(GameObject.Find(drednought.name + "/base/player_torso_minigun"));
player_torso = Instantiate(drednoughtBody.Find("player_torso_flamer"), player_torso.position, player_example.transform.rotation) as Transform;
player_torso.name = "player_torso_flamer";
}
player_torso.parent = player_example.transform;
}
}
using System.Collections;
public class Constructor : MonoBehaviour {
// Public variables
public GameObject player_example;
public Transform drednoughtBody;
// Private variables
private GameObject drednought;
private GameObject skelet;
private Transform player_torso;
// Construction
void Start () {
drednought = new GameObject("drednought");
player_example = Instantiate(player_example, drednought.transform.position, drednought.transform.rotation) as GameObject;
player_torso = Instantiate(drednoughtBody.Find("player_torso_flamer"), player_example.transform.position, player_example.transform.rotation) as Transform;
player_example.name = "base";
player_torso.name = "player_torso_flamer";
player_torso.parent = player_example.transform;
player_example.transform.parent = GameObject.Find("drednought").transform;
}
// Construction
void Update () {
if (Input.GetKeyDown ("KeyCode.Space"))
{
if (player_torso.name == "player_torso_flamer") {
Destroy(GameObject.Find(drednought.name + "/base/player_torso_flamer"));
player_torso = Instantiate(drednoughtBody.Find("player_torso_minigun"), player_torso.position, player_example.transform.rotation) as Transform;
player_torso.name = "player_torso_minigun";
}
else
{
Destroy(GameObject.Find(drednought.name + "/base/player_torso_minigun"));
player_torso = Instantiate(drednoughtBody.Find("player_torso_flamer"), player_torso.position, player_example.transform.rotation) as Transform;
player_torso.name = "player_torso_flamer";
}
player_torso.parent = player_example.transform;
}
}
error CS8025: Parsing error
В чем траббл? По любому что то нубское, ну и ясное дело, программирование начал учить недавно.
Мне нужно чтобы по нажатию клавиши, менялась верхняя часть тела.