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"

Why is myWidgetClass returen NULL?

Hi! Guys.

Now, I am testing UMyWidget with UMG and C++ by UUserWidget.

  1. I made MyWidget Class.

#pragma once

#include "Blueprint/UserWidget.h"

#include "MyWidget.generated.h"

/** /

UCLASS() class REALGOLF_API UMyWidget : public UUserWidget { GENERATED_BODY()


#include "WidgetTest.h"

#include "MyWidget.h"

  1. I made Widget Blueprint name 'MyTestWidget'. alt text alt text

I don't anything in GRAPH tab.

  1. I Modified MyController.h

    // The class that will be used for the MyWidgetUI UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Player, HUD and UI") TSubclassOf myWidgetUIClass;

    // The instance of the MyWidgetUI Widget UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Player, HUD and UI") class UMyWidget* myWidget;

  2. I modified MyController.cpp

#include "WidgetTest.h"

#include "MyWidget.h"

#include "MyController.h"

void AMyController::BeginPlay() { Super::BeginPlay();

 // Only create the UI on the local machine (dose not excist on the server.)
 if (IsLocalPlayerController())
     if (myWidgetUIClass) // Check the selected UI class is not NULL
         if (!myWidget) // If the widget is not created and == NULL
             myWidget= CreateWidget<UMyWidget>(this, myWidgetUIClass); // Create Widget
             if (!myWidget)
             myWidget->AddToViewport(); // Add it to the viewport so the Construct() method in the UUserWidget:: is run.
             myWidget->SetVisibility(ESlateVisibility::Hidden); // Set it to hidden so its not open on spawn.


  1. I compile and execute. But can't display Widget. myWidgetUIClass is null pointer.

Why is myWidgetUIClass NULL.

What's wrong?

Help me please.

Engine version : 4.7.0 OS : Windows7

Product Version: Not Selected
mywidget1.png (103.0 kB)
mywidget2.png (17.4 kB)
more ▼

asked Mar 28 '15 at 10:38 AM in C++ Programming

avatar image

51 9 16 17

avatar image Shadowriver Mar 28 '15 at 02:08 PM

Check log, you might have info there

avatar image 황용수 Mar 29 '15 at 07:03 AM

Where can i find log?

I can't find log about widget blueprint in log windows.

I think that widget blueprint not executed.

How can i call widget blueprint.

avatar image Nimgoble May 27 '15 at 04:23 AM

Having this same issue.

avatar image Vaclav.Jarko Jun 04 '15 at 10:13 PM

So any advice ?

avatar image Nimgoble Jun 04 '15 at 10:51 PM

See my answer.

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

1 answer: sort voted first

I eventually got this to work. It turns out that BeginPlay might not be called on the client, which is where you want to create your widget. So, I moved my widget initialization code to ClientGameStarted_Implementation of my custom PlayerController. There are probably other methods you could initialize your widget in, like PostInitializeComponents.

more ▼

answered Jun 04 '15 at 10:50 PM

avatar image

31 1 3 8

(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