Simple Unityscript question
Options
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!");
}
Thanks,
Pete
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!");
}
Thanks,
Pete
0
Comments
-
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.
example:private var photonView : PhotonView; private var Player : GameObject; function Start () { photonView = GetComponent("PhotonView"); PhotonNetwork.Connect("app-eu.exitgamescloud.com", 5055, "Your_ID", "0.1"); } function OnJoinedLobby() { PhotonNetwork.JoinRandomRoom(); } 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() { }
0 -
Awesome, thanks mate! That's perfect.0
-
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 -[RPC] void ChatMessage(string a, string b) { Debug.Log("ChatMessage " + a + " " + b); }
to this - (my attempt)import PhotonNetwork; @RPC function ChatMessage(a : string, b : string ) { Debug.Log("ChatMessage " + a + " " + b); }
0 -
Okay, got it going
It was the "import PhotonNetwork;" part that was breaking things.0