Code randomly working (problem with cast or binding)
I have a problem since this morning with the game I'm currently developing, and I don't remember having done anything in particular that might have caused it. This problem is a little blurry even for me, and I don't know if it is a bug within the Blueprint System or an error that I created. The code that isn't working is supposed to get information from a widget in the level and modify it, so it uses casting and bindings. What's weird about this whole thing is that it doesn't seem to have anything to do with my actual code, because it works randomly.
For example, sometimes it works in the editor window but when I try to launch it as a standalone game this part of the code doesn't work. One try after (without modifying anything) it doesn't work in the editor window, and the same things happen when I launch the game in the viewport. Note that it works randomly with the editor window and the viewport but never as a standalone game.
Here (viewport) I placed 4 units on the grid and the progress bar at the top right corner shows that I have 4 out of 20 units placed.
But if I now launch the game in a new editor window, the progress bar is no longer working. And it is the same if I launch the game in the viewport again.
Here is the code that is supposed to increment the variable in the widget to update the progress bar.
It only works again if I modify the code but only a certain way (i haven't figured it out yet but it seems that it works again only if I change code or default values of variables that have something to do with the casting of the widget inside my blueprint). Note that I don't have to actually modify what the code does, only replacing a function by the nodes it contained or printing a variable from the casted widget for example.
This problem is also going on with other functionalities that I implemented a long time ago (unlike this progress bar) and that are working only when the bar does, so I don't know what to do and it makes the development of my game nearly impossible.
If you have any idea please share it with me, it would help me a lot. Don't hesitate if you want more screenshots or details about the problem.
Follow this question
Once you sign in you will be able to subscribe for any updates here