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"

UAnimMontage reference in code

Hi! I'm trying to make reference to UAnimMontage in code. I was trying with

 static ConstructorHelpers::FObjectFinder<UAnimMontage> TestMontage(TEXT("AnimMontage'/Game/Testmontage'"));

but it will crash or won't compile. I've found that not only I have problem with this. Any help?

Product Version: UE 4.8
Tags:
more ▼

asked Aug 04 '15 at 06:08 PM in C++ Programming

avatar image

Waw K.
70 13 23 32

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

1 answer: sort voted first

I avoid directly binding to content this way in code. The reason is that you have less control of overriding the content and it can adversely affect your startup times. Any code referenced that way is immediately loaded and anything that references and so on. IMO, a better way is to create a TAssetPtr and then let a Blueprint subclass specify the desired content. Then you can control when that content is loaded by using sync/async loading. There is some good documentation on async loading and in other posts on our Answers site

more ▼

answered Aug 04 '15 at 07:07 PM

avatar image

joeGraf STAFF
1.5k 35 12 69

avatar image Waw K. Aug 04 '15 at 07:30 PM

Thanks for the answer. I'm doing everything to avoid using blueprints but it looks like I need to change my approach.

avatar image joeGraf STAFF Aug 04 '15 at 07:37 PM

You don't have to change your approach, but changing will give you the most flexibility and control in the long run. You also don't have to create a BP that uses the node graph. It can just be a data only object. We use that pattern a bunch here.

avatar image Waw K. Aug 04 '15 at 09:23 PM

I didn't use blueprints because I need to spawn object in runtime. I'm digging right now how to do this... if it is possible.

avatar image joeGraf STAFF Aug 04 '15 at 09:25 PM

Yes, you can spawn either a C++ class or BP class at runtime via SpawnActor.

avatar image Waw K. Aug 04 '15 at 09:37 PM

OK. I managed to do this. I have exactly what I need with blueprint use. Thanks once more time joeGraf because I spent whole day messing with my earlier pure code conception :)

(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