Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Script does not work after conversion

Discussion in 'Scripting' started by PascalMonnier, Dec 17, 2012.

  1. PascalMonnier

    PascalMonnier

    Joined:
    Nov 28, 2012
    Posts:
    1
    Hello, I converted the chat script tutorial Marco Polo (Photon). UnityScript From C # to JAVA. For starters, the line
    #C :
    Code (csharp):
    1. photonView.RPC("SendChatMessage", target, chatInput);
    must be remplaced by
    JAVA :
    Code (csharp):
    1. PhotonNetwork.photonView.RPC("SendChatMessage", target, chatInput);
    Why ?

    Then, I get this error with the following code:

    "NullReferenceException: Object reference not set to an instance of an object
    Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[]"






    Code (csharp):
    1. function OnGUI(){
    2. if (GUILayout.Button("ALL", GUILayout.Height(17)))
    3.         SendChat(PhotonTargets.All);
    4. }
    5.  
    6. function SendChat(target:PhotonTargets)    {
    7.     PhotonNetwork.photonView.RPC("SendChatMessage", target, chatInput);
    8.     chatInput = "";
    9. }
    10.  
    11. @RPC
    12. function SendChatMessage(text:String,info:PhotonMessageInfo)    {
    13.     AddMessage("[" + info.sender + "] " + text);
    14. }
    15.  
    16. static function AddMessage(text:String)    {
    17.     SP.messages.Add(text);
    18.     if (SP.messages.Count > 15) SP.messages.RemoveAt(0);
    19. }
    Thank you.

    ...Sorry for the name, error handling
     
    Last edited: Dec 17, 2012
  2. hai_ok

    hai_ok

    Joined:
    Jun 20, 2007
    Posts:
    193
    running into the same problem
     
  3. wccrawford

    wccrawford

    Joined:
    Sep 30, 2011
    Posts:
    2,038
    You just necro'd a 2 year old topic and didn't provide any further details.