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); } } }