Good day everyone!
Information: I have setup an OnActorClicked to create a grid with buttons and got it working! So when I press play it starts and when I click on the Actor it creates the widget… however when I test it in the map level “testMap” and press play there it won’t work… If I start it from any other Blueprint or try Standalone game it works, seems like only when i press play when in the map level it won’t work…
Question: Is this a bug or is it a setting I have missed somewhere?
You didn’t set up your OnActorClicked event scripting in the level blueprint by chance, did you? That would be the most obvious reason why blueprint script won’t work in a different level.
Maybe I was unclear, it’s the same map but It’s different if I Press play from a blueprint or if it is while the map is the active window! If you know what I mean?
Ah, I think I understand.
You’re saying when you use the Play button in the main editor (next picture), your blueprint script does not work.
And when you use the Play button from within your blueprint (next picture), your blueprint script does work.
Do I have it right?
Yes that is right, do you know why that is?
Edit: and it also works when I try Standalone Game, and in new editor viewport! So might be some setting in the main viewport?
I do not know why that is. I’m afraid I’m stumped.
Hopefully someone else comes along and can lend some knowledge, because I’m now curious too!
Well I thank you for your help anyway, such a strange problem I guess I could live with it but it would be nice to fix it, so let’s hope someone knows!
I’m going to try to fix it first, but if I fail I’ll see if I can pack it up! it appears that it does work but the widget doesn’t show up in the viewport, because if I remove the widget it wants to create there is an error when I click the actor!
Edit: And Text in construction didin’t work!
Any chance you can pack up your game and send it to me? I can take a look at it for you and try to debug it. It’s really hard to diagnose without a proper examination of whats actually going on.
Or even just the Blueprint, not the entire game.
Without actually having the blueprint in front of me to diagnose. I can only think of one thing. The Blueprint isn’t being called. Ex. if the blueprint is on an actor, and the actor is placed in the world, but the Blueprint isn’t referenced then the blueprint wont initialize. (won’t run the blueprint) However, when you play in Standalone, it references all actors throughout the loaded level, as long as they are in the level somewhere or manually referenced. When you are in the blueprint editor and push the play button, it specifically references the actor in question. You said that you have an event for the “OnClickedEvent” which is a good way to reference the actor, however the actor isn’t initializing before you click the button, so what I recommend you do is in the Construction Script, do something, anything, like maybe declare the value or a variable or something. Just make a blank text variable and in the Construction Script set the Text variable to equal “Hello” or something and then test it again and see if it helps. (Again this is just a theory and not a guarantee of whats going on)
Oh god no I feel so stupid now… I figured it out, somehow the Anchoring in the widget had reset so it was anchored in the top left corner so the widget ended up outside the screen! Thank you guys for your help anyway, I’ll do way more testing in the future sorry! D: