Search Unity

yield return in a Network Message???

Discussion in 'Multiplayer' started by Royall, Jul 9, 2015.

  1. Royall

    Royall

    Joined:
    Jun 15, 2013
    Posts:
    121
    I have a network message send from the client to the server (email/password).
    Code (CSharp):
    1. void OnLoginRequest(NetworkMessage mess) {
    2.         var readmess = mess.ReadMessage<Controller.loginRequest>();
    3.         Debug.Log(readmess.email+" sended a login request...");
    4.         //WWWform to check the email and password here
    5. }
    The server checks with a WWWform if the email/password combination exists.

    Problem is with a WWWform you need to yield the www result but this is not possible with a void... I also cant change it to a IEnumerator cause it says network messages can only be void...

    What to do??
     
  2. Zephilinox

    Zephilinox

    Joined:
    Sep 15, 2014
    Posts:
    14
    Why don't you just make a coroutine for the WWWform and start it in the OnLoginRequest?
     
  3. Royall

    Royall

    Joined:
    Jun 15, 2013
    Posts:
    121
    That's what I did atm. But it just doesn't feel right cause now I have 2 functions... Hope someone knew a workaround...