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. 

Skeletal Mesh crashes editor after reopening

So im creating a Skeletal Mesh Asset inside C++ and i keep getting a crash after reopening the editor, with the error saying

 Invalid number of texture coordinates

Here is my code for creating the Skeletal Mesh Asset.

 // Extract the common/shared skeleton
 FBoneHierarchyBuilder HierarchyBuilder;
 // Create the skeletal mesh
 const FString TargetMeshName = Entity.Name + TEXT("_SkelMesh");
 const FString TargetMeshPath = LongPackagePath;
 USkeletalMesh* SkeletalMesh = CastChecked<USkeletalMesh>(CreateNewAsset(USkeletalMesh::StaticClass(), TargetMeshPath, TargetMeshName, Flags));
 // Create the skeleton
 const FString TargetSkeletonName = Entity.Name + TEXT("_Skeleton");
 const FString TargetSkeletonPath = LongPackagePath;
 USkeleton* EntitySkeleton = CastChecked<USkeleton>(CreateNewAsset(USkeleton::StaticClass(), TargetSkeletonPath, TargetSkeletonName, Flags));
 // Initialize the mesh asset
 FSkeletalMeshResource* ImportedResource = SkeletalMesh->GetImportedResource();
 check(ImportedResource->LODModels.Num() == 0);
 FStaticLODModel& LODModel = *new (ImportedResource->LODModels) FStaticLODModel();
 SkeletalMesh->LODInfo[0].LODHysteresis = 0.02f;
 FSkeletalMeshOptimizationSettings Settings;
 // set default reduction settings values
 SkeletalMesh->LODInfo[0].ReductionSettings = Settings;
 // Pass the number of texture coordinate sets to the LODModel.  Ensure there is at least one UV coord
 LODModel.NumTexCoords = 1;
 // Create the reference skeleton and update LOD0
 FReferenceSkeleton& RefSkeleton = SkeletalMesh->RefSkeleton;
 SkeletalMesh->CalculateRequiredBones(LODModel, RefSkeleton, /*BonesToRemove=*/ nullptr);
 // Initialize the skeleton asset and create sockets for each bone
 TArray<class USkeletalMeshSocket*>& Sockets = EntitySkeleton->Sockets;
 for (const FName& BoneName : HierarchyBuilder.AllBones)
     if (!BoneName.IsNone())
         USkeletalMeshSocket* Socket = NewObject<USkeletalMeshSocket>(EntitySkeleton, BoneName);
         Socket->SocketName = BoneName;
         Socket->BoneName = BoneName;
 // Point the mesh and skeleton at each other
 SkeletalMesh->Skeleton = EntitySkeleton;

Any help with correctly setting up this Skeletal Mesh Asset is appreciated!

Product Version: UE Github Master branch
more ▼

asked Feb 17 '16 at 07:45 AM in Using UE4

avatar image

100 14 18 25

(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