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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

using Editor's tool in Code

so i finally figured out how to create Skeletal Actor in C++ code,

now i want to use UE4 Editor's Clothing tool in C++.

below code is what i tryed :

Header

 class C_TEST07_API AMyActor : public AActor
 {
     GENERATED_BODY()
     ...
     public:
         UClothingAssetBase* cloth;
 }

Source

 AMyActor::AMyActor()
 {
     PrimaryActorTick.bCanEverTick = true;
     
     MySkeletalMesh =
         CreateDefaultSubobject<USkeletalMeshComponent>(FName("MySkeletalMeshComponent"));
 
     ConstructorHelpers::FObjectFinder<USkeletalMesh> SK_mannequin(TEXT("SkeletalMesh'/Game/mesh/mannequin.mannequin'"));
     
     RootComponents = MySkeletalMesh;
     
     MySkeletalMesh->SetSkeletalMesh(SK_mannequin.Object,true);
     skinnedMesh = MySkeletalMesh;
     
     cloth->BindToSkeletalMesh(skinnedMesh->SkeletalMesh, 1, 1, 1);
 }


its crash when i compile it

probloms codes are this:

 cloth->BindToSkeletalMesh(skinnedMesh->SkeletalMesh, 0, 0, 0);

error said :

 this->cloth was nullptr

so i guess i might be use wrong way. anyone can fix my probloms?

Thanks.

Product Version: UE 4.16
Tags:
more ▼

asked Jul 10 '17 at 02:31 PM in C++ Programming

avatar image

Juicycool
8 2 7

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

2 answers: sort voted first

This is general tip for constructors, constructor is executed when engine and object is not fully initiated, some function may behave strangly or cause crashes, if that happens try to move code to PostInitializeComponents (executes in both level editor and play) or BeginPlay (executes only in play mode) events. In general practice constructor should only set default settings

But current cause is what HailstoneRyan say, all not initiated pointers are either nullptr or invalid.

more ▼

answered Jul 12 '17 at 10:06 PM

avatar image

Shadowriver
36.6k 930 169 1111

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

You don't ever assign a value to the cloth pointer.

more ▼

answered Jul 11 '17 at 02:55 PM

avatar image

HailstoneRyan
714 39 26 54

(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