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"

Crash when adding mesh

Im trying to make a map. I made a class which inherit from pawn. I add several cube on the constructor but it crash when I add too much cubes. Let's take the following code:

 int WIDTH_MAP = 13;
 int HEIGHT_MAP = 13;
  // Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
 PrimaryActorTick.bCanEverTick = true;
 this->SetActorLocation(FVector(0.f, 0.f, 0.f));
 //this->RootComponent->SetWorldLocation(FVector(0.f, 0.f, 0.f));
 //Create blocks
 for (int i = 1; i < WIDTH_MAP; i += 2) {
     for (int j = 1; j < HEIGHT_MAP; j +=2) {
         FString s = FString::FromInt(j);
         s += FString::FromInt(i);
         UStaticMeshComponent* SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(FName(*s));

         m_mesh.Add(SphereVisual);
         //SphereVisual->AttachTo(RootComponent, FName(*s), EAttachLocation::KeepRelativeOffset);

         static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));
         if (SphereVisualAsset.Succeeded())
         {
             SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
             SphereVisual->SetWorldLocation(FVector(i * 100, j * 100, 0.0f));
         }
     }
 }


It crash on launch, but if I set the with and the height to 11, it does not crash. Maybe it works only by chance, if so, what is the good usage to add severals cube mesh ?

Thank you for your help, just starting ue4 and got a looooot of crash so far its annoying.

Product Version: UE 4.10
Tags:
more ▼

asked Jan 13 '16 at 06:19 PM in Bug Reports

avatar image

Nalyah
6 1 2 4

avatar image Sean L ♦♦ STAFF Jan 13 '16 at 08:17 PM

Hello Nalyah,

I'd recommend looking into TTaM's solution below, but if that does not work for you, I have a few questions:

  • Can you please provide your crash logs located in your project's Saved->Logs folder?

  • Could you please provide your machine ID located in the Crash Reporter window that appears upon crashing, and ensure that you hit Send on the Crash Reporter window?

Thank you.

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

1 answer: sort voted first

Have you tried putting something in between the object names j and i ? so

 FString s = FString::FromInt(j);
 s += ".";
 s += FString::FromInt(i);

You might be getting some repeating values without it.

more ▼

answered Jan 13 '16 at 06:46 PM

avatar image

TTaM
1.7k 81 28 81

avatar image Nalyah Jan 13 '16 at 08:26 PM

Well done! it works. A message instead of a crash would have helped me ;P

(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