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"

Linker error using UAutomatedAssetImportData

I'm attempting to support the user triggered re-import of assets for our character class. Our designers want to be able to make changes to the character's animations in Spine, and quickly re-import the assets to see those changes. They can do so by going to the asset in the content browser and then re-importing it from the asset details screen, but this is cumbersome, especially as it generates a large number of pop-up confirmation menus.

My plan to do this was to add a function to the the character class that returned a UAutomatedAssetImportData pointer and then use Blueprints to call ImportAssetsAutomated and pass it the relevant data. I have encountered an issue where the linker seems to have difficulty locating the UAutomatedAssetImportData class despite the fact that I have included "AutomatedAssetImportData.h"

In my header file I have:

 class UAutomatedAssetImportData;
 
 UCLASS(config=Game)
 class AOurCharacterClass: public APaperCharacter
 {
     GENERATED_BODY()
 
     private:
         UPROPERTY()
         UAutomatedAssetImportData* _importData;
     public:
         UFUNCTION(BlueprintCallable)
         UAutomatedAssetImportData* GetAssetImportData();
 }
 

Then in my .ccp I have:

 #include "AutomatedAssetImportData.h"
 
     UAutomatedAssetImportData* AOurCharacterClass::GetAssetImportData()
     {
         //if we don't have animation data to reimport, don't do shit.
         if (animationComponent == nullptr || animationComponent->SkeletonData == nullptr || animationComponent->Atlas == nullptr)
         {
             return nullptr;
         }
         
         if (_importData == nullptr)
         {
             _importData = NewObject<UAutomatedAssetImportData>(this);
         }
     
         USpineSkeletonDataAsset* skel_data = animationComponent->SkeletonData;
         USpineAtlasAsset* atlas_data = animationComponent->Atlas;
     
         _importData->bReplaceExisting = true;
         _importData->bSkipReadOnly = false;
         _importData->DestinationPath = skel_data->GetPathName();
         _importData->FactoryName = "USpineSkeletonAssetFactory";
     
         TArray<FString>* filenames = &(_importData->Filenames);
     
         if (filenames == nullptr)
         {
             //oh god, something's gone wrong
             return nullptr;
         }
     
         filenames->Empty();
         filenames->Add(skel_data->GetSkeletonDataFileName().ToString());
         filenames->Add(atlas_data->GetAtlasFileName().ToString());
     
         return _importData;
     }
 

But when I attempt to compile I get:

 error LNK2019: unresolved external symbol "__declspec(dllimport) private: static class UClass * __cdecl UAutomatedAssetImportData::GetPrivateStaticClass(void)" (__imp_?GetPrivateStaticClass@UAutomatedAssetImportData@@CAPEAVUClass@@XZ) referenced in function "class UAutomatedAssetImportData * __cdecl NewObject<class UAutomatedAssetImportData>(class UObject *)" (??$NewObject@VUAutomatedAssetImportData@@@@YAPEAVUAutomatedAssetImportData@@PEAVUObject@@@Z)

Any advice or assistance would be appreciated.

Product Version: UE 4.21
Tags:
more ▼

asked Jan 23 '19 at 12:36 PM in C++ Programming

avatar image

Drew Clowery
1 1 2

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I did not try it, but my guess would be that you need to include the "UnrealEd" module into your Build.cs file. But as this is a editor-only module you need to follow these instructions for a successful compile process.

more ▼

answered Jan 23 '19 at 01:57 PM

avatar image

Caviarail
11 2 4

avatar image Drew Clowery Jan 25 '19 at 12:49 AM

This solved my problem. I was not properly including the UnrealEd module. You will likely also want this link to the newer method for detecting if you're running an editor build (as, perhaps obviously, you only want to link the UnrealEd module in editor builds).

(comments are locked)
10|2000 characters needed characters left
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