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"

Why does my UStaticMeshComponent have no details in Blueprint?

Created a class based on Actor, I'm adding a UStaticMeshComponent, setting as RootComponent and spawning the actor in game.

If I pause and examine the actor, the static mesh component is 'native' and doesn't show any details. If I then create a Blueprint based on my actor it looks like this:

alt text

Is the lack of details/components because this is a 'native' static mesh component? How do make my static mesh configurable? My next step is to add a material to the mesh, but looks like something is wrong.

Code as follows, class is called BlockBase.

.h

 UCLASS()
 class ABlockBase : public AActor
 {
     GENERATED_UCLASS_BODY()
 
     TSubobjectPtr<UStaticMeshComponent> myStaticMeshComponent;
     UStaticMesh * myStaticMeshObj;
 };


.cpp

 ABlockBase::ABlockBase(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
     static ConstructorHelpers::FObjectFinder<UStaticMesh> myStaticMesh(TEXT("StaticMesh'/Game/Meshes/cube-no-back.cube-no-back'"));
     myStaticMeshObj = myStaticMesh.Object;
     // Create
     myStaticMeshComponent = PCIP.CreateDefaultSubobject < UStaticMeshComponent >(this, TEXT("mySubObject"));
     // set as root
     RootComponent = myStaticMeshComponent;
     // Set Mesh
     myStaticMeshComponent->SetStaticMesh(myStaticMeshObj);
 }



Product Version: Not Selected
Tags:
native.png (163.5 kB)
more ▼

asked May 29 '14 at 06:51 PM in C++ Programming

avatar image

Deab
121 12 12 127

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

1 answer: sort voted first

You have to add some additional code to let Blueprint see your components.

This article will help to understand how it works.

You can find list of all available Property specifiers right there

 UCLASS()
 class ABlockBase : public AActor
 {
     GENERATED_UCLASS_BODY()
     UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kittens) 
     TSubobjectPtr<UStaticMeshComponent> myStaticMeshComponent;
     UStaticMesh * myStaticMeshObj;
 };

more ▼

answered May 29 '14 at 09:24 PM

avatar image

zeOrb
267 24 19 25

avatar image Deab May 29 '14 at 09:54 PM

Brilliant thank you zeOrb!

avatar image ErayT Jul 24 '14 at 09:08 AM

I am not able to declare 'BlueprintReadWrite', why?

avatar image BiggestSmile Jul 24 '14 at 09:39 AM

It should be BlueprintReadOnly.

(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