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"

SplineMeshComponents don't consistently Hide.

I have an actor that I would like to HideInGame. It has a USplineComponent and n number of USplineMeshComponents.

When I hide the actor or the USplineMeshComponents, they don't consistently hide.

Here is how I create them:

 _splineComponent = CreateDefaultSubobject<USplineComponent>(TEXT("Path Spline"));
 _splineComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
 _splineComponent->SetMobility(EComponentMobility::Movable);
 _splineComponent->bStationaryEndpoints = false;
 _splineComponent->SetDrawDebug(false);
 _splineComponent->SetClosedLoop(false);
 SetRootComponent(_splineComponent);
 
 _splineSegmentPool.Reserve(defaultInitialNumberOfSplineSegmenets);
 for (auto i = 0; i < defaultInitialNumberOfSplineSegmenets; ++i)
 {
     auto splineMeshComponent = CreateDefaultSubobject<USplineMeshComponent>(*FString::Printf(TEXT("Spline Mesh Component %i"), i));
     splineMeshComponent->SetOnlyOwnerSee(false);
     splineMeshComponent->SetMobility(EComponentMobility::Movable);
     splineMeshComponent->SetupAttachment(RootComponent);
     splineMeshComponent->SetStaticMesh(SplineMesh);
     splineMeshComponent->SetCastShadow(false);
     splineMeshComponent->SetHiddenInGame(true);
     splineMeshComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
     splineMeshComponent->SetSimulatePhysics(false);
     
     _splineSegmentPool.Add(splineMeshComponent);
 }

The _splineSegementPool is private and isn't being accessed except for setting HiddenInGame, setting the USplineMeshComponents locaitons, tagents, and scaling or exposing the dynamic material instances on the segments to blueprint.

Here is how I attempt to disable them:

 void AXXXXXXXXXXXXXX::DisableAllSplineSegments()
 {
     for (auto splineSegment : _splineSegmentPool)
     {
         splineSegment.SplineMeshComponent->SetHiddenInGame(true);
     }
 }

The details panel in the UE4 editor shows that sometimes the USplineMeshComponents don't get their SetHiddenInGame set. I have attempted using a Blutility to toggle them for their hidden in game to test, the results are inconsistent. I also have attempted hiding them every tick that I don't need them. This still ends up with sometimes they aren't hidden in game.

 void AXXXXXXXXXXXXXX::Tick(float DeltaTime)
 {
     Super::Tick(DeltaTime);
     if (!IsEnabled())
     {
         DisableAllSplineSegments();
     }
 }

I'm at a loss. Is there something I'm missing or I didn't create the components correctly or is this just a bug.

Any help would be greatly appreciated. Thank you.

PS. Yes, I have attempted just hiding the actor.

Product Version: UE 4.15
Tags:
more ▼

asked May 19 '17 at 02:42 PM in C++ Programming

avatar image

clarkelaprairie
61 1 5 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