Unity 3.1 with Photon

edited February 2011 in Photon Server

I've tried to run the realtime demo for 3 days but it still doesn't work.
I've tried with photon server SDK 2.2.2 and 2.4.4.

What am I supposed to do ?



  • Well, where does it fail?
    Did you follow the "Photon in 5 minutes" video?
    http://developer.exitgames.com/quicksta ... iveminutes

    You need to describe where it fails. Otherwise, there is no way to help you.
  • Yes I did, The server is running and i've changed the game.cs file to
    When I build & run, nothing happen...
  • You run the server from the SDK without any changes? The PhotonControl icon turns blue.

    If there was a Windows Firewall dialog, you allowed Photon to listen to the fitting network type?
    http://developer.exitgames.com/samplesa ... llsettings

    And you run the client on the same machine as the server runs on?
  • I didn't change anything to the SDK, just downloaded it, running the x32_xp binaries file under xp SP3.

    The PhotonControl icon turns blue.

    The server and the client are on the same machine.

    I also checked the firewall
  • As long as the icon is blue, the process is working. So that should be fine. When serious errors happen, Photon is stopped.
    If the hint below does not work, please zip the logs in the bin_win32_xp\logs folder and attach them here.

    Client side, you enter "" as server address, right? Most demos should now have "localhost:5055" as default, so it won't make a difference.
    You could use a command shell to find out your local (!) ip. You could try to use that, in case that the loopback address is not working for some reason.

    Do you run the client from the DotNet Client SDK? Or which demo?
    Can you run it as debug (from inside VS) and attach also the debug out it gives you? Let it run at least 60 seconds if it just seems to hang or so.
  • Here are the logs... I quickly read it but didn't found any errors.

    I've tried to change by my real local network IP but it didn't worked...

    I juste build & run with the web player presets and run it in firefox/chrome and nothing happens...

    Maybe i'm missing a stupid step ... but I looked the 2 videos twice lol
  • The logs look fine.
    I assume you use Unity? v3.1? You should try and run the demo in the Editor and see what happens. Expecially the debug messages in console are interesting. You could also build a standalone to see if it makes a difference.

    I attached the DotNet Realtime Demo as build for localhost here. It does not log out but you could try it and see what happens there. Once the client window opened (might take a while if Photon can't be reached), you switch to the "view" tab and if a colored rectangle moves it's got to do with Unity's setup.
  • Well the console output :
    Security Exception (check policy file): System.Security.SecurityException: Unable to connect, as no valid crossdomain policy was found
      at System.Net.Sockets.Socket.Connect_internal (IntPtr sock, System.Net.SocketAddress sa, System.Int32& error, Boolean requireSocketPolicyFile) [0x00000] in <filename unknown>:0 
      at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0 
      at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0 
      at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, Int32 port) [0x00000] in <filename unknown>:0 
      at ExitGames.Client.Photon.NConnect.StartConnection () [0x00000] in <filename unknown>:0 
      at ExitGames.Client.Photon.EnetPeer.Connect (System.String ipport, System.String appID) [0x00000] in <filename unknown>:0 
      at ExitGames.Client.Photon.PhotonPeer.Connect (System.String serverAddress, System.String appID) [0x00000] in <filename unknown>:0 
      at ExitGames.RealtimeDemo.Game.Connect () [0x0006f] in C:\Developpement\photonSDK\demo-realtime-unity\Assets\Photon\Game.cs:295 
    usePhoton:DebugReturn(String) (at Assets/Photon/usePhoton.cs:220)
    ExitGames.RealtimeDemo.Game:DebugReturn(String) (at Assets/Photon/Game.cs:419)
    ExitGames.RealtimeDemo.Game:Connect() (at Assets/Photon/Game.cs:305)
    usePhoton:Start() (at Assets/Photon/usePhoton.cs:52)

    It seems that the host can't be found ...
  • You need to run the "Policy" app as preconfigured and open TCP ports 843 and 943 in the firewall(s). Did you do that?
  • In the logs, I see that the policy application is loaded. It should be no problem.
    Obviously it is for some reason.
    Maybe you need to update your Unity webplayer (from the beta to 3.1).
    Maybe the firewall is not open for the port 843 TCP? Or maybe it's in use?
    Or did you add Unity's "prefetch policy" code, where you could use a url and port to fetch the file?
  • I opened the ports and updated unity but it still give the same error message.

    I don't really understand what policy is (maybe because I'm french and relatively poorly documented about this)
  • Look into the unity manual - security sandbox for unity 3 webplayer :)
    then you know what monster you are fighting with at the time.

    simply put the webplayer, without a policy that allows him to, isn't able to talk to anywhere but relative paths
  • Well the demo works when I build it for windows/mac standalone.

    So, I read that the problem would come from the port the demo uses (5055) and the ports unity's webplayer is used for (843) because, according to the link dreamora gave to me (thanks =D) when you want to use a port higher than 1024, one must use the Security.PrefetchSocketPolicy() API call.

    Hmm ...

    Nevermind, I don't want the client run on webPlayer =)

    Thanks for lighting my path.
  • It will be an issue with the port for the policy file. We support Unity 3 webplayers out of the box. Our policy app is started and listens to the TCP port 843 by default. You don't have to prefetch. It's necessary that the ports are open in all firewalls however.

    Anyways. If you're doing a standalone, you don't have to care ;)