Download

[Multiplayer] Cast to MyCharacter fails many times at GameStart

Hello.

I’ve a WidgetBlueprint to constantly display the number of Ammo of my current weapon in the multiplayer game:

1.jpg

And at the end of the game, this is displayed:

2.jpg

I set a Weapon as default when the game starts.
This might occur because there’s a little (very little!) ammount of time in which the Starting Weapon isn’t set yet.

The point is that these error messages are annoying AND, most importantly, since there are tons of errors that say the exact same thing, that would most likely keep me at the dark of other issues when they occur.

This because everytime that I see this: 3.jpg, I quickly think “ah, doesn’t matter, it’s the widget blueprint”… instead it might happen that there occur other kind of errors that I will not even notice!

Anytime I get an accessed none error I use an isvalid? node to fix it, so for example I would pull off the output of GetCurrentWeapon and connect it to the “isvalid?” the node with the question mark and has the outputs is valid and is not valid.
That clears up my accessed none errors.

Yup as ptJackson wrote. Not all blueprints and actors are loaded before you run your script, so IsValid is quite valid way to remove those errors.

@ptjackson @Nawrot

I set my CurrentWeapon in C++ at Game Start, and this is my WidgetBlueprint

16b70bdb033aa2d4cdbfba3bff437d74b8c1ad17.jpeg

For some reason, when I run the game on the client it shows NULL (the return node).

The server, though, is working:

f74bdbde677a7c25fe3bc6de198e986bb506e3cf.jpeg