In order to make it simpler, let’s say we have a basic collector game with a portal to the next level.
So there are mainly 6 Blueprints - Character, Item (Collectable), Portal, GameMode, Level and Widget.
Game description:
- At the beginning of a level, the LevelBP calls an “Initialize” function of the GameMode (it counts “all Actors of a Class” and sets a variable).
- The Item calls after collecting a “DecreaseAmount” function in the GameMode
- The Portal should be activated/sapwned after collecting the last Item @Q2
- Upon entering the Portal, a message “Level Completed” appears and after a small delay a new level is opened @Q3
The WidgetBP(HUD) contains a counter (indicating the number of Items left to collect) and a text “Level Completed” (hidden by default).
Here are my questions:
- Q1 - Where should the Widget be created (Character, Level or GameMode), so that the access to its components wouldn’t be complicated/annoying?
- Q2 - Is the GameMode or LevelBP responsible for creating the Portal?
- Q3 - Which Blueprint should handle the “Level Completed” message and open a new level?
- Q4 - What if we would further monitor the Characters HP in the Widget? Would the project structure change? Should there be two widgets used in that case?
Any help would be greatly appreciated!
1 from the sound of things i would probably have most functionality in the game mode in this case. this way you can keep things neat and organized and it will allow most gameplay elements to be easily located.
2 i would have the portal as its own blueprint in the level. that is unless you want to spawn it in dynamically so that it appears near the player but that is a bit more complex. if your spawning in the portal you will also need to come up with a way to tell it which level to open. while you could do this all in the level bp it would require you to duplicate the script for every level which isnt a good method since it will make it difficult to make changes to. if you make it a actor bp thats placed in the level then you could have the level to open as a public variable so you could easily set it from the details panel.
3 for the creation of the level completed widget i would again have that as part of the portal bp since the widget should only be created when the portal is activated so they are closely related dependency wise (so to speak).
4 if you were going to monitor the characters hp then that widget could be created anywehre you like really as long as it get created at the start of each level (so gamemode, character, or player controller would work). as for having two widgets im assuming you mean one for health and one for collectables needed, that again is really personal preference but you could easily make them into one widget if you liked.
Now it makes a little more sense to me. Thank you very much.