Search Unity

Disable "'UnityEngine.RPC' is obsolete" spam

Discussion in 'Multiplayer' started by any_user, Jun 30, 2015.

  1. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    In a project, I get hundred warnings about obsolete networking functionality. I know there is a new system and I use it in other projects, but I don't want to use it in this case, so my console is permanently full with these warnings since 5.1:

    Code (CSharp):
    1. 'UnityEngine.RPC' is obsolete: `NetworkView RPC functions are deprecated. Refer to the new Multiplayer Networking system.'
    Is there a way to disable this warning globally? Is there a compiler directive like:

    Code (CSharp):
    1. #define USE_LEGACY_NETWORKING
    which would disable the legacy networking [obsolete] attributes, or something like that?

    It currently just makes it impossible to find the "real" warnings, in the console (and in some cases even error messages).
     
  2. nventimiglia

    nventimiglia

    Joined:
    Sep 20, 2011
    Posts:
    153
    Add this to the top of your scripts


    #pragma warning disable 618
     
    tobiass likes this.
  3. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    Thanks, that works perfectly!
     
  4. benni05

    benni05

    Joined:
    Mar 17, 2011
    Posts:
    60
    Didn't work for me. I simply removed the following lines in PhotonEditor.cs , UpdateRPCList method:

    Code (csharp):
    1. if (countOldRpcs > 0)
    2.   {
    3.     bool convertRPCs = EditorUtility.DisplayDialog(CurrentLang.RpcFoundDialogTitle, CurrentLang.RpcFoundMessage, CurrentLang.RpcReplaceButton, CurrentLang.RpcSkipReplace);
    4.    if (convertRPCs)
    5.    {
    6.     PhotonConverter.ConvertRpcAttribute("");
    7.    }
    8.   }
     
  5. hack0160

    hack0160

    Joined:
    Oct 29, 2017
    Posts:
    1
    This works for me

    Double click on the problem, it should bring you to PhotonEditor.cs

    change this line:
    if (method.IsDefined(typeof (RPC), false))

    to this line:
    if (method.IsDefined(typeof (PunRPC), false))

    Cheers.

    This fixed my problem.
     
    sasharomanov9, Xain and kavanavak like this.