Hello!
I really hope I’m asking this question at the right place and my C++ is very weak. I’ll try to give Discord a go after this aswell. I’ve hardly ever used it before, and when I did, it was merely a Skype replacement to voice chat with friends while playing Diablo 3 a good while back, if I remember right.
Also, excuse me for making my first post here, rather than properly introducing myself as suggested in Section 1. I don’t know how recent this course is, but since it was written for Unreal Engine version 4.17, and I’m using Unreal Engine is 4.22 which atm. is not the most recent, I guess I’d be a little late for the party if I did introduce myself.
With that out of the way…
I’m on the course: ’ Unreal Multiplayer Master: Online Game Development In C++’ , part 32 where we’re having the widget buttons respond to C++. I just discovered that I recieve this message in the Output log upon hitting play:
LogPlayerController: Error: InputMode:UIOnly - Attempting to focus Non-Focusable widget SObjectWidget [Widget.cpp(710)]!
(As menttioned in part 26)
We are in ‘UPuzzlePlatformsGameInstance.cpp’.
Commenting out my null-ret for the MenuClass in the LoadMenu() function gets rid of the error, but I’ve confirmed that it does not return a null value, so that’s strange to me.
if (!ensure(MenuClass != nullptr)) return;
I thought it’s purpose was to check that MenuClass doesn’t already exist before we create it…
Anyway, as the error suggests, it stems from later down in the same function, at the line:
InputModeData.SetWidgetToFocus(Menu->TakeWidget());
This is the piece of code that seems to be causing the error and I haven’t encountered it prior to this.
It is suggested back in part 26, that adding the line “MainMenu->bIsFocusable = true;” solves the issue… for part 32 where MainMenu is first introduced and the error occurs.
Forgive me, my C++ isn’t the best, I’m on my first cup of coffe for the day, and it’s been a couple of days between the lectures so I’m having trouble wrapping my head around this.
I have a couple of questions here:
- If the fix works, why it that, how come? I don’t ever recall making a pointer to MainMenu thus far, and atm. I have no idea if I will in the following parts… yet.
- Without any pointers or anything, where do I apply this fix? It’s not clear to me, could you please elaborate?
- Is part 26 really the right place to suggest a fix for an error that occurs first in part 32? Perhaps I’ve gotten this all backwards?
Again, excuse me for posting a question prior to properly introducing myself. It is what it is. I’m looking forward to your reply.
Cheers!
Ps! Sorry, English isn’t my native tongue so my grammar and spelling might be off here and there. Ds!
EDIT: Oh yeah, and I’m not stuck, as this error doesn’t seem to do anything but exist at the moment, but an error still worries me. Since my C++ is limited, I would appreciate a suggestion on how to solve this optimally. As for now, I’ve just added “bIsFocusable = true;” to the Initialize() function in MainMenu.cpp. It’s what I’d typically do, but I have no idea how that’ll affect any future parts… yet.