Odd behaviour, changes class type on ClientRpc

I use two classes which both derives from an abstract “Ability” class:

class BuildAbility : Ability
class DefaultAttackAbility : Ability

The ability class is an abstract class which contains ordinary methods.
(Virtual IEnumerator methods in the images are not virtual any longer, just IEnumerator)

When calling an Ability function in the BuildAbility class and then RPC it to client the class type changes.
I’m sure that I misunderstood something about UNet or inheritance but i can’t find any reference to this.

I appreciate every input and thoughts I can get on this.

I actually managed to find what causing this. My conclusion is that [ClientRpc] goes by the name of the method. The gameobject actually have 3 different abilities which all derive from Ability with the same base method using the Rpc attribute. It seems to just grabs the first script in the hierarchy and run that function. This happened to be the “DefaultAttackAbility” script. When I changed the hierarchy then it still went for the first best script, this was in my case “AreaDamageAbility”. I’m not sure if this is a bug or works as intended?

Yeah that’s how I believe it works too. I first noticed the issue when I tried to run more than 1 of the same script on a single object and was seeing RPC’s executing on the wrong copy of the script. (I had written a child transform syncing script, and tried to have 1 copy of the script for each child I wanted to sync. Ended up having to redesign it a bit to take a list of child objects to sync on the 1 script)