private string name;
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
Name="asd";
Name2 =Name;
private string name;
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
Name="asd";
Name2 =Name;
// Instantiates 10 copies of prefab each 2 units apart from each other using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public Transform prefab; void Start() { for (int i = 0; i < 10; i++) { Instantiate(prefab, new Vector3(i * 2.0F, 0, 0), Quaternion.identity); i++; } } }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public Rigidbody projectile; void Update() { if (Input.GetButtonDown("Fire1")) { Rigidbody clone; clone = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody; clone.velocity = transform.TransformDirection(Vector3.forward * 10); } } }
public class gameOverTrigger : MonoBehaviour {
void OnTriggerEnter(){
Debug.Log ("game over");
}
}
var eulerAngleVelocity : Vector3 = Vector3 (0, 100, 0); function FixedUpdate () { var deltaRotation : Quaternion = Quaternion.Euler(eulerAngleVelocity * Time.deltaTime); rigidbody.MoveRotation(rigidbody.rotation * deltaRotation); }
private var speed : Vector3 = Vector3 (3, 0, 0); function FixedUpdate () { rigidbody.MovePosition(rigidbody.position + speed * Time.deltaTime); }