I have two level in one project ,i want to use two different HUD. is that possible?
and the method to change level …Is that using command node is the only way?(node name is “open level”?)
I have two level in one project ,i want to use two different HUD. is that possible?
and the method to change level …Is that using command node is the only way?(node name is “open level”?)
yes,i mean change the HUD at runtime.And change level at runtime too.
instead of switching to a different HUD, why not combine the functionality into the same HUD, and use a branch node or switch On Int to change which parts of the HUD gets called.
that’s a good idea but how can engine figure out whitch level I am running?
under Project Settings > Maps > Default Level, you can choose what level opens first in your game. if you want to change levels in game, use an OpenLevel node. if you want your level to behave differently than other levels, that information might belong in the level blueprint, or if you want a level to use a different game mode, pawn, player controller, or HUD, you should goto Window > world settings at the toolbar on the top of the editor, and inside world settings, you can set a GameModeOverride for that level.
if you want to know the name of the level you are in, blueprint does not have a node for that, so you could instead just store a string in your custom Game Mode, and set its value from the level blueprint to whatever the level is called on EventBeginPlay.
Use this solution. Worked well for me
Its a solution to change the HUD at runtime (in game), pressing a KEYBIND, or hitting a Trigger.
Simple thing to do is use the APlayerController’s ClientSetHUD node.
Here is the C++ for it:
/** Set the client's class of HUD and spawns a new instance of it. If there was already a HUD active, it is destroyed. */
UFUNCTION(BlueprintCallable, Category="HUD", Reliable, Client)
void ClientSetHUD(TSubclassOf<class AHUD> NewHUDClass);