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"

Details panel for components created by components (all in C++)

Hello, I'm trying to set up a reusable hierarchy of components, I mean by that a component that will instantiate and attach to itself other component The goal is to factorize code, in my precise case for everything related to the arms of a character, have an arm mesh, a motion controller, and other custom components packed into one "arm" component so I can manage right and left arm without code duplication To simplify things let's say I have one character c++ class, that is inherited by a blueprint. In this class I instantiate a custom scene component, and this custom scene component will instantiate a mesh component and attach it to itself. The problem is when I open the character blueprint, I don't have anything in the details tab for the mesh component. Some of its properties are available through the details tab of its parent scene component, but not at the same level of detail that I would get by instantiating the mesh directly from the character. Is there a way to access this details ? Is it a bug of the editor ? Is my approach correct ? maybe the way I instantiate the child mesh component is not the best way ? Thank you in advance for you help !

MyCharacter.h :

 #pragma once
 
 #include "CoreMinimal.h"
 #include "GameFramework/Character.h"
 #include "MySceneComponent.h"
 #include "MyCharacter.generated.h"
 
 UCLASS()
 class TESTCOMPONENTS_API AMyCharacter : public ACharacter
 {
     GENERATED_BODY()
 
 public:
     // Sets default values for this character's properties
     AMyCharacter();
 
 protected:
     UPROPERTY(VisibleAnywhere)
     UMySceneComponent* MySceneComponentInstance;
 
     UPROPERTY(VisibleAnywhere)
     USkeletalMeshComponent* MySkeletalMeshComponent;
 };

MyCharacter.cpp :

 #include "MyCharacter.h"
 
 
 // Sets default values
 AMyCharacter::AMyCharacter()
 {
      // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
     PrimaryActorTick.bCanEverTick = true;
 
     MySceneComponentInstance = CreateDefaultSubobject<UMySceneComponent>(TEXT("MySceneComponent"));
     MySceneComponentInstance->SetupAttachment(RootComponent);
 
     MySkeletalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MySkeletalMeshComponent"));
     MySkeletalMeshComponent->SetupAttachment(RootComponent);
 }

MySceneComponent.h :

 #pragma once
 
 #include "CoreMinimal.h"
 #include "Components/SceneComponent.h"
 #include "Components/SkeletalMeshComponent.h"
 #include "MySceneComponent.generated.h"
 
 
 UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
 class TESTCOMPONENTS_API UMySceneComponent : public USceneComponent
 {
     GENERATED_BODY()
 
 public:    
     // Sets default values for this component's properties
     UMySceneComponent();
 
 protected:
     UPROPERTY(VisibleAnywhere)
     USkeletalMeshComponent* MySubSkeletalMeshComponent;
 };

MySceneComponent.cpp :

 #include "MySceneComponent.h"
 
 
 // Sets default values for this component's properties
 UMySceneComponent::UMySceneComponent()
 {
     // Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
     // off to improve performance if you don't need them.
     PrimaryComponentTick.bCanEverTick = true;
     bEditableWhenInherited = true;
 
     MySubSkeletalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MySubSkeletalMeshComponent"));
     MySubSkeletalMeshComponent->SetupAttachment(this);
     MySubSkeletalMeshComponent->bEditableWhenInherited = true;
 }

The resulting views in the editor for the character blueprint, taking the Collision Category as an example :

when selecting the sub skeletal mesh : alt text

when selecting the my scene component (parent of the skeletal mesh) : alt text

when selecting the skeletal mesh directly instantiated by the character : alt text

Product Version: UE 4.20
Tags:
more ▼

asked Feb 20 '19 at 01:20 PM in C++ Programming

avatar image

developpeur2000
47 1 1 5

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

1 answer: sort voted first

I'm afraid I've had this problem for years.

https://answers.unrealengine.com/questions/456794/view.html

I'm currently re-creating the project I was working on back then, trying to comply to the new UE4 v4.21.2, and I'm running into the exact same problems as back then, and the exact same problem as you.

There's a topic here where people discuss something similar: https://forums.unrealengine.com/development-discussion/c-gameplay-programming/57024-inherited-component-details-not-showing-in-blueprint

There's also this: https://answers.unrealengine.com/questions/579066/view.html

====

It seems nobody seems to know quite how to resolve this specific problem, and/or nobody gets the same repro as we do. I find it somewhat comforting to know I'm not alone, but it sucks that in all this time there doesn't seem to have been a solution for this.

None of the solutions work for me: BlueprintReadOnly/ReadWrite, Visible/EditAnywhere, Category setting, public/protected/private, using the FObjectInitializer for the Constructor, reparenting, redefining, renaming, recompiling, recreating the derived Blueprint, adding an Instance Component instead. Nothing.

I've been researching the issue for a couple of hours again just now, and I'm very close to just creating the components I need through Blueprint and trying to write whatever functionality I want in C++, although I'm pretty sure that's not actually a good idea. Just exploring new avenues as this one seems a dead end for me, at the current time.

Sorry.

Good luck! If you ever do find a solution, please contact me ASAP.

more ▼

answered Feb 20 '19 at 01:50 PM

avatar image

Shrooblord
91 18 20 21

avatar image Shrooblord Feb 20 '19 at 01:56 PM

Search for the topic "details panel" here on AnswerHub and you'll find many, many familiar problems. x)

avatar image Shrooblord Feb 20 '19 at 02:13 PM

Other places like this tutorial: https://www.raywenderlich.com/185-unreal-engine-4-c-tutorial Seem to indicate that this "just works" for most people, and that the problem we're facing is somewhat unique.

avatar image developpeur2000 Feb 20 '19 at 02:42 PM

Thanks for your answer !

I haven't found a proper solution but I have advanced a bit in my comprehension of how things work :

BlueprintReadOnly/ReadWrite : this should be only related to graphs, and without surprise have no effect on our issue

public/protected/private : the derivation into blueprint is done with the unreal reflection system and will/can get rid of these scopes, our issue is not related to this

One thing that ends up being a workaround is to put the variable as EditAnywhere. In this case, within the parent component details panel, you will have access to all details of your subcomponent.

You will also be able to change the reference to the subcomponent, which is not something I wanted, but at least I have access to the subcomponent parameters

avatar image developpeur2000 Feb 20 '19 at 02:46 PM

another thing I discovered and should be carefully taken care of, is that if you change your C++ properties after you have created a derived blueprint, properties can be messed up with because the blueprint will serialize them and can mix things up when loading the BP and deserialize the BP parameters after your changes. Typically sub components will be set to null, but I have also seen two components of the same type have their parameters exchanged ! The solution for this is to declare the property with the specifier SkipSerialization

avatar image Shrooblord Feb 20 '19 at 02:50 PM

True -- in my tests I keep recreating the Blueprint to get a "fresh start" and initialise the starting conditions of my problem. I spotted a sneaky "MySubSkeletalMeshComponent->bEditableWhenInherited = true;" in your post that I hadn't caught before. My last hope for my own problem...!

avatar image Shrooblord Feb 20 '19 at 03:28 PM

Unfortunately, no dice. They're not showing up, neither in their own Details panels, nor in those of their parents (everything is empty).

I do have a work-around in mind though: I can expose regular variables to the Details panel of the main Blueprint itself, for example Material asset selectors. Perhaps I'll use this area to set the Mesh and other parameters I care about for my C++-created components, and simply hope that, one day, this bug will finally be squashed.

Thanks for thinking with me!

avatar image developpeur2000 Feb 20 '19 at 03:43 PM

Because of all these issues I ended up exposing only a few things but not the subcomponents, and set every subcomponent parameters in C++

for example I expose a transform, so it can be set at the parent component level, and at begin play I apply the transform to the subcomponent, it was much less of a hassle !

avatar image Shrooblord Feb 20 '19 at 04:42 PM

This subcomponent was added using Blueprint, or still through C++?

avatar image developpeur2000 Feb 20 '19 at 05:14 PM

in C++

in my arm component .h file :

 protected:
     UPROPERTY(SkipSerialization)
     USkeletalMeshComponent* ArmSkeletalMesh;
 public:
     UPROPERTY(EditAnywhere, BlueprintReadWrite)
     FTransform ArmMeshRelativeTransform;

in my arm component .cpp file :

 #define MAKE_SUBCOMPONENT_NAME(ParentName, SubObjectName) FName(*FString::Printf(TEXT("%s_%s"), *ParentName, TEXT(SubObjectName)))
 
 UArmComponent::UArmComponent(const FObjectInitializer& ObjectInitializer)
 {
     // arm 1st person mesh
     FString ArmName = GetName();
     ArmSkeletalMesh = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, MAKE_SUBCOMPONENT_NAME(ArmName, "ArmSkeletalMesh"), true);
     ArmSkeletalMesh->SetupAttachment(this);
     ArmSkeletalMesh->bEditableWhenInherited = true;
    // parameters that used to be set in the blueprint
    // but they have no reason to be changed
     ArmSkeletalMesh->bOnlyOwnerSee = true;
     ArmSkeletalMesh->CastShadow = false;
     ArmSkeletalMesh->bCastDynamicShadow = false;
     ArmSkeletalMesh->bAffectDynamicIndirectLighting = false;
     ArmSkeletalMesh->bAffectDistanceFieldLighting = false;
     ArmSkeletalMesh->bCastStaticShadow = false;
 }
 
 void UArmComponent::BeginPlay()
 {
     Super::BeginPlay();

    // apply the transform that was set in the blueprint
     ArmSkeletalMesh->SetRelativeTransform(ArmMeshRelativeTransform);
 }

I hope this helps you

avatar image Shrooblord Feb 20 '19 at 06:28 PM

Thank you. Another good work-around.

For my case, it's finally been resolved thanks to a friend looking at my code.

Turns out it was extremely stupid in the end, as expected. x)

See the first link in my first post in this thread.

Hope your problem can be truly resolved, soon, too!

avatar image Shrooblord Feb 20 '19 at 02:29 PM

@developpeur2000 going on a hunch, what OS are you running on? Mac? Windows? Windows through a Mac Bootcamp?

avatar image developpeur2000 Feb 20 '19 at 02:42 PM

windows only

(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