x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

where/how to spawn UMG Widgets?

Hello,

i am not sure where i should spawn my UMG Widgets. In the official Tutorials they are spawned in the Character Pawn Blueprints. But i have concerns that this will cause all the UMG stuff to get spawned multiple times, everytime the player dies and a new Character Pawn is created?

I tried to spawn the UMG widgets in my PlayerController Blueprint but it seems it is too early, i can't see anything of the UI ingame if i do it this way.

So what is the best practice where to spawn my UMG Widgets?

edit: Also it seems if the UMG widgets are spawned in the CharacterPawn Blueprint and you run an dedicated server the server crashes because it "Failed to load '/Script/UMGEditor': Can't find file for asset '/Script/UMGEditor' while loading NULL."

Product Version: Not Selected
Tags:
more ▼

asked Feb 09 '15 at 12:23 PM in Blueprint Scripting

avatar image

Denis Sinner
15 2 3 5

avatar image Shadowriver Feb 09 '15 at 01:33 PM

On what event do you spawn widget? can you show the graph? Widget is assaigned to viewport and that exists before playercontroller

avatar image Denis Sinner Feb 09 '15 at 02:20 PM

It is spawned on EventBeginPlay in the PlayerController. I forgot to mention that i only don't see the stuff i dynamically add in the UMG Widget blueprint with "create Widget".

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

If you want to spawn them in the player controller, there's some stuff you gota do in begin play:

1 - Add a small delay, like 0.1. There's currently a bug in the initialization order of player controller, first we create it, begin play is called, then we hookup the UPlayer to it, meaning that isLocalController actually returns the wrong data during BeginPlay for a PlayerController on the server (it thinks all players are local at that time).

2 - Check if the server is dedicated, don't remember the node offhand. Just search for dedicated in the context menu for in the BP graph. Don't create any widgets for dedicated servers.

3 - Check IsLocalController, only create UI for local controllers.

4 - Check if you've already created the UI for this player controller. Make sure when you create the UI you store it in a variable for the PC, so you know if it has been added.

5 - On destroy of the player controller, make sure to remove your widget from the viewport.

more ▼

answered Feb 11 '15 at 11:18 PM

avatar image

Nick Darnell ♦♦ STAFF
6k 77 37 151

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question