Cast or bind not working in standalone/build

Hi,

I’ve not been using Unreal for lng so I dont know if I am missing some basic stuff. I checked most of the threads here and nothing worked. So I’m gonna describe what happens:

I have a game instance that sets some level managers I’m casting in different blueprints to get dirfferent references and bind events.
Thing is, that whenever I play on editor, everything is fine. When I play standalone, it sets the game instance but says “accessed none trying to read” whichever reference it might be. And I can’t understand why.
I tried to add some delays to the cast, it was worse.
I checked both prject settings and the .ini files and everything is as it should be.

I am going nuts with this. Please help.

Is it that the references are really None or that the cast is failing?

If it’s the references then it could be because of the order of events. So like, in editor A is happening first, then B, but in standalone it’s B then A. In that case, the things that B expects A to have initialized won’t be. Try adding some print-strings in to make sure.

Or maybe A isn’t happening at all in standalone.

Hi, I’ve been checking and on build an error comes up saying “accessed none” to the things I’m casting first. On standalone, they dont work when I put a print to see if it’s working. The binds work on build, standalone and editor but without the references they are pretty useless.

I’m using a sequence node, first thing I always cast is the game instance, then the manager I need, then the rest of the blueprints I might need. Is that alright?

you have screen shots?

Yea, that’s what I was thinking too…usually the case when everything else looks good. Game instance is the first thing to execute, so if it’s looking for certain actors that haven’t been created yet you might get that issue.

Where is this happening? BeginPlay? The constructor? I think we might indeed need screenshots.

first one is the character, second one one of the levels. Does that suffice?

I’m not using the constructor for any of this. I’ts all happening at the BeginPlay.I posted some screenshots above. (Thanks for helping out on this)

I don’t see the print strings in the screenshots. Please show the print strings in the code and explain again what happens. I’m sorry but I found your last explanation a bit confusing. Maybe even show a screenshot of the print string output when you run it (you can set the ‘duration’ to something high like 10 so it stays on the screen longer).

In the editor, it is setting the managers that the game instance sets and everything works.
When in standalone, sets the level managers in the game instance but it does not set the level managers in other blueprints (level blueprint, for example). Level managers need the reference from the game instance.
On build, says that the reference (managers, dialogs, and others), whenever used, accesses NONE.

Is that helpful?

Put a print string right after the Level’s BeginPlay node. Does that display when you run it in standalone?

It displays the string of the beginplay, but prints nothing until the bind.

I’m having trouble understanding almost everything you have described. It would really help if I could see the BPs with the PrintStrings in there. I’m not even sure what the BP screenshots you put up are from – on is the level, what is the other? Both call GetGameInstance so I assume neither is game instance BP.

Solved. The problem was that I was instancing actors with a game instance but that just instances stuff at the beggining of standalone/build, not thoughout all levels.