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++ custom component can not see/edit defaults unless added in BP

Hi, banging my head against this, maybe someone can help.

I have a newly created component derrived from UStaticMeshComponent (I use a mesh overlap as the start of the aiming system). When i add it to my player controller in c++, the details panel is blank, when i add it via blueprint, it is populated properly, i have no idea why.

header file for player controller has this code:

 private:
     UPROPERTY(BlueprintReadWrite, VisibleAnywhere, meta = (AllowPrivateAccess = "True"), Category = "Components")
     UAimAssistComponent* AimAssistComponent = nullptr;

cpp file has this

 AMyPlayerController::AMyPlayerController()
 {
     AimAssistComponent = CreateDefaultSubobject<UAimAssistComponent>(TEXT("AimAssist"));
     AimAssistComponent->bEditableWhenInherited = true;
     AimAssistComponent->SetupAttachment(GetRootComponent());
 }


if i add my component via BP editor, i see all the details i would expect so i assume my problem is with the c++ bit above. Weird thing is though that i duplicated this code for adding a dummy static mesh component and i could see its details fine.

Any help or pointers on where to start looking would really help.

Product Version: UE 4.20
Tags:
more ▼

asked Sep 23 '18 at 05:11 AM in C++ Programming

avatar image

QuackGoesDuck
11 5

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

3 answers: sort voted first

Did you use hot reload? While this can be fine when modifying a bit the core of some functions when adding new features it can be a bit faulty. I usually quit the editor and do my modifications / implementations and then relaunch to test the whole thing. When my cpp classes are inherited or else I tend to reparent everything and basically just redo the whole import and such. C++ is not awesome for updating it's own changes on the run unlike scripted languages.

more ▼

answered Sep 23 '18 at 01:46 PM

avatar image

TheDreamCatcher
263 2 4 5

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

Try the following UPROPERTY specificers:

 UPROPERTY(BlueprintReadOnly, VisibleDefaultsOnly, Category="Components", Meta=(AllowPrivateAccess="true"))
more ▼

answered Sep 23 '18 at 08:31 AM

avatar image

MazyModz
266 4 5 6

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

So somehow my BP version of my player controller had got itself into a strange state. Making a new one seems to have fixed the issue. A bit worrying though. If anyone knows how i might have recovered from this without having to delete and rrecreate the BP that would be really useful.

more ▼

answered Sep 23 '18 at 05:34 AM

avatar image

QuackGoesDuck
11 5

(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