The event EventHandler<SelectedResponseEventArgs> SelectedResponseHandler; is throwing null, and I'm not sure where the problem is.
My dialogue class is a subclass of the StandardDialogueUI.
I override the ShowResponses, perform my responses logic, and then pass it to the base.
Everything is working till I send a selected response via the code "gamepad" press, keep getting null on the event,
I double-checked if it was the response, but I do see my response showing up with dialogue system info as selection or with the breakpoint.
It does seem that my implementation of SelectedResponseHandler is off.
It does work if I select my response with a mouse click; it does show up my response, once in the dialogue info, so I'm not sure where the problem is.
Here is my code.
Code: Select all
public override void ShowResponses(Subtitle subtitle, Response[] responses, float timeout)
{
// Add your code here to show the player response menu. Populate the menu with the contents
// of the responses array. When the player selects a response, call:
// SelectedResponseHandler(this, new SelectedResponseEventArgs(response));
// where the argument "response" is the response that the player selected.
// If (timeout > 0), auto-select a response when timeout seconds have passed.
responseContextsArray = new ResponseContext[responses.Length];
for (int i = 0; i < responseContextsArray.Length; i++)
{
responseContextsArray[i] = new ResponseContext(
responses[i],
conversationUIElements.menuPanels[0].buttons[i],
selectedResponseScaler,
responseScalerMaxLerpTime
);
}
enableResponseInputFlag = true;
skip = true;
base.ShowResponses(subtitle, responses, timeout);
}
Code: Select all
private void CommitResponseForwardEventObserver()
{
if (enableResponseInputFlag && skip == false)
{
Response temp = responseContextsArray[currentResponseIndex].GetResponse();
SelectedResponseHandler(this, new SelectedResponseEventArgs(temp));
}
skip = false;
}