Very new to the Unreal Engine and programming in general so please go easy on me and thanks in advance for any help
I have a very basic function that spawns a number cubes in a circle that can be changed to half a circle or any value within the set limits. I have a UI which is and branch to help change the value on play but the problem I am having now is that instead of destroying objects 0-9 then re-spawn them with the new values I get objects 10-19 and causes them to jump a little as a result
Either I have done this wrong (Highly likely) or something else is going so on that note here are screenshots of my blueprints.
Are you actually using a HUD? UMG isn’t a HUD. Very few people use an actual HUD based class these days. Also what exactly is the issue is still don’t understand. Can you post screen shots of the UI and the in game play where you can point out the issue and what you actually want to happen because I can’t make sense of this.
First, you can post screen shots as comments, you don’t need to make new answers as this clutters the thread. Second, if you “destroy” an object and then “spawn” a new one in, which is what you are doing the numbers are going to be different. Creating objects 1-10 then deleting them and creating 10 new objects they will be numbered 11-20. This isn’t abnormal. It is just a name. Objects 11-20 should have been placed at the newly specified positions though. Third, you still don’t need a HUD class, UMG is perfectly capable of sending data to other BPs. I don’t get this setup. Perhaps some pics of the HUD/UMG and what you are doing in there might help me understand the rest of these blueprints. Actually, just post everything to https://blueprintue.com so I can actually have a look around all this stuff. I assume you are trying to make a simple circular staircase with each step being offset and slightly higher than the previous one. Beyond that I can’t really follow how you are implementing this mathematically. For example, incrementing the array index in your circular spawn function is very odd, if you wanted that value why not just use the loop index +1?? Increment is equivalent to Get this variable, add 1 and SET it. You can’t “set” an array index.
Ah ok will keep that in mind very new to posting and all that so will get of that after this
What I am trying to make is a interactive sound visualizer so people can change the amount of cubes, if the radius is large or small, ect ect that’s the end game for this. As for the getting the UMG values without the HUD was struggling with due to casting not working other than this way, I do intend to fix it later when I know how to do casting better but for now as long as it works.
With the game mode script its empty and only made so I could add the HUD to the viewport during play
As you requested here are the scripts for you to look at
Thanks for being patient with me
Ok fixed a part of the problem with the jumping when the values change which was the increment int after the spawn actor node so that is part one sorted
So now the only issue I am facing is that when the game first starts on index 1 it does not change it’s rotation at all so it looks as though a cube is missing when it is in the scene but all the other ones from index 2-9 it does rotate correctly and index 0 stays put as it is meant to. Though when I do a respawn it does go to the correct place. For this we have a full circle (360) and the ten cubes so that need to rotate at 36 * index value
Added the updated spawn function below and a screenshot of the problem. Nothing else has changed from the links above
Do you have a value set for the first index in the for loop? It isn’t showing in the link just want to be sure it starts somewhere.
Not 100% sure what you mean but I leave everything at default with the exception of the UMG and should be getting the values from the index value *gap variable
Index0 = 0
Index1 = 36
Index3 = 108
Instead I get
Index0 = 0
Index1 = 0
Index2 = 36
Index3 = 72
For the time being I have a delay attached to my Update Function from the Event BeginPlay so it updates right on play and seems to work like that so I can progress forward a little further while figuring this out.
As a just in case there is something I missed added the blueprint that the Spawn Actor targets for the class