Download

Widget works as expected but gives ~Accessed None~ error

Hi all.

 I have a widget that is created from GM (GameMode).  It behaves as expected (functions bound to textboxes), but even when created directly after BeginPlay in GM gives a round of Accessed None from GMRef.  My understanding is for some reason it tries to access GM before something is initialized, then next try it is good, but if it is created from GM how could GM be unreadable?  If I create it further down the GM BeginPlay path (after some array setting), it gives 3 rounds of the same error.  Does it try to display functions before it has even cast to GM?

I have ignored it for a week, as functionality is there, but it is cluttering my message log and head o.O

tried game instance or player controller instead?

& do you have your game instance then game mode set in your world settings? :slight_smile:

To prevent cheating the gamemode exists only on the server. Most likely create widgets in the gamemode. GetGamemode returns a null pointer on each client. Better create your widgets in the player controller.

But when your widget works as expected this errors occur probably on very shortly after BeginPlay. So add an IsValid node there and the errors wont come anymore.

Hey there,

as the previous answers already suggest, the GameMode is not valid on Clients.

This one only exists on the Server. You can use your PlayerController, which is unique per Player (Server has a Copy of each though),
to create an store your Widget.

If you need to share information from Server to Clients, make sure to forward this information from the GameMode to the GameState
and let the Clients use the GameState. This is the Central class for GamePlay information.

It also holds an array of PlayerStates, in which you should store GamePlay information about each client.

Best thing is, to read my compendium, as it explains each class and tells you which classes exist where.

http://cedric.bnslv.de/unreal-engine-4-network-compendium-released/

This is a local hotseat game with no networked component so I thought I could cut down on some of those aspects. I tried adding isvalid in a few spots with no success. Obviously I am using the class in an unintended way, so will transfer relevant parts across to intended class and remove bad habits and understandings.

I remember coming across that compendium a while ago and got some useful stuff on a quick browse, probably time to dig deeper.

Cheers.