Everytime I send a ClientRpc from Server to Clients through a NPC I get this (along with it not working and the game stuttering)
Exactly when sending ONE single RPC
[ClientRpc]
public void RpcSendHealth(int hp)
{
health = hp;
}
and just calling
if (isServer)
RpcSendHealth(health);
upon taking damage.
I then noticed this only happens when the Rpc is situated in the Parent Class, using ONLY the Parent Class it works just fine.
Any ideas? This is really annoying, I need to send information to players and this won’t let me.
I have a BasicAI class which contains the Rpcs and is inherited by other classes.
Here’s a small note I jotted down when I wanted to do something to make a network game. Hopefully this helps:
/*
Steps to use:
[Client -> Server] is the [Command] attribute.
Use [ClientCallback] to call a [Command] method.
Use [Command] to "sync" or give corrections to an important/useful variable.
Use [SyncVar] to "sync" the important/useful variable across all clients.
Use the important/useful variable to update other game object related properties.
*/
I found a workaround but it’s kind of annoying, placing all RPCs and Commands in a separate class with no inheritance between this one and the caller(the original parent class).
Well this was just a test, usually I’d use RPCs to make Clients run certain methods which cannot be done elseway.