(Photon) Can't get RPC's working in JS... Please help :)

Hi all,

Just having some trouble getting RPC’s to work in photon and I was wondering if anyone here could point me in the right direction.

I’m just getting started with multiplayer and I wanted to convert this code over to unityscript.

[RPC]
void ChatMessage(string a, string b)
{
    Debug.Log("ChatMessage " + a + " " + b);
}

This is my converted JS version,

import PhotonNetwork;
@RPC
function ChatMessage(a : string, b : string )
{
    Debug.Log("ChatMessage " + a + " " + b);
}

And I get this error -

BCE0004: Ambiguous reference ‘RPC’: PhotonNetwork.RPC(PhotonView, String, PhotonTargets, *Object[ ]), PhotonNetwork.RPC(PhotonView, String, PhotonPlayer, *Object[ ]), UnityEngine.RPC.

Any ideas what I might be doing wrong? Or if anyone has any basic JS example scenes they could share I reckon I could deconstruct it.
Anyway thanks!
Pete

Figured it out! I didn’t need to add the import photon part to the start.
Yeay!

Cool you could make it run and thanks for posting the solution!
I rarely use UnityScript myself, so this is likely a good hint for everyone.