- Home /
Emit particles for all clients
No one seems to have an answer I understand, or can apply to my situation so here goes:
I have a simple Raycast shooting method. In order to illustrate the bullet, I currently am using a particle system. The bullet object is fired using Emit(), and it looks how I want for the moment.
The problem, is that it is only happening on the client. How do I sync this?
Answer by OrbitalTech · Dec 06, 2017 at 10:15 AM
The enigma has been solved!
I have my Fire() method calling a Command, which calls an RPC. This is probably common networking knowledge, but I did not understand RPC or Commands, only blindly following tutorials and other Unity answers.
For reference:
void Fire()
{
CmdEmitParticles(1);
}
[Command]
void CmdEmitParticles(int amount)
{
RpcEmitParticles(amount);
}
[ClientRpc]
void RpcEmitParticle(int amount)
{
GetComponent<ParticleSystem>().Emit(amount);
}
Your answer
Follow this Question
Related Questions
Sync Network Animation State 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
C# get universal time 2 Answers
Networking Sync SetActive Not Working 0 Answers