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"

Spline mesh components generated in "onConstruction" function are not showing up in packaged build.

I am working on a prototype for my senior capstone class and I was trying to develop a tool to allow a designer to quickly create a procedurally generated race car track. This all works very well in the editor, but none of the spline mesh components seem to be showing up in a packaged build of the game which is obviously a pretty big issue. There seems to be no presence of either the mesh or any of it's collisions. Here is what some of my code looks like:

Here I am creating the pieces of the track with a for loop that scans through a spline created by the tool.

  void ATrackGenerator::BuildTrack(UStaticMesh* trackElementMesh)
  {
      print_num(NumSplinePoints);
      for (int32 i = 0; i < NumSplinePoints - 1; i++)
      {
          SplineMeshConstruct.Add(BuildTrackElement(trackElementMesh, i));
      }
  
      RegisterAllComponents();
  }
  
  USplineMeshComponent* ATrackGenerator::BuildTrackElement(UStaticMesh* trackElementMesh, int32 loopIndex)
  {
      // Gather Data for element build
      if (loopIndex + 1 >= NumSplinePoints)
          return nullptr;
      int32 localCurrentLoopIndex = loopIndex;
      int32 localNextLoopIndex = loopIndex + 1;
      UStaticMesh* localTrackElementMesh = trackElementMesh;
  
      FVector localStartLocation;
      FVector localStartTangent;
  
      SplineComponent->GetLocalLocationAndTangentAtSplinePoint(localCurrentLoopIndex, localStartLocation, localStartTangent);
  
      FVector localEndLocation;
      FVector localEndTangent;
  
      SplineComponent->GetLocalLocationAndTangentAtSplinePoint(localNextLoopIndex, localEndLocation, localEndTangent);
  
      //Create spline mesh component
      USplineMeshComponent* splineMeshComponent = NewObject<USplineMeshComponent>(this, USplineMeshComponent::StaticClass());
  
      splineMeshComponent->CreationMethod = EComponentCreationMethod::UserConstructionScript;
      splineMeshComponent->SetMobility(EComponentMobility::Movable);
      splineMeshComponent->AttachParent = SplineComponent;
      splineMeshComponent->SetStaticMesh(trackElementMesh);
  
      splineMeshComponent->SetStartAndEnd(localStartLocation, localStartTangent, localEndLocation, localEndTangent);
      splineMeshComponent->SetStartScale(FVector2D(RoadConstruct[loopIndex].TrackWidth, RoadConstruct[loopIndex].TrackThickness));
      splineMeshComponent->SetEndScale(FVector2D(RoadConstruct[loopIndex].TrackWidth, RoadConstruct[loopIndex].TrackThickness));
  
      return splineMeshComponent;
  }

 

In the Editor it looks like this: alt text

In the packaged build it looks like this: alt text

Product Version: UE 4.9
Tags:
more ▼

asked Sep 23 '15 at 07:05 PM in C++ Programming

avatar image

GreatDivine
13 1 2 6

avatar image C0dR Aug 25 '17 at 10:18 AM

I have the exact same problem and was not able to find a solution. First I had errors like root is static and it cant attach the meshes which are dynamic and stuff, but after fixing this still no mesh is visible in packaged game. Where you able to fix this?

avatar image GreatDivine Aug 26 '17 at 12:04 PM

Unfortunately, no.

(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