- Home /
How To Deal With Lingering Prefabs in Multiplayer Scene ?
I have a multiplayer game Running . In this game there is a red team and blue team.
As it should be each projectile that a player fires is instantiated in all other players networkView .
Players can pause their game thus avoiding getting hit by projectiles . but when Time.timeScale = 0 the enemy projectile withing my network view also pauses . completely understandable .
what I need help with is getting the projectile to never pause by removing them from my networkView across the network .
I came up with this c# script which would seem as if it would work but ...no luck.
using UnityEngine;
using System.Collections;
public class CheckAndRemoveFromNetworkView : MonoBehaviour {
//private NetworkView nView;
// NetworkViewID viewID = Network.AllocateViewID();
void Update () {
if (Time.timeScale == 0)
{
networkView.RPC("RemoveFromNetworks",RPCMode.All,nView.viewID);
}
}
[RPC]
void RemoveFromNetworks(NetworkViewID viewID)
{
viewID = GameObject.Find("OtherObject").GetComponent<NetworkView>().viewID;
nView.viewID = viewID;
}
}
if you notive the gameobject to assign the viewID from is "OtherObject" no idk how the heck that works. each projectile after instantiation has a different viewID to begin with so changing it really does nothing