Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Unity Multiplayer 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:
    369
    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:
    369
    Thanks, that works perfectly!
     
  4. benni05

    benni05

    Joined:
    Mar 17, 2011
    Posts:
    58
    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.