Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
  1. #11
    Join Date
    Oct 2011
    Location
    Norway
    Posts
    21
    Quote Originally Posted by Sethanon View Post
    When I create a new user, the correct user name spams into the Unity console and displays correctly.
    As you will notice, the Register method takes in a parameter from username (which is the value typed into the textbox), which is the value set to _displayUsername -- NOT the username received in the response. Thus that is not evidence of a valid response object.

    Did you do as I suggested? Did you check the database and verify that the fields are set properly for each row? And debug the LoginHandler (attach debugger to photon) to see if correct values were extracted? Best to start at the root to discover where the error occurs (unless there are obvious indications)

  2. #12
    Join Date
    Aug 2011
    Location
    WA State
    Posts
    40
    The database fields are populating correctly when the user registration takes place.

    I haven't had a chance to debug the server side yet. I'm hoping to take a look at that before the class this evening.

    -Seth

  3. #13
    Join Date
    Mar 2013
    Posts
    1
    Hello there,

    For some reason the same issue arose for me now too, with the difference that it happened to me due to the changes in the last class:

    Code:
    private void Login(string email, string password)
        {
            _state = LoginState.Sending;
            NetworkManager.Instance.Dispatch(new LoginCommand(email, password), response =>
            {
                if (response.IsValid)
                {
                    if (response.Response == null)
                        Debug.Log(string.Format("Response is null of type {0}", response.ToString()));
                    GameManager.Instance.UserId = response.Response.Id;   // <-- That is the null exception on response.Response
                    return;    
                }
                
                _state = LoginState.Error;
                _error = response.ToErrorString();
            });
        }
    After debugging what I have found is that the NetworkManagercorrectly receives the Response parameter from the server upon dispatching the login command. Meaning the Response paramater is filled correctly server side, and received correctly client side. However, for some reason the response used in the Login function is not filled with the correct data.

    That is my Dispatch function:

    Code:
    public void Dispatch<TResponse>(ICommand<TResponse> command, Action<CommandContext<TResponse>> action) where TResponse : ICommandResponse
            {
                //! Extract commandId first
                var commandId = Guid.NewGuid();
                _commandCallbacks.Add(commandId, serverResponse =>
                {
                    var parameters = serverResponse.Parameters;
                    var response = default(TResponse);
    
                    //! Debugging shows that response here is _correctly_ filled
                    if (parameters.ContainsKey((byte)MMoOperationResponseParameter.CommandResponse))
                        response = DeserializeBSON<TResponse>((byte[])parameters[(byte)MMoOperationResponseParameter.CommandResponse]);
    
                    var propertyErrors = (byte[])parameters[(byte)MMoOperationResponseParameter.PropertyErrors];
                    var operationErrors = (byte[])parameters[(byte)MMoOperationResponseParameter.OperationErrors];
    
                    action(new CommandContext<TResponse>(
                        response,
                        DeserializeBSON<IDictionary<string, IEnumerable<string>>>(propertyErrors),
                        DeserializeBSON<IEnumerable<string>>(operationErrors, true)));
                });
    
                DispatchInternal(command, commandId);
            }
    Any idea where else to look? I am running out of ideas a little.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •