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"

C++; Widget not getting visible when calling parent's SetActorHiddenInGame(false)

UE4.19

In the constructor of my class (let's call it "Menu"), derived from Actor, I create the following widget:

menuWidget = CreateDefaultSubobject(TEXT("Widget"));

menuWidget->AttachTo(RootComponent);

menuWidget->RegisterComponent();

In the editor, in the BP derived from this class (lets call it "BP_widget"), I set the class of the widget. For testing purposes, I also add a cube and a another widget (lets call it "secondWidget") as children of the widget created by code. The "menuWidget" and the "secondWidget" have the same rotation and everything else. All components (the "menuWidget", the cube and the "secondWidget") are visible in the editor. If I add the "BP_widget" manually to the level using the editor, they are all visible correctly during the gameplay.

At BeginPlay in the "BP_pawn" I initialize an object of the type "BP_widget" (let's call it "widgetObj" and call "widgetObj->SetActorHiddenInGame(true)".

On trigger button event in "BP_pawn" I call "widgetObj->SetActorHiddenInGame(false)" (calling tested both in code and in BP). This sets all (cube and "secondWidget") components except the "menuWidget" to visible.

I found that after removing the line "menuWidget->RegisterComponent();" from my code from above, the "menuWidget" will be set to visible correctly and all the components will be visible.

Product Version: UE 4.19
Tags:
more ▼

asked Apr 11 '18 at 06:14 PM in Bug Reports

avatar image

Constantin Suman
44 2 7

avatar image Jeff A ♦♦ STAFF Apr 12 '18 at 03:31 PM

Hello,

We've recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://forums.unrealengine.com/unreal-engine/announcements-and-releases/1410408-unreal-engine-bug-submission-form

Thanks

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

0 answers: sort voted first
Be the first one to answer this question
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