Figured it out
How to sync particles over UNet
Hey guys! This is my first question here. I'm making a FPS multiplayer game in Unity using Unet.
The player uses a Gun and has a cigarette. Shoots bullets and blocks with gun and blows smoke with cigarette. Since blocks and bullets are GameObjects a code for this is: [Command] void CmdFireGun() {
var bullet = (GameObject)Instantiate(
bulletPrefab,
bulletSpawn.position,
bulletSpawn.rotation);
bullet.GetComponent<Rigidbody>().velocity = bullet.transform.forward * 80;
NetworkServer.Spawn(bullet);
But since a smoke is particle I cannot use Network.Server.Spawn.
A current code for smoke is:
void CmdCigarSmoke ()
{
Instantiate(
CigarSmokePrefab,
CigarSpawn.position,
CigarSpawn.rotation);
}
And a smoke from both Host and client is visible only on Host . Any suggestion?
For anyone else stumbling on this check this answer: https://answers.unity.com/questions/1084471/particles-syncing-on-the-unity-network.html?childToView=1771640#answer-1771640
Follow this Question
Related Questions
Multiplayer FPS version of unity networking tutorial? Using rigidbodies- see project link 0 Answers
particle collision events networking 0 Answers
Keeping an object in a multiplayer scene, when a player joins. 3 Answers
Using syncVar in networkManager 1 Answer
Command function called on server 0 Answers