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"

Ensure condition failed: NULL != NewGeneratedClass when trying to use an Anim Blueprint Asset ID to set a mesh's Anim Instance Class

Hey everyone,

Issue

I can't seem to use Set Anim Instance Class correctly using an Anim Blueprint Asset ID for an AnimBlueprint read in from a data table. I'm using C++ for the data table so I'll include the relevant code too.

When I run my game I get this Call Stack

I'll go from the DataTable forwards to the Blueprint code.

DataTable CSV File

 1,Inara,Dreamcatcher,"""Inara is OP!""",1000,800,55,40,63,200,"""SkeletalMesh'/Game/DreamcatcherAssets/Character/ThirdPersonSkelMesh.ThirdPersonSkelMesh'""","""AnimBlueprint'/Game/DreamcatcherAssets/Character/ThirdPersonAnimBlueprint.ThirdPersonAnimBlueprint'"""

C++ Code

UtilityClass.h

 USTRUCT(BlueprintType)
 struct FGameCharacterLookupTable : public FTableRowBase
 {
     GENERATED_USTRUCT_BODY()
 
 public:
 
 // UNRELATED PROPERTIES OMMITTED
 
     UPROPERTY()
         TAssetPtr<UAnimBlueprint> Character_Anim;
 
 };

I then transfer the data to a CharacterProfile class

CharacterProfile.h

 UCLASS(BlueprintType)
 class PROJECT_DREAMCATCHER_API UCharacterProfile : public UObject
 {
 public:
     GENERATED_BODY()
         UCharacterProfile();
 
 // IRRELEVANT PROPERTIES OMMITTED
 
     UPROPERTY( BlueprintReadOnly )
         TAssetPtr<UAnimBlueprint> characterAnim;
 private:
 };

UtilityClass.cpp - createDefaultCharacter() function

 static FGameCharacterLookupTable* lookupRow = CharacterProfileLookupTable->FindRow<FGameCharacterLookupTable>( FName( TEXT( "1" ) ), *ContextString );
 
 // IRRELEVANT CODE OMMITTED
 newCharacter->characterAnim = lookupRow->Character_Anim;
 
 return newCharacter;

Blueprint

Create character and set mesh from a SkeletalMesh read in from the data table

Create character and set mesh blueprint screenshot

Attempt to set the Anim Instance Class for that mesh from value read in from data table

Set Anim Instance Class

Any help would be greatly appreciated, thanks!

Product Version: UE 4.9
Tags:
more ▼

asked Dec 08 '15 at 10:48 AM in Bug Reports

avatar image

Punitiate
103 6 9 66

avatar image Punitiate Dec 08 '15 at 11:06 AM

Oh and for anyone curious, the ReturnValue of the GetClass call on CharacterAnims created object (See the second Blueprint screenshot) is an Anim Blueprint Class

avatar image Superbelko Jan 12 '16 at 10:24 AM

Just tried(ue 4.10.2) something like this but with structs instead of data tables. i can't get it working with BP, while in code it works just fine. Looks like a bug!

p.s. i mean dynamic changing not working, if you just wire set anim instance class and selected a class from list it works...

avatar image Punitiate Jan 16 '16 at 05:59 AM

Ah yes that's right, mine worked too if I selected it from the usual list.

If this is a bug I think I've shot myself in the foot here. I don't think I can move this to the bug section. So I either need to hope a mod sees this and moves it for me, or I create a new question in the bug section and let them know it's a copy of this.

Edit: Found it, I've moved it into the bug section, will see what others say

avatar image Matthew J Jan 18 '16 at 04:28 PM

Hello Punitiate,

Thank you for making this report. I tried setting up my own reproduction of this in 4.10.2 but I haven't run into any ensure calls. Does this only happen if you're using structs or data tables? Is it only when you're using a mix of C++ and Blueprints or does it never work in blueprints regardless?

avatar image Punitiate Jan 19 '16 at 11:14 AM

Hey Matthew,

I've got some free time tomorrow night so I'll take a look at trying to reproduce with a fresh, simplified project and get some answers to your questions.

avatar image Punitiate Jan 21 '16 at 11:44 AM

A quick question as I'm trying to setup a fresh project to reproduce this in so that if I'm successful I can send to you.

     //.hpp
     UPROPERTY( BlueprintReadOnly )
         TAssetPtr<USkeletalMesh> characterMesh;
     UPROPERTY( BlueprintReadOnly )
         TAssetPtr<UAnimBlueprint> characterAnim;

 //.cpp
 
     characterMesh = nullptr;
     characterAnim = nullptr;

Compiled fine in my old project, doesn't compile in my new one. Both the same version of Unreal. The compilation errors I get are:

 1>D:\Program Files\Epic Games\4.9\Engine\Source\Runtime\CoreUObject\Public\UObject\AssetPtr.h(123): error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const UAnimBlueprint *' (or there is no acceptable conversion)
 1>          d:\program files\epic games\4.9\engine\source\runtime\coreuobject\public\uobject\PersistentObjectPtr.h(46): could be 'void TPersistentObjectPtr<FStringAssetReference>::operator =(const TObjectID &)'
 1>          with
 1>          [
 1>              TObjectID=FStringAssetReference
 1>          ]
 1>          d:\program files\epic games\4.9\engine\source\runtime\coreuobject\public\uobject\PersistentObjectPtr.h(57): or       'void TPersistentObjectPtr<FStringAssetReference>::operator =(const UObject *)'
 1>          d:\program files\epic games\4.9\engine\source\runtime\coreuobject\public\uobject\PersistentObjectPtr.h(75): or       'void TPersistentObjectPtr<FStringAssetReference>::operator =(const FWeakObjectPtr &)'

Same for mesh.

I tried reproducing this using Blueprint datatables only but couldn't even load in the DataTable elements for the mesh and animation. They just appeared as NULL.

avatar image Punitiate Jan 21 '16 at 11:44 AM

Either way I'm suspecting I'm not using TAssetPtr correctly in my old project as I don't think I'm explicitly loading the resource.

avatar image Matthew J Jan 21 '16 at 01:35 PM

I believe your last comment is correct. While TAssetPtr's are pointers, I'm not even sure that they can be set to null in the same way. I haven't used them in a while so I'm a bit rusty but I do remember this wiki page being very helpful in learning how to use them.

https://wiki.unrealengine.com/TAssetPtr_and_Asynchronous_Asset_Loading

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

1 answer: sort voted first

It turns out I wasn't using TAssetPtr's correctly. I had another read of the documentation Matthew provided and I made a bad assumption that TAssetPtr would automatically load the asset the first time that it was referenced.

Instead you have to load it somewhere else or via TAssetPtr.LoadSynchronous().

The animation still doesn't apply but I consider that a separate problem with my code.

I no longer get the condition failure so I'm happy to end it here.

more ▼

answered Jan 22 '16 at 12:15 PM

avatar image

Punitiate
103 6 9 66

(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