Simple Unityscript question

Hi all,

I'm just delving into photon cloud for multiplayer as it seems like a pretty nice solution. Only problem is I've only really used unityscript and I realise there's not much documentation around for this when it comes to photon.

Just wondering, how could you access something like this from unity script? -

public void OnFailedToConnectToPhoton(object parameters){
Debug.Log ("Damn!");



  • Photon with Unityscript is actually super simple.
    The photon files need to be in your "Plugins" folder to make it work.
    Then just add a photonview to your object.

    private var photonView : PhotonView;
    private var Player :  GameObject;
    function Start () {
    photonView = GetComponent("PhotonView");
    PhotonNetwork.Connect("", 5055, "Your_ID", "0.1");
    function OnJoinedLobby() {
    function OnJoinedRoom() {
    if (PhotonNetwork.isMasterClient) {
    Player=PhotonNetwork.Instantiate("Player", Vector3(0,0,0), Quaternion.identity,0);
    //Player is a Prefab in your Resources Folder
    function OnFailedToConnectToPhoton() {
  • Awesome, thanks mate! That's perfect.
  • Hi guys,
    another thing popped up while trying to convert to unityscript. I'm just not too sure how to reformat the [RPC] attribute. In unity networking it says to add @RPC but if I do that I get this error -

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

    From the tutorials -
    void ChatMessage(string a, string b)
        Debug.Log("ChatMessage " + a + " " + b);

    to this - (my attempt)
    import PhotonNetwork;
    function ChatMessage(a : string, b : string )
        Debug.Log("ChatMessage " + a + " " + b);
  • Okay, got it going :)
    It was the "import PhotonNetwork;" part that was breaking things.