Why it isn't shooting? Code (CSharp): using UnityEngine; using System.Collections; public class Shot : MonoBehaviour{ public Rigidbody bullet; public float speed = 20; public void onclickshot(){ Rigidbody clone = Instantiate(bullet,transform.position,transform.rotation)as Rigidbody; clone.velocity = transform.TransformDirection(new Vector3(0, 0, speed)); } } I have one empty object with the script and the rigidbody asigned and a button with this emptyGameObject and the scripting onclickshot()
why are you converting it to rigidbody? just simply use it as a GameObject and then clone.GetComponent<Rigidbody>.velocity