PhotonView has no method "X" marked with [PunRPC] - Accessing a RPC method from a base class?

Options
I'm getting the error "PhotonView with ID 1 has no method "PunTakeDamage" marked with the [PunRPC](C#) ..." when calling it.

My player class is calling a public method "lf.TakeDamage(primaryDamage);" when hitting an enemy with a raycast. I get the component Lifeform from my enemy with is a base class from the enemies more specific class. The class structure looks like this:

> Lifeform
> SkeletonBaddy : Lifeform
> SpecificEnemy : SkeletonBaddy

"TakeDamage()" looks like this:

public void TakeDamage(int n)
{
photonView.RPC("PunTakeDamage", PhotonTargets.All, n);
}

It is at the .RPC line that I get the error. In the same Lifeform class I have the method marked as a [PunRPC]:

[PunRPC]
private void PunTakeDamage(int n)
{
healthCurrent -= n;
if (healthCurrent <= 0) Die();
}

I'm wondering if the reason why I'm getting this error is due to the PunRPC being nested within 2 base classes since technically when I find the Lifeform script from my hit enemy it is actually finding the class that inherits a class that inherits Lifeform. This seems odd to me but I don't really understand the inside of Photon to make a quality guss.

Any help is appreciated.

Comments

  • belome
    belome
    edited July 2017
    Options
    You probably have already figured this out, but I think your hunch is right about the subclasses. You probably need a protected access level instead of private if this is your base class.