var BulletPrefab:GameObject;
var force : float = 2000;
function OnGUI()
{
if (GUI.Button(Rect(250,350,75,75),""))
{
var bullet = Instantiate(BulletPrefab,
GameObject.Find("Player").transform.position,
GameObject.Find("Player").transform.rotation);
bullet.rigidbody.AddForce(bullet.transform.forward * force);
}
}
I created a button that’s supposed to instantiate and give a forward force to a bullet game object - but whenever I press it, the game object appears in the inspector but not actually on the game screen, can anybody tell me how to fix it?