Photon (PUN) is giving an error and warnings in Photon scripts

First off, this is a duplicate of my post on UA. With hardly any views and no feedback, thought I would try here. If the problem gets solved, I shall post on both to close the questions.

http://answers.unity3d.com/questions/560375/issue-with-photon-and-unityjavascript.html

Edit : I have also posted this question on the Photon forums (probably should have looked if they had a forum and done that first).

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 :

Also confused as to why the warnings and error only popped up after hitting build. How could the scripts suddenly compile differently? I played it several times in the editor before attempting a build, without a warning or a problem.

I can only assume it’s something to do with compilation order.

You are using javascript?? These errors are from C# scripts (based upon the .cs at the end). My guess is that you have duplicate javascript and C# classes??

Thanks for your reply. That is correct, the warnings and error are coming from the C# files imported with PUN. The only conclusion I can make is the Script Compilation Order. What is odd is that there were no problems until I hit the Build button.

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.

It seems there is a bug with Unity 3.5.7 and this version of Photon. From the correspondence I received from ExitGames :

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.

Thank you mrDave77 for looking at my question.

1 Like

Same issue at 17-07-23, and solved with what you did.

moving the files in the project from the subfolder to Assets\Plugins

Thanks.

1 Like

Moving the imported folders/files into Assets/Plugins stopped the errors, thanks!

I’ll try this and I’ll see if you’re right or false