is the code that will compile and work as intended in Visual Studio.
// Member Decleration
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Game Instance, Data Tabels")
TArray<TAssetPtr<UDataTable> > GeneralCraftingRecipts;
// Method
int32 UMyGameDataTabels::GetGeneralCraftingReciptCount(int32 CraftingLevel)
{
bool bIsValid = false;
UMyGameDataSingleton* Data = UMyGameDataTabels::GetMyGameData(bIsValid);
if (!bIsValid)
return 0;
if (Data->IsValidLowLevel())
{
if (Data->GeneralCraftingRecipts[CraftingLevel]->IsValidLowLevel())
{
return (Data->GeneralCraftingRecipts[CraftingLevel]->GetTableData().Num() - 1);
}
else {
FStringAssetReference ReciptRefrence = Data->GeneralCraftingRecipts[CraftingLevel].ToStringReference();
if (ReciptRefrence.IsValid())
{
UDataTable* NeededReciptTableToLoad = LoadObjFromPath<UDataTable>(FName(*ReciptRefrence.AssetLongPathname)); // Static Library method.
if (NeededReciptTableToLoad)
{
return (NeededReciptTableToLoad->GetTableData().Num() - 1);
}
}
}
}
return 0;
}
But when attempting to package in the editor i get this error.
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: C:\Program Files\Epic Games\4.8\Engine\Source\Runtime\Engine\Classes\Engine/DataTable.h(35) : see declaration of 'UDataTable'
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: C:\MyGameDevTrunk\Source\MyGame\DataTabels\MyGameDataTabels.cpp(124) : error C2228: left of '.Num' must have class/struct/union
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: C:\MyGameDevTrunk\Source\MyGame\DataTabels\MyGameDataTabels.cpp(133) : error C2039: 'GetTableData' : is not a member of 'UDataTable'
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: C:\Program Files\Epic Games\4.8\Engine\Source\Runtime\Engine\Classes\Engine/DataTable.h(35) : see declaration of 'UDataTable'
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: C:\MyGameDevTrunk\Source\MyGame\DataTabels\MyGameDataTabels.cpp(133) : error C2228: left of '.Num' must have class/struct/union
Now i hope am not doing anything dumb in code but to me this make no sense.
If there is any more information you need let me know.
EDIT: I did some more testing and now i get the same error when trying to compile in visual studio using source build…
But with binary / retail build it compils in Visual Studio, but will not build/ package from the editor.
Yes that is correct, i just did a Rebuild of the entier thing.
Both project and Editor is buildt with the same configuration.
But this time it compiles in visual studio using source build bbut the error presist within the editor. Just to make the entier thing even more confusing.
is the output from Visual Studio after Building Solution.
Done after the previews mentiond Rebuild.
[link text][2]
EDIT: Realising there is an option named “Development” am rebuilding now…
Were you able to package your project prior to upgrading to 4.8 (or 4.8.1?)
If so, this could be many things, likely something has become corrupted in the upgrade. First to try:
In the Engine folder, delete the DDC (Derived Data Cache). In your project, delete the Intermediate, the Saved, and the Binary folders.
When you next try to package it will take considerably longer as the shaders will need to newly compile, but this should get rid of any old or corrupted files that haven’t gotten deleted.
If after that you’re still getting the same error, try migrating your project to a blank one in the version of the editor you’re using.
If after that you’re still seeing the build failure, please post fresh output logs.
Ok what i will do for good messure is unzip a clean archive of the engine and recompile it.
But also is there a resson way compiling using Development_Editor (Retail Build) will work. But Selecting Development for the same project will fail with the error above?
In my attempts to understand the error i never checked the header for UDataTable::.
Well i had a moment of clarity and did and turns out the UDataTable::GetTableData() are for Editor only.
#if WITH_EDITOR
So its stands to reason this will not work.
Well am sorry for reporting a bug report on something that was not.