-1

im developing a realistic fps with multiplayer using netcode for gameobjects. Im stuck at trying to get the muzzle flash effect to show for the other player,

im experienced with unity but not with netcode, so sorry if this is a noob question

my particle system is attached to the gun and played with this function:

public void shoot_muzzleflash()
{
    muzzleFlash.Play();
        

}

and im activating this function in an animation with an event. I tried this:

[ServerRpc]
public void CmdStartParticles()
{
    RpcStart_shoot_muzzleflash();
    shoot_muzzleflash();
}

[ClientRpc]
public void RpcStart_shoot_muzzleflash()
{
    shoot_muzzleflash();
}

public void shoot_muzzleflash()
{
    muzzleFlash.Play();
        

}

but then i cant choose the CmdStartParticles() as an event in the animation

1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Commented Jul 25, 2023 at 13:04

1 Answer 1

0

figuered it out!

[ServerRpc]
public void MuzzleFlashGameobjectServerRpc()
{
GameObject go = Instantiate(muzzleflashGobj,
shootpoint.transform.position,shootpoint.transform.rotation);
go.GetComponent<NetworkObject>().Spawn();
 
}

changed the particlesystem to be instantiated at the muzzle point instead of being activated, that worked

but only when the host shoots do the other clients see, but then the client shoots you cant see it on neither screens. anyone know what this could be?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.