The problem is that sometimes it crashes me on this exact line always:
_noteWidget->AddToViewport();
And I thought that it could be a problem creating the _noteWidget that don’t succeed of something, but it doesn’t seem to be the problem because sometimes when I open the note it works perfect but then when time passes sometimes it crashes when I execute again the OnAction and sometimes not. I put breakpoints to take a look at the _noteWidget variable and it seems that when it shows correctly the name of the Widget it’s “WBP_Notes_C” but when it crashes is “None”. So that makes me think that the _noteWidget it’s destroying at some point but I doesn’t figure why.
If anyone can help me it would be really apreciated
Hello, there are a few questions.
Did you check (set a breakpoint) on BeginPlay? Maybe some conditions become false.
And second, I suggest that _noteWidgetClass you select from the editor menu. It’s worth checking if the right widget is selected. Believe me, there have been many times when I tried to find a bug and then found out that I just didn’t select the right widget🙃
Hi @3dRaven@JPritchard1010 ! I tried both of your suggestions but it didn’t work, it gives the same crash
I add a screenshot of the crash and the file of the crash too:
In the crash it gives the callstack that in Sophia.cpp in the line 296 crashes but it doesn’t make sense (it’s a null checking and also the code that executes is the one of above, the _currentHandItem OnAction():
if (_inventory->_currentHandItem) {
if (IOnActionInterface* onActionItem = Cast<IOnActionInterface>(_inventory->_currentHandItem)) {
onActionItem->OnAction();
}
}
if (_inventory->_currentChangeCameraItem) {
if (_inventory->_currentChangeCameraItem->GetClass()->ImplementsInterface(UActorBlendInterface::StaticClass())) {
IActorBlendInterface* changeCameraItem = Cast<IActorBlendInterface>(_inventory->_currentChangeCameraItem);
if (changeCameraItem->_cameraActorBlend) {
if (IInteractiveInterface* cameraItem = Cast<IInteractiveInterface>(changeCameraItem))
cameraItem->UseInteraction();
if (ICameraBlendInterface* item = Cast<ICameraBlendInterface>(changeCameraItem->_cameraActorBlend))
item->UseInteraction();
}
}
}
I tried the code you gave me adding another message to debug if it was entering the OnAction and it enters perfectly fine and doesn’t debug anything. I played like 5 minutes non-stop (having in mind that it usually crash in the first minute) and it didn’t debug anything.