Photon is giving an error and warnings with Photon scripts

Imported an updated version of Photon Unity Networking into my project. Reconfigured the folder locations so they would work with unityJavaScript. Proceeded to write multiplayer into my project, no worries. Ran it a few times in offline mode and online creating a room.

Went to build out project for further testing, build failed, received 4 warnings and an error. All of these are in relation to Photon scripts. I am at a complete loss (after starting a second new project, reimporting Photon, then imported all assets after rolling back scripts to before Photon, to arrive at the same problem again upon build after rewriting multiplayer parts). Can anyone please help me understand why this is happening, and how to fix it (or configure my project folders correctly if they are not)?

Here are the error messages :

Assets/Plugins/UtilityScripts/ConnectAndJoinRandom.cs(9,44): warning CS0436: The type `Photon.MonoBehaviour' conflicts with the imported type `Photon.MonoBehaviour'. Ignoring the imported type definition

Assets/Plugins/PhotonNetwork/PhotonClasses.cs(71,12): warning CS0436: The type `PhotonPlayer' conflicts with the imported type `PhotonPlayer'. Ignoring the imported type definition

Assets/Plugins/UtilityScripts/InRoomChat.cs(72,38): warning CS0436: The type `PhotonMessageInfo' conflicts with the imported type `PhotonMessageInfo'. Ignoring the imported type definition

Assets/Plugins/UtilityScripts/SmoothSyncMovement.cs(15,39): warning CS0436: The type `PhotonStream' conflicts with the imported type `PhotonStream'. Ignoring the imported type definition

Assets/Plugins/PhotonNetwork/PhotonClasses.cs(80,14): error CS0029: Cannot implicitly convert type `PhotonPlayer' to `PhotonPlayer'

here is a screenshot showing the project folder layout of Photon :

attachment.php?attachmentid=71816&d=1382421282

I have also posted this on UnityAnswers and UnityForums, when this is resolved I shall update all other posts. Thanks for your help.

Comments

  • Maybe you copied files around instead of moving them? Something might be doubled?
    I would need access to a minimal repro project to check this. Never had the issue myself.
  • AlucardJay
    edited October 2013
    Thank you for your quick reply. My process was as follows :

    * Imported PUN (all files except for demo folder)
    * Saved AppID
    * Dragged the Plugins folder to the root directory
    * Dragged the Editor folder to the root directory
    * Dragged the Resources folder to the root directory
    * Dragged the UtilityScripts folder to the Plugins directory

    As stated, everything worked fine in the editor, it was only on attempting a build that the warnings and error appeared.

    I have uploaded the whole project in a package : Removed

    My folders have an underscore (_Scenes, _Scripts), everything else is Photon or for the soldier from the Bootcamp demo (standalone). Using Unity 3.5.7, and unityJavaScript. Please let me know if I've left any information out.
  • Interesting, I followed up on the duplicate script lead, and suddenly an error kept constantly logging :

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.EditorGUI.ObjectIconDropDown (Rect position, UnityEngine.Object[] targets, Boolean showLabelIcons, UnityEngine.Texture2D nullIcon, UnityEditor.SerializedProperty iconProperty) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/MonoGenerated/Editor/EditorGUI.cs:2419)
    UnityEditor.MonoScriptImporterInspector.OnHeaderIconGUI (Rect iconRect) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/Inspector/MonoScriptInspector.cs:49)
    UnityEditor.Editor.DrawHeaderGUI (UnityEditor.Editor editor, System.String header) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/Inspector/Editor.cs:166)
    UnityEditor.Editor.OnHeaderGUI () (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/Inspector/Editor.cs:46)
    UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/Inspector/InspectorWindow.cs:776)
    UnityEditor.InspectorWindow.OnGUI () (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/Inspector/InspectorWindow.cs:243)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)

    Now looking at the screenshot, there is something strange about the class PhotonClasses.cs , there is a parent blank icon, and the script in a subdirectory of that icon.

    I am almost sure that this is something with how the PUN has been imported into the project. But what can I do? I have older projects with previous versions of PUN, and am tempted to delete everything recently imported and just use those scripts.

    Just to confirm, I started with a new project, imported Photon, imported my assets (none of which had any reference to Photon, nor used photon script names), worked away happily, testing in the editor.
  • I've never seen it that a script in the project explorer is shown with an arrow to open it and then it has a "script" and another file listed that's the name of the class.
    No re-importing gets rid of that either.
    I can reproduce this issue by moving the files in the project from the subfolder to Assets\Plugins. Suddenly the scripts consist of 2 files for no reason.

    I don't know what goes wrong but this seems to be a problem you should report to Unity as bug.
    However, I doubt they support 3.5 anymore and in a short test, it looks like 4.2 isn't having that issue.

    You don't have to move files around at all when you use C# but I doubt that's an option for you.
    Maybe you have more luck copying the files outside of the Editor. Do it in the explorer/finder.
    You don't have to move the UtilityScripts. If something is broken in those, just delete the file or fix the code. They are not plugins and I wouldn't copy them there.
  • Thank you for your time and effort in helping me sort this problem. I followed (most) of your advice and got my project running with the following :

    * Started a new project
    * Imported PUN (all files except for demo folder)
    * Saved AppID
    * Exit Unity
    * from the file browser :
    * Dragged the PhotonNetwork Plugins folder (Assets>PUN>Plugins>PhotonNetwork) into the root Plugins directory (Assets>Plugins>PhotonNetwork)
    * Dragged the Editor folder to the root directory
    * Dragged the UtilityScripts folder to the Plugins directory

    The Resources folder doesn't like to be moved, AppID is stored there at the start. Works fine left where it is, and using another Resources folder in the root directory for my game assets.

    Reading your suggestion again about not moving the UtilityScripts folder, can I assume that none of my javascripts will be looking for them directly (everything works through Photon.Monobehaviour, and all C# scripts can see each other regardless of compilation order) therefore it's ok to leave them in the Photon folder?

    Thanks again, all your help (and fine product) are greatly appreciated. All the Best.
  • The UtilityScripts folder only contains very simple, specialized scripts.
    Example: I commonly needed to connect and join a random room in the demos, so I created a UtilityScript ConnectAndJoin (or similarly named). With that, I can join a random room by dropping the component into any scene.
    You usually don't need them but you could look up how some tasks can be done.