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"

Load Meshes During Play

Guys I want to load UStaticMesh during play.

 static ConstructorHelpers::FObjectFinder<UStaticMesh> GroundShape(TEXT("StaticMesh'/Game/Shapes/Ground/ground_shape_2.ground_shape_2'"));

The above example is a good way but only avaliable during construction. I want to use such usage in BeginPlay().

Product Version: Not Selected
Tags:
more ▼

asked Aug 10 '14 at 01:05 PM in C++ Programming

avatar image

ErayT
245 36 37 169

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

2 answers: sort voted first
 void AGround::BeginPlay()
 {
     UStaticMesh* GroundMesh = Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL, TEXT("StaticMesh'/Game/Shapes/Ground/ground_shape_2.ground_shape_2'")));

     GroundMeshComponent->SetStaticMesh(GroundMesh);
 }

This is how I solved it based on the question :

https://answers.unrealengine.com/questions/61811/how-to-find-assets-without-constructor.html

more ▼

answered Aug 11 '14 at 08:10 AM

avatar image

ErayT
245 36 37 169

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

answered Aug 10 '14 at 02:02 PM

avatar image

TimGS
621 20 23 237

avatar image ErayT Aug 10 '14 at 02:27 PM

The example you have mentioned is how to add a mesh or BP into the scene. What I want is to load the StaticMesh into the memory not the scene. There is no Spawing issue. At the end I want to have an object like

 UStaticMesh* GroundMesh = <<missing part>>
avatar image TimGS Aug 10 '14 at 02:39 PM

Ok, I got it. Then you may like this one https://forums.unrealengine.com/showthread.php?5309-TUTORIAL-C-Runtime-Async-Load-Modular-Character-(Intermediate) Look at functions which load sceletal mesh components during runtime from database which has a collection of asset pointers. You could use this functionality for your static mesh I guess.

(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