为什么用整数参数调用RPC函数会出错? -光子统一

问题描述

我正在使用Photon 2,并且在我的一个脚本中具有Public Rpc Function,该函数具有Integer Parameter,这就是我的函数的模样。

    [PunRPC]
    public void TakeDamage(int amount)
    { 
        playerHealth -= amount;
        if (playerHealth <= 0)
        {
            Debug.Log("Player Died");        
        }
    }

我们在上面的代码中,TakeDamage函数接受一个整数调用量。因此,当我从其他脚本调用此函数时,以及当其他脚本实际上调用该函数时,它会发出警告。

我怎么称呼功能

PV.RPC("currentTarget.TakeDamage",RpcTarget.AllBuffered,damage);

PV是公共的PhotonView。


警告

RPC method 'currentTarget.TakeDamage(Int32)' not found on object with PhotonView 1003. Implement as non-static. Apply [PunRPC]. Components on children are not found.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...