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"

Using UMG Widget Blueprint As Material

I am trying to generate a computer screen using UMG, basically rendering a UMG widget on a 3D object. I know this question asked quite a bit around but the answers are not detailed enough to provide a full implementation.

Here is what I tried:

  • I created a Widget Blueprint in UMG with some basic text.

  • FStringClassReference TestWidgetClassRef(TEXT("/Game/WB/TESTUI.TESTUI_C")); if (UClass* TestWidgetClass = TestWidgetClassRef.TryLoadClass()) { UUserWidget* WidgetUI = CreateWidget(GetWorld(), TestWidgetClass); }

  • UWidgetComponent* WCUI = CreateDefaultSubobject("WC_Test"); WCUI->SetWidget(WidgetUI);

  • Finally, I try to get the material instance or render target variables of UWidgetComponent but both are NULL, and material count also shows 0 along with WidgetClass not set to anything.

What am I missing here?

Product Version: UE 4.8 Preview
more ▼

asked Jun 07 '15 at 12:09 AM in C++ Programming

avatar image

35 3 8 11

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

1 answer: sort voted first

The MID isn't created until it's needed, you would need to wait until after the first tick, which is when it attempts to initialize all those things. Why do you want access to them, because they were not really intended to be accessed directly.

more ▼

answered Jun 15 '15 at 02:26 PM

avatar image

Nick Darnell ♦♦ STAFF
6k 77 37 151

avatar image eozgonul Jun 16 '15 at 05:54 AM

I will try not to bore you with details but I am trying to implement a functional display of an aircraft where you can see data related to engine, fuel, attitude, navigation etc.

alt text

This MFD device is located in front of the pilot inside cockpit, so I have to render it to the vehicle mesh I have created. I also need to blend UMG render target with a camera feed, so that pilot can see the camera feed inside this device with related data.

Should I take a different approach under this condition?

avatar image eozgonul Jun 23 '15 at 07:56 PM

I tried getting the material instance after first tick in my vehicle class but it is set to default checkered pattern material. RenderTarget2D variable of WidgetComponent is also set to null still.

avatar image eozgonul Jun 27 '15 at 10:56 PM

I think the problem occurs from WidgetClass not being set properly. When I set the widget using SetWidget function, UWidgetComponent::Widget variable is set, but in InitWidget function, it reverts back to nullptr since WidgetClass is not set to anything. Should I post a bug report regarding this?

avatar image Stunt Thumper Dec 17 '15 at 09:08 PM

Was this ever figured out?

(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