Application.isLoadingLevel obsolete

Hey I just started building my first game with Photon Unity Network and I have this warning:


Warning CS0618 'Application.isLoadingLevel' is obsolete: 'This property is deprecated, please use LoadLevelAsync to detect if a specific scene is currently loading.' CombatLanes.CSharp E:\GreaseWorx\Projects\CombatLanes\Assets\Imported\Photon Unity Networking\Plugins\PhotonNetwork\PhotonView.cs 308

and a similar warning for line 313. I have tried to impliment the Application.LoadLevelAsync but line 308 is written as :

if (!this.destroyedByPhotonNetworkOrQuit && !Application.isLoadingLevel)

My issue is that when I attempt to replace the "isLoadingLevel" with "LoadLevelAsync" I get this message:


Error CS0023 Operator '!' cannot be applied to operand of type 'method group' CombatLanes.CSharp E:\GreaseWorx\Projects\CombatLanes\Assets\Imported\Photon Unity Networking\Plugins\PhotonNetwork\PhotonView.cs 308


I have tried to replace the "!Application.isLoadingLevel" section of this line also with "(Application.LoadLevelAsync = false)" But get this message:


Error CS1656 Cannot assign to 'LoadLevelAsync' because it is a 'method group' CombatLanes.CSharp E:\GreaseWorx\Projects\CombatLanes\Assets\Imported\Photon Unity Networking\Plugins\PhotonNetwork\PhotonView.cs 308


Now as of right now everything works fine with the warnings. But I would like to clear them up. Is there any correction that I can implement to remedy this? Also line looks like this:

Debug.LogError("OnDestroy() seems to be called without PhotonNetwork.Destroy()?! GameObject: " + this.gameObject + " Application.isLoadingLevel: " + Application.isLoadingLevel);

I haven't tried to replace the ".isLoadingLevel" with "LoadLevelAsync" on this line yet but It looks to me like a simple exchange would suffice.

Thank you for your time and help.
Terry R.

Comments

  • Obviously, Unity made this property obsolete in the latest version(s). I assume you use 5.2 or something?

    LoadLevelAsync is obviously not a simple property:
    http://docs.unity3d.com/ScriptReference/Application.LoadLevelAsync.html
    As it's not a property, we can't simply replace "isLoadingLevel" with "LoadLevelAsync".

    In your case, I suggest ignoring the obsolete warnings.
    We will fix this in PUN and release an update.
    Maybe this takes a few weeks, because I am at Unite and then on vacation, so please bear with us.

    Thanks for the report.
  • No Problem. I'm not one of those People that is like, "I posted this question 3 seconds ago!!!!! Why are you ignoring me? Blah Blah Blah." Do what you need to enjoy your vacation and take your time. Thank you for the prompt reply though. I do appreciate it.
  • I just submitted PUN v1.62 to the Asset Store. It includes a fix for this. I actually just missed checking this in 5.2 though. Let me know if all is OK, thanks.
  • Hulp
    Hulp
    edited October 2015
    Hi,

    I imported the new version (thanks for update btw) in Unity version 5.2.1p3 and got this warning:

    Error importing folder (The pathName assets/plugins is already mapped to 002c89f108a697847977b73c3bbe823e. But the meta data wants it to be mapped to 3ce6ba2a76f9efe48b457e9f05c626e8)

    Is this going to cause any problem or should I ignore it? I have other assets installed as well (Including Playmaker and NGUI).


    EDIT:

    Also, building and running the game gives following warnings:

    Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonClasses.cs(429,31): warning CS0109: The member `Photon.MonoBehaviour.networkView' does not hide an inherited member. The new keyword is not required

    and..

    Failed to add the asset file size for resources.resource
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()



    Just an FYI, I am using Photon Free with Playmaker Photon Bridge package for Unity 5 from over here: https://hutonggames.fogbugz.com/?W928
  • Tobias
    Tobias admin
    edited October 2015
    I think the problem here is that you are importing PUN over an existing version in Unity 5.x. The importing was changed, so that Unity import often doesn't replace a file but creates a duplicate of it. Those end on "(1)" or similar.
    Please make sure your import is ok and that you didn't get duplicate files. In doubt, the source folder for PUN could be deleted, before you import, afaik.
    Make backups before importing.

    PS: I have no warnings when I import into a new, empty project with 5.2.1p3. It must be related to Unity's import/updating.
  • Hulp
    Hulp
    edited October 2015
    Well, importing PUN into an empty project works but importing Playmaker over it AGAIN gives the similar assets/plugin error.

    Error importing folder (The pathName assets/plugins is already mapped to 3ce6ba2a76f9efe48b457e9f05c626e8. But the meta data wants it to be mapped to 002c89f108a697847977b73c3bbe823e)


    Which means I can't use PUN with Playmaker at all (even with Playmaker bridge since the plugin error exists). I don't really know what Unity is duplicating or what that plugin error is about but, I was hoping to use PUN with Playmaker (I am not an expert programmer so Playmaker support of PUN for me is crucial).

    Ah well, I'll just stick to Playmaker and something else that works. I really wanted to use PUN since it is easiest MP implementation working with Playmaker, as far as I can tell. :(

    Thanks for the help though.
  • You should be able to move the files in Explorer/Find, once you have them imported into a new, empty project.
    Or you can remove the PUN files from the project and import the updated ones.

    The problem here is that newer versions of Unity make a mess when importing. It will happen with all kinds of plugins you try to update, afaik.

    I am sorry this happens :(