RPC calls wrong inherited script

Hello folks :slight_smile:

On my gameobject I have a few scripts that represents a behaviour. Say Behaviour_A and Behaviour_B.
Both of them inherits from the same abstract parent (call it Behaviour).

In my abstract parent I define an RPC as follow:

    [ClientRpc]
    protected void RpcStart(string behaviourName)
    {
        Debug.Log("RpcStart " + behaviourName+ "    in Behaviour: " + ToString());
    }

Now, the problem is when that RPC is invoked for Behaviour B, it’s always Behaviour A that receives it.

Example of the log output:

Why is that happening? Is it due to the fact that a ClientRPC function creates a unique ID and it associates with the first script it finds? If so, any suggestions on how I could handle this differently.

The goal I have in mind, is when the Server starts a Behaviour, it then do an RPC to the said behaviour on the clients that can do something custom (mainly minor things. Going SyncVar is not an option).

Thank you :smile:

Checkout my post. I’m facing a simular issue. I have read the RPC code. The reflection it uses and the method to find the correct object is weird. Maybe my spreadsheet will help you, is way down my thread.