# RPC call \*sorta\* not working...

**URL:** <https://discussions.unity.com/t/rpc-call-sorta-not-working/395817>\
**Category:** Multiplayer & Networking\
**Created:** [August 2, 2009, 9:18pm UTC](https://discussions.unity.com/t/rpc-call-sorta-not-working/395817 "2009-08-02T21:18:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon\_61641311](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@anon\_61641311](https://discussions.unity.com/u/anon_61641311)\
**Post date:** [August 2, 2009, 9:18pm UTC](https://discussions.unity.com/t/rpc-call-sorta-not-working/395817/1 "2009-08-02T21:18:38Z")

</div>

Ok so I am making a simple networking FPS, and I am trying to detect when a player has been shot, I can figure out who has been shot, but after that nothing is really working…

So I have a script that just does a raycast to figure out if you shot someone, if you did, then it sends out a RPC call, to figure out who has been shot, and to cause a reaction.

This is the RPC call

```auto
@RPC
function YourDead(n : NetworkViewID, _name : String) {
	if (n.isMine) {
		chat.networkView.RPC("ApplyGlobalChatText", RPCMode.All, " *************" + PlayerPrefs.GetString("name") + " Has been shot by: " + _name, 1);
		transform.GetComponent(GunController).hasBeenHit = true;
		transform.position = GameObject.FindWithTag("Respawn").transform.position;
		yield WaitForSeconds(3);
		transform.GetComponent(GunController).hasBeenHit = false;
	}
}

```

It is able to tell who has been shot, and calls the actual code inside the if statement, however the chat.networkView.RPC… is the only thing that really works. Changing the transforms position doesn’t work, and changing the boolean value doesn’t work, anyone know what I am doing wrong?

---

<div class="post-metadata">

**Author:** ![anon\_61641311](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@anon\_61641311](https://discussions.unity.com/u/anon_61641311)\
**Post date:** [August 3, 2009, 9:03pm UTC](https://discussions.unity.com/t/rpc-call-sorta-not-working/395817/2 "2009-08-03T21:03:56Z")

</div>

Anyone know?

---

<div class="post-metadata">

**Author:** ![anon\_78165414](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@anon\_78165414](https://discussions.unity.com/u/anon_78165414)\
**Post date:** [August 4, 2009, 3:58am UTC](https://discussions.unity.com/t/rpc-call-sorta-not-working/395817/3 "2009-08-04T03:58:44Z")

</div>

Check to make sure that FindWithTag() GetComponent() are returning objects.

---

<div class="post-metadata">

**Author:** ![anon\_89678146](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@anon\_89678146](https://discussions.unity.com/u/anon_89678146)\
**Post date:** [August 5, 2009, 12:23am UTC](https://discussions.unity.com/t/rpc-call-sorta-not-working/395817/4 "2009-08-05T00:23:11Z")

</div>

Lets see your RPC call of YourDead.

---

<div class="post-metadata">

**Author:** ![anon\_61641311](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@anon\_61641311](https://discussions.unity.com/u/anon_61641311)\
**Post date:** [August 11, 2009, 9:05pm UTC](https://discussions.unity.com/t/rpc-call-sorta-not-working/395817/5 "2009-08-11T21:05:43Z")

</div>

Sorry it took me so long to respond, I did however finally figure it out.

Originally my RPC call was like this

transform.networkView.RPC(“YourDead”, RPCMode.Others, hit.transform.networkView.viewID, tmp);

I figured out though that I needed to change it to

hit.transform.networkView.RPC(“YourDead”, RPCMode.Others, hit.transform.networkView.viewID, tmp); // hit is a RaycastHit.

---

<div class="post-metadata">

**Author:** ![Dreamora](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/dreamora/32/91058_2.png) [@Dreamora](https://discussions.unity.com/u/Dreamora)\
**Post date:** [August 11, 2009, 11:57pm UTC](https://discussions.unity.com/t/rpc-call-sorta-not-working/395817/6 "2009-08-11T23:57:44Z")

</div>

good to hear that you are up now 🙂
