Question by
Raviish123 · Jul 05, 2020 at 08:47 AM ·
fpsphotonrpc
Photon Pun: How to Get Camera of player running RPC
Hello, I was trying out Photon, to make a multiplayer FPS game, and when the bullet hits the player I wanted to instantiate a damage number, but i don't know how to make the text look at the player running the RPC. Here is the code:
public void ApplyDamage(Collision collision, int damage)
{
collision.gameObject.GetPhotonView().RPC("TakeDamage", RpcTarget.AllBuffered, damage);
collision.gameObject.GetPhotonView().RPC("DisplayDamageNum", RpcTarget.Others, damage);
}
[PunRPC]
public void DisplayDamageNum(int damage)
{
GameObject damageNum = Instantiate(damageNumPrefab, transform.position, Quaternion.identity);
damageNum.GetComponent<Text>().text = damage;
damageNum.transform.LookAt( camera of player running the RPC );
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613002517im_/https://answers.unity.com/themes/thub/images/avi.jpg)