using UnityEngine;
using System.Collections;
public class ShootingScripts : MonoBehaviour {
public Rigidbody bullet;
void Start () {
if (!networkView.isMine){
enabled = false;
}
}
void Update() {
if(Input.GetButtonDown("Fire1")){
networkView.RPC ("SpawnProjectile", RPCMode.All, transform.position, transform.rotation, 0);
}
}
[RPC]
void SpawnProjectile(Vector3 position, Quaternion rotation)
{
Rigidbody clone;
clone = Instantiate(bullet, position, rotation) as Rigidbody;
clone.AddForce(transform.right * 900);
}
}
Does anyone have any idea why my bullets aren't firing when I press the fire key? I have the script attached to an empty game object which is attached to the barrel of the gun. I'm not getting any error messages, it's just not shooting.
↧