Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to convert my actual RPC code to NetworkManager?

Discussion in 'Multiplayer' started by Funforge, Jun 19, 2015.

  1. Funforge

    Funforge

    Joined:
    Jun 18, 2015
    Posts:
    9
    Hi,

    I have a local multiplayer game working with NetworkView component, networkView.RPC() functions and [RPC].
    Since the 5.1, RPC is obsolete and then I want to convert my code.
    I've found that I can replace [RPC] with [ClientRpc] but is it possible to replace networkView.RPC() code line too? and with what? I can't find it on docs or forums.
    EDIT: I've learned about UNET but if there is a way to just replace my actual code without start over, I'll take it!

    Thanks for the help.
    Thomas.
     
    Last edited: Jun 19, 2015
  2. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    If you find a way to do that I'll give you a cookie. Been working through 133 warnings about deprecated RPC calls one-by-one.

    That being said - I do like the new system for the most part minus some headaches surrounding how RPC calls functioned locally.
     
  3. Funforge

    Funforge

    Joined:
    Jun 18, 2015
    Posts:
    9
     
    KelsoMRK likes this.
  4. FoxCastz

    FoxCastz

    Joined:
    Jun 18, 2015
    Posts:
    75
    I got it to work for my movement code, but I am worried I will have to rewrite my chat system for a 5th time... each time I rewrite it takes longer instead of shorter to do...
     
  5. gsus725

    gsus725

    Joined:
    Aug 23, 2010
    Posts:
    250
    I know what you mean, I think game engines are trying to change themselves to "let artists create gameplay without any code" but then that SCREWS the programmers because usually it makes it take even more code for us to do the same thing. Programmers are who create the gameplay. I don't see that changing any time soon. Game engines should cater to them. Graphic artists already have their programs to cater to them, Maya, etc

    Game engines should only do such things when it doesn't negatively impact the programming side. But taking more code to do the exact same thing is always a fail
     
  6. Swiggies

    Swiggies

    Joined:
    Mar 28, 2014
    Posts:
    11
    I do like the new networking system besides how RPC's are done. Legacy was so much easier, shorter and cleaner especially when I wanted everyone to receive an RPC. Now the only way I can figure out to do it is with 2 different functions. Just bring a similar way to do RPCMode.all back and I'll be happy.
     
  7. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    The legacy RPC method was doing the same thing - it just abstracted it away for you. IE - RPCMode.All routed through the server; but the behavior was inconsistent. Calling an RPC on a specific player didn't work from client-to-client and you had to explicitly route it through the server yourself. At least the new system is consistent.
     
  8. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    RPCMode.all and the old Network.Destroy() are insecure. Allowing a method for clients to do things on other clients makes it possible for clients to cheat. The networking HLAPI has a security model that requires server validation of requests from clients so that cannot happen.
     
  9. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    So i have the same probleme but ... In version 2019.1 so [ClientRpc] doesn't work, what can i do ?
     
  10. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Pretty sure this networking framework is deprecated at this point. More info here -https://unity.com/products/multiplay
     
  11. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Unet was deprecated a couple years back, and the HLAPI portion was removed from the core editor and moved to a package for those still using it. If you're just starting a new network game project, choose an alternative network implementation.
     
  12. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    No i would like to put an old 2017.1 project on WebGL, but i can't build because of the depreaceted RPC so if i have too update this project, i wanna do it on 2019 unity version but rewrite all of code it was too hard for those kind of project :/.
     
  13. frangagn

    frangagn

    Joined:
    Sep 20, 2018
    Posts:
    53
    Alternative like what? I'm looking through these forums and website and cannot find something clear on this..
     
  14. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
  15. NagyAbelGergely

    NagyAbelGergely

    Joined:
    Apr 1, 2020
    Posts:
    1
    I have to upgrade a project from 2017 to 2020 is there way I can install the old networking in the 2020 editor. I have installed the HLAPI but it still doesn't work. Do I have to rewrite the entire networking to mirror or other framework?