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"

Strange mobility warning with InstancedStaticMesh

I am creating several InstancedStaticMeshes at runtime like this:

 for (const auto& StaticMesh : StaticMeshes)
     {
         UInstancedStaticMeshComponent* StaticMeshComponent = NewObject<UInstancedStaticMeshComponent>(this);
         StaticMeshComponent->SetStaticMesh(StaticMesh);
         StaticMeshComponent->SetMobility(EComponentMobility::Static);
         StaticMeshComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
         StaticMeshComponent->RegisterComponent();
         StaticMeshComponent->AttachTo(DefaultRoot);
 
         // Add to array
         InstancedStaticMeshComponents.Add(StaticMeshComponent);
     }

And later use them to create instances like this:

 // Pick a random mesh
 const int32 Num = InstancedStaticMeshComponents.Num();
 if (Num == 0)
 {
     return;
 }

 UInstancedStaticMeshComponent* InstancedStaticMeshComponent = InstancedStaticMeshComponents[FMath::RandRange(0, Num - 1)];
 if (InstancedStaticMeshComponent == nullptr)
 {
     return;
 }
 
 // Calculate a transform
 FTransform Transform = SocketedMeshComponent->GetSocketTransform(SocketName);
 
 // Create the mesh
 InstancedStaticMeshComponent->AddInstanceWorldSpace(Transform);

When I do this, I get the following warning:

Warning Mobility of BP_InstanceMaker_C_1411 : Root Component has to be 'Movable' if you'd like to Mobility of {0} : {1} has to be 'Movable' if you'd like to {2}. .

The root scene component of the Actor these components are on is set to static, as well as each UInstancedStaticMeshComponent I create. It's a strange error, because it looks like it should be parameterized (not the {0}, {1} and {2}) but isn't. Any ideas?

Product Version: UE 4.10
Tags:
more ▼

asked Dec 15 '15 at 11:28 PM in C++ Programming

avatar image

willrmiller
31 1 2 8

(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