- Home /
 
Multiplayer Gun Script
So here is the script for the gun using UnityEngine; using System.Collections;
 public class GunScript : MonoBehaviour {
     private GameObject FirePort;
     public Rigidbody BulletType;
     public int BulletSpeed;
     // Use this for initialization
     void Start () {
         FirePort = gameObject.transform.FindChild ("FirePoint").gameObject;
     }
     
     // Update is called once per frame
     void Update () {
     if (Input.GetButtonDown("Fire1")) {
 
             Rigidbody Bullet = (Rigidbody)Network.Instantiate(BulletType, FirePort.transform.position, transform.rotation, 0);
             Bullet.velocity = transform.TransformDirection (Vector3.forward * BulletSpeed);
     }
 }
 }
 
               And here is the script that deletes the bullets using UnityEngine; using System.Collections;
 public class BulletScript : MonoBehaviour {
     public float BulletDestroyTime;
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
         BulletDestroyTime -= Time.deltaTime;
         if(BulletDestroyTime <= 0){
             Network.RemoveRPCs(networkView.viewID);
             Network.Destroy(gameObject);
         }
     }
 }
 
 
               It seems that when the bullet gets deleted is gives me these errors:
View ID AllocatedID: (a view id number would be here) not found during lookup. Strange behaviour may occur
Couldn't perform remote Network.Destroy because the network view 'AllocatedID:(view id again)' could not be located
I have a Network View attached to the gun and network views attached to the bullets so plz help me.
Your answer
 
             Follow this Question
Related Questions
Multiplayer server-client setup 1 Answer
How to synchronize GameObjects 2 Answers
How to call [Command] on Client in UNet 1 Answer
Pushed back when applying NetworkTransform 1 Answer
Unity3D Photon movement synchronization 0 Answers