Changing Unity Assets folder problem

zoultrexzoultrex
edited July 2010 in Photon Server
I have changed the folder where the unity assets are from inside the original MmoDemo folder:
-Photon.MmoDemo.Client.UnityIsland
to the folder where my game is..
I thought everything would work out fine only by copying the photon folder and adding the MmoEngine prefab to the stage and linking it but found out that its not that simple.

The problem is particularly to create a new instance of the Game class, which in the server source is part of the DotNet.
But I though that this would not be a problem because everything is compiled into the libs folder and the game would call them from there, right?

I also tried going into the photon source and adding another project with reference where my game is and where the dll's are and compiling again, it did comiple with no problem, but in the game the same problem happens. Basically it cannot create an instance of the Game class...

The error in unity is in this line;
this.engine.Avatar.MoveAbsolute(Player.GetPosition(player.transform.position));
I get Null reference Exception
System.NullReferenceException: 
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) UnityEngine.GameObject:get_transform ()
  at MmoEngine.Start () [0x00068] in D:\dev\AG\NovaHunter\Source\Game\Assets\Photon\MmoEngine.cs:121 
UnityEngine.Debug:Log(Object)
MmoEngine:Start() (at Assets\Photon\MmoEngine.cs:134)

Do I need to worry about something else apart from what is inside the libs folder to make the scripts inside the Photon folder work?

Comments

  • BorisBoris ✭✭
    GameObject player = GameObject.Find("First Person Controller Prefab");
    this.engine.Avatar.MoveAbsolute(Player.GetPosition(player.transform.position));
    
    The error is at "player.transform".
    Maybe a missing player?
  • The error seems to be gone now as I copied over everything again and got the original copy of the libs folder form the mmoDemo zip file but now Unity crashes when I get connected.
    I see in the server log that the Item for the Player is created:
    2010-07-26 19:10:10,581 [9] INFO  Photon.MmoDemo.Server.MmoItem - [MmoItem] Item created ec3c1873-b2ea-4103-833d-db6838f8755b at world WorldOne
    
    but unity crashes every time right after that the connection is made.

    Has anyone ever had that crash problem?
  • Also now I have 7 warning messages that I didnt had before:
    Assets/Photon/MmoEngine.cs(22,26): warning CS0436: The type `Radar' conflicts with the imported type `Radar'. Ignoring the imported type definition

    Assets/Photon/Settings.cs(21,19): warning CS0436: The type `Settings' conflicts with the imported type `Settings'. Ignoring the imported type definition

    Assets/Photon/Actor.cs(157,28): warning CS0436: The type `MmoEngine' conflicts with the imported type `MmoEngine'. Ignoring the imported type definition

    Assets/Photon/MmoEngine.cs(127,13): warning CS0436: The type `RTT' conflicts with the imported type `RTT'. Ignoring the imported type definition

    Assets/Photon/MmoEngine.cs(121,45): warning CS0436: The type `Player' conflicts with the imported type `Player'. Ignoring the imported type definition

    Assets/Photon/MmoEngine.cs(318,13): warning CS0436: The type `Actor' conflicts with the imported type `Actor'. Ignoring the imported type definition

    Assets/Photon/Player.cs(234,17): warning CS0436: The type `RemoteCam' conflicts with the imported type `RemoteCam'. Ignoring the imported type definition

    And btw, all my client files are the original files from what I got in the MmoDemo zip file, with only the settings ip changed
  • BorisBoris ✭✭
    the warnings look like you as if you have the classes as source code and as dll in your unity project
  • BorisBoris ✭✭
    i experienced crashes with unity when logging Exceptions with Debug.Log, seeing anything like this?
  • Thanks for the Tip.
    I removed all the Debug.Log calls and nothing.

    The error doesnt happen if I do not initialize the peer, so commenting this like keeps unity running disconnected:
    this.engine.Initialize(peer);
    

    Funny thing also is that if I try to connect with the server down it doesnt crash.
    Ill try to start commenting lines in the Game class to try to track down the problem, but Im guessing it will be a looong night =)
  • BorisBoris ✭✭
    maybe it has to do with the player creation.. did you add all 3 prefabs to the scene:
    MmoEnginePrefab, PlayerNamePrefab and ViewDistancePrefab?
    Also, did you copy the Resources folder?
  • Boris wrote:
    maybe it has to do with the player creation.. did you add all 3 prefabs to the scene:
    MmoEnginePrefab, PlayerNamePrefab and ViewDistancePrefab?
    Also, did you copy the Resources folder?

    Didnt untill now, but same problem happens anyway...

    Peeling down the layers to track the problem i found another call that if commented avoids the crash:
    photonPeer.Connect(this.settings.ServerAddress, this.settings.ApplicationName);
    

    I was able to open the crash log and copy the editor Entries, it seems that It logged some NullReferenceException

    Log here:
    http://pastebin.com/eBLNWu7P
  • BorisBoris ✭✭
    at MmoEngine.OnWorldEntered (Photon.MmoDemo.Client.Game game) [0x00025] in D:\dev\AG\NovaHunter\Source\Game\Assets\Photon\MmoEngine.cs:357
    this is the code:
    GameObject player = GameObject.Find("First Person Controller Prefab");
            Player playerBehaviour = (Player)player.AddComponent(typeof(Player));
    
    No "First Person Controller Prefab" ?
  • Oh man, i hate being stupid...
    Boris what would I do without you :P
    Many thanks
  • BorisBoris ✭✭
    zoultrex wrote:
    Boris what would I do without you :P
    hey, you pay my bills - so that's ok ;)
    Thanks for using Photon! :D
  • Happy to! =)

    Many thanks for all that stay on the line helping us ! Hooray!!!
Sign In or Register to comment.