I think it will be an easy solution but I can’t really figure out how can I fix this after researching a lot.
I just made a migrate for some assets from one project to another just to be able to use some blueprint scripting in another project.
The thing is that I have a Blueprint where (in the first project) I stored a variable reference for a blueprint from Event Begin Play. Nothing special here.
But when I migrate this BP to a second new project, everything works fine except storing variables in the Event Begin Play, and I don’t know why this is happening because I changed nothing from one project to another. I basically get access NONE like if the variable wasn’t created so it’s not finding it, right? But i created it and stored it, and the Blueprint is exactly the same as in the other project which actually is working, so for me its being so confusing…
I’m not sure either of what to show with a screenshot because I think it’s just super simple and I’m sure it’s an easy fix, but still, here you have the Event Begin play from both projects:
Just note (in case it was needed) that the variable I want to get is inside another BP widget which is also working here, in the second and new project. The whole thing. The only thing is not working is just getting the variable to not get the Accessed NONE.
Please in case you need something else to help me let me know, specifying what should I take screenshot or whatever you think the problem could be coming from.
When searching for an actor on begin play it’s possible that the actor or widget you’re searching for is not yet loaded. A quick and dirty method to test that would be to add a small delay before setting up the instance. Another solution would be that your widget sets itself as instance or you would create the widget inside the actor that needs an instance of it.
Okay, I added a delay to the event begin play and you’re right! it gets access NONE during the delay, and once it’s done it gets the variable. Any way to fix how to get it right away when hitting play?
Or if I want to follow your second option, how can I do that? I’m quite beginner on blueprints so I really need to know this
It’s not all loading at exactly the same time. Sometimes your widget is already loaded before your other actor, sometimes it’s maybe a millisecond late so you can’t rely on that. Did you migrate into another engine version? My guess would be that they’ve changed the startup sequence / loading order or it’s just a coincidence.
Anyway, the best workaround here is hard to say, without having the full scope of what you’re trying to achieve. If the widget is mainly related to the actor on the screenshot then I’d suggest that you create that widget on begin play of that actor so you can set up an instance then.