Problem with unityScript

i have a problem with photon in unityScript. I put the PUN in the plugin folder and in my scripts i put :
public class Lobby extends Photon.MonoBehaviour{}
So i should work. But i have 3 errors from the tutorial marco polo (demo worker) :
Assets/Photon Unity Networking/DemoWorker/Scripts/Menu/MainMenu.cs(43,63): error CS0122: `PhotonNetwork.networkingPeer' is inaccessible due to its protection level
Assets/Photon Unity Networking/DemoWorker/Scripts/Menu/MainMenu.cs(43,27): error CS1502: The best overloaded method match for `UnityEngine.GUILayout.Label(UnityEngine.Texture, params UnityEngine.GUILayoutOption[])' has some invalid arguments
Assets/Photon Unity Networking/DemoWorker/Scripts/Menu/MainMenu.cs(43,27): error CS1503: Argument `#1' cannot convert `object' expression to type `UnityEngine.Texture'
But i dont know why i have them.
I dont have any error when i dont put the PUN folder in plugins but i cant use unityScript (unknown identifier) if i dont do this.
Sorry if my english is bad.
Thanks for your attention.


  • Tobias
    The error is:
    `PhotonNetwork.networkingPeer' is inaccessible due to its protection level

    Means: Wherever you use PhotonNetwork.networkingPeer, it can't be used cause it's not available for that class / script. You're not allowed to use it, cause networkingPeer is private or protected or something.

    I assume your import is incomplete or broken or something. The MainMenu in DemoWorker usually works if it's a clean and complete import of the PUN package.
    Please just create a new project and import the PUN files into it.
  • I already created a new project (because the old had many bugs) and i started it with the Photon plugin. And i have this bug only if i put the PUN in plugin folder but if i leave it in the photon folder, i dont have these errors.
  • Tobias
    Ah, now I got it. Moving it into a plugin folder puts it into another namespace as well. As we skipped assigning them, the file position if relevant.
    As long as you don't need it, don't move it to the plugins folder. If you do and need .networkingPeer, make that public (you can edit the code of PUN and this is not breaking anything).
  • Thanks for you help. But how I can use the UnityScript (js) now ? Because when i dont touch anything, i have :
    Assets/Scripts/Network Scripts/Lobby.js(2,28): BCE0018: The name 'Photon.MonoBehaviour' does not denote a valid type ('not found'). Did you mean 'UnityEngine.MonoBehaviour'?
    I can use the C# but i prefer UnityScript (I like it more).
  • Tobias
    Sorry. A misunderstanding :)
    It seems you will have to modify PUN minimally. Make networkingPeer in PhotonNetwork.cs public. The whole PUN plugin folder must be put into the root of your project. Then it should be available by JS.
    Usually, you don't really have to use networkingPeer but in some cases it will be helpful (which is why our demos do this).
  • When i do what you say i have this : Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs(40,43): error CS0052: Inconsistent accessibility: field type `NetworkingPeer' is less accessible than field `PhotonNetwork.networkingPeer'
    I think Photon is really not friendly with the unityScript :(
  • Tobias
    Argh. So, another follow-up issue.
    Make the class NetworkingPeer also public then.

    The problem is: I actually don't want this class to be public, cause it is not designed for public usage. I'm not sure if you even need the access right now, or if it's some example that just uses it cause I knew where everything is...

    Anyways: I'll take a look and see what I can do for next update.
  • So any update since ?

    same problem here.
  • Tobias
    I didn't want to make the NetworkingPeer public, cause it's only used in very few cases. This means, you will have to modify the code minimally.

    You can always just add a method or property to PhotonNetwork class and there use the PhotonNetwork.networkingPeer.
    Alternatively make PhotonNetwork.networkingPeer and NetworkingPeer public (and anything else needed).

    What do you use it for? Maybe I can add the accessors.
  • I did all the modification you speak about, and i keep getting errors. Before the last update, i just could put the Plugins folder at the root and use JS perfectly.
  • Tobias
    Send me the JS you want to get running and i'll take a look when I got the time, ok?
    Sorry for the trouble.
  • Hi Tobias,

    actually, i imported the PUN asset folder in my project, and for some reason I'm not allowed to move the Plugins folder to the root.

    I tried in a new Project and it worked. Kind of worry why I just cannot move it in my project.

    (+) Having it at root, I can access it on .JS, but it there a way to access monodevelop "Hint" (not sure it's the right word) when using a Photon class ?

    Thanks for your help, I've seen you're doing a huge work here and else.
  • Tobias
    Hm, I have no idea why you couldn't move the plugins folder to the root. Maybe it's overlapping with some existing folder? Try Re-Import?
    I would usually say you can move it through explorer/finder but then Unity will not know you moved it and references will break and you have to re-setup everything.

    The MonoDevelop "hints" are a riddle for me, too. They should show up, as we create a .xml doc file AND you got PUN in source. It really should show up by all means.
    If I get the time, I will try to compile the lib in MD and diff the xml. Maybe it's something simple to fix.

    We use VS and ReSharper for a seamless workflow but I know this is not an option everywhere. Let me have a look at MD...
  • Yeah alright, I didn't get the last part but I understood you're on it.

    Like you said, moving from explorer and you get a total mess..

    (+) Have you been working on PUN Playmaker ? Just in case, (for not beeing able to use RPC from scripts) How to send data else than strings with the PhotonView RPCBroadcastFSMEvent Action provided by Playmaker ?
  • Tobias
    > I didn't get the last part
    Wanted to say: I prefer to work in Visual Studio but will take a look :)

    Edit: As long as the .xml file is next to the .dll library, MonoDevelop will show the hints. I tried with MD from Unity 4. Which version are you using and where are you missing popup documentation for example?

    I was only involved on the Photon side of the Playmaker integration. If you post that question on the Playmaker forum, I'm sure you get help soon.
  • I'm using Unity 4. Which .xml and .dll should i locate to check if there are next to each other ?

    Doing JS scripts, "PhotonNetwork" popup but i'd like then with the dot to popup the static methods from it, such as PhotonNetwork."..."
  • Tobias
    Photon3Unity3D.dll and .xml
    This makes sure context help shows up in a popup, when hovering over some member.

    So you're actually looking for auto-completion or a list of members for a class/instance?
    I don't know how or under which conditions MonoDevelop offers those. I don't see why they should not be there.

  • This is in C# script, I'd like to get the same window in JS script.

    .xml and .dll are at the right place.
  • Tobias
    I'm not sure if Unity's MonoDevelop is having this feature for JS.
    Actually, C# is not much more complicated but pretty clean and faster than Unity Script (afaik). Maybe I can lure you to switch? ;)
  • I might switch on my next projects. Does a project use to have both kind of langage scripts?
  • Tobias
    You can mix languages at will. However to access a script in another language it needs to be compiled before the accessor needs it. Example: The plugins folder with C# must be in root to compile this before your regular JS scripts are compiled (and those use PUN). It gets complicated the more scripts use each other across languages.
  • SrGeneroso
    edited December 2013
    Hi, i was fighting over and over with the same errors in console, I don't fully check it, but this seems working:

    In a few words, move the plugins to the root and also (this part was the part I missed) move to the plugin folder "UtilityScripts" as well.

    Hope helps.

    EDIT - Video it's not mine but I found it after search for a while so I thought that could help somebody else.
  • Tobias
    Thanks for the info and the video! Cool stuff.
    The UtilityScripts are just what the name implies: A bunch of helpful stuff. They might give you a headstart in prototyping but they are not essential for PUN to work. This is why I tend to ignore them. In this case, that created extra issues. Sorry for that.