Not sure why one of my custom ActorComponent classes isn't showing up

I have made several custom classes based on UActorComponent and most all of them properly show up and can be used in the editor, except one. I can’t figure out why this one doesn’t work. The only thing even remotely different about it is the header file has a forward declare of another class in it, but besides that I just don’t get what the issue is.



// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Components/ActorComponent.h"
#include "EconomicsAgent.generated.h"

class ECONOMICS_API AMarket;

USTRUCT()
struct FCommodityInventory
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		FString CommodityName;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		int32 CurrentInventoryCount;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		int32 IdealInventoryCount;
};

UCLASS( Blueprintable, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class ECONOMICS_API UEconomicsAgent : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UEconomicsAgent();

	// Called when the game starts
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;

	UPROPERTY()
		TArray<FCommodityInventory> Inventory;
	UPROPERTY()
		float Wallet;
	
	UFUNCTION()
		AMarket* GetMarketReference();
	UFUNCTION()
		int32 GetCommodityInventoryQuantity(FString CommodityName);
	UFUNCTION()
		int32 AdjustCommodityInventory(FString CommodityName, int32 Amount);
	UFUNCTION()
		float AdjustWallet(float Amount);
	UFUNCTION()
		float GetWalletBalance();

	// Returns the amount of money in the agent's wallet, minus the money obligated to outstanding Bid offers
	UFUNCTION()
		float GetLiquidFunds();
	// Returns the quantity of the given commodity that is not tied up in any outstanding Ask offers
	UFUNCTION()
		int32 GetFreeInventoryForCommodity(FString CommodityName);

	UFUNCTION()
		void OnInventoryChanged(FString CommodityName);
	UFUNCTION()
		void OnWalletChanged();
};


**EDIT: ** To clarify everything compiles fine, but when in the editor you can’t add this component to an actor, and it doesn’t even show up as an object in that C++ Classes section of the project browser like all the others.

Hmm something else going on here now. I tried to close and reopen the editor to see if that would help and now I can’t load my project. The editor just crashes before it finishes loading :frowning:

Please post any available Crash Log and GameLog! (:



Access violation - code c0000005 (first/second chance not available)

UE4Editor_Core!rml::internal::Block::findObjectSize()
UE4Editor_Core!FMallocTBB::Free() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\private\hal\malloctbb.cpp:109]
UE4Editor_CoreUObject!TProperty<FString,UProperty>::DestroyValueInternal() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\coreuobject\public\uobject\unrealtype.h:956]
UE4Editor_CoreUObject!UScriptStruct::DestroyStruct() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\coreuobject\private\uobject\class.cpp:2430]
UE4Editor_CoreUObject!UStruct::DestroyStruct() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\coreuobject\private\uobject\class.cpp:736]
UE4Editor_UnrealEd!FStructOnScope::Destroy() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\coreuobject\public\uobject\class.h:1149]
UE4Editor_UnrealEd!FStructOnScope::`scalar deleting destructor'()
UE4Editor_UnrealEd!FBlueprintEditorUtils::SetDefaultValueOnUserDefinedStructProperty() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\editor\unrealed\private\kismet2\blueprinteditorutils.cpp:4637]
UE4Editor_UnrealEd!FBlueprintEditorUtils::AddLocalVariable() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\editor\unrealed\private\kismet2\blueprinteditorutils.cpp:4674]
UE4Editor_Kismet!FBlueprintEditor::DoPromoteToVariable() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\editor\kismet\private\blueprinteditor.cpp:3512]
UE4Editor_Kismet!FBlueprintEditor::OnPromoteToVariable() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\editor\kismet\private\blueprinteditor.cpp:3563]
UE4Editor_Kismet!TBaseSPMethodDelegateInstance&lt;0,FBlueprintEditor,0,TTypeWrapper&lt;void&gt; __cdecl(void),bool&gt;::Execute() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:282]
UE4Editor_Kismet!TBaseSPMethodDelegateInstance&lt;0,FBlueprintEditor,0,void __cdecl(void),bool&gt;::ExecuteIfSafe() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:388]
UE4Editor_Slate!FUICommandList::ExecuteAction() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\commands\uicommandlist.cpp:87]
UE4Editor_Slate!SMenuEntryBlock::OnClicked() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\multibox\smenuentryblock.cpp:979]
UE4Editor_Slate!SMenuEntryBlock::OnMenuItemButtonClicked() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\multibox\smenuentryblock.cpp:939]
UE4Editor_Slate!TMemberFunctionCaller&lt;SMenuEntryBlock,FReply (__cdecl SMenuEntryBlock::*)(void) __ptr64&gt;::operator()&lt;&gt;() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegateinstanceinterface_variadics.h:161]
UE4Editor_Slate!TTupleImpl&lt;TIntegerSequence&lt;&gt; &gt;::ApplyAfter_ExplicitReturnType&lt;FReply,TMemberFunctionCaller&lt;SMenuEntryBlock,FReply (__cdecl SMenuEntryBlock::*)(void) __ptr64&gt; &gt;() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates	uple.h:113]
UE4Editor_Slate!TBaseSPMethodDelegateInstance&lt;0,SMenuEntryBlock,0,FReply __cdecl(void)&gt;::Execute() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:282]
UE4Editor_Slate!TBaseDelegate&lt;FReply&gt;::Execute() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegatesignatureimpl_variadics.inl:440]
UE4Editor_Slate!SButton::OnMouseButtonUp() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\widgets\input\sbutton.cpp:236]
UE4Editor_Slate!SMenuEntryButton::OnMouseButtonUp() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\multibox\smenuentryblock.cpp:361]
UE4Editor_Slate!&lt;lambda_df946b2745ea2bbab398d4acc9cc3d04&gt;::operator()() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:4264]
UE4Editor_Slate!FEventRouter::Route&lt;FReply,FEventRouter::FToLeafmostPolicy,FPointerEvent,&lt;lambda_df946b2745ea2bbab398d4acc9cc3d04&gt; &gt;() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:214]
UE4Editor_Slate!FSlateApplication::RoutePointerUpEvent() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:4267]
UE4Editor_Slate!FSlateApplication::ProcessMouseButtonUpEvent() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:4651]
UE4Editor_Slate!FSlateApplication::OnMouseUp() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:4629]
UE4Editor_Core!FWindowsApplication::ProcessDeferredMessage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\private\windows\windowsapplication.cpp:1403]
UE4Editor_Core!FWindowsApplication::DeferMessage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\private\windows\windowsapplication.cpp:1708]
UE4Editor_Core!FWindowsApplication::ProcessMessage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\private\windows\windowsapplication.cpp:706]
UE4Editor_Core!FWindowsApplication::AppWndProc() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\private\windows\windowsapplication.cpp:628]
user32
user32
UE4Editor_Core!FWindowsPlatformMisc::PumpMessages() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\private\windows\windowsplatformmisc.cpp:792]
UE4Editor!FEngineLoop::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\launchengineloop.cpp:2376]
UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\launch.cpp:142]
UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]



Managed to get it running again after commenting out huge swaths of code, so I am in the process of the ever fun narrowing down process. Oh and my component is now showing up so the two issues are definitely related.

EDIT: Ok I have narrowed it down to the FCommodityIventory struct


Ok so the problem is definitely the struct. If I declare the struct it crashes, if I comment it out (and change nothing else) then it runs. Very frustrating. I mean its perfectly valid code. It compiles fine. So what am I doing wrong?



USTRUCT()
struct FCommodityInventory
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		FString CommodityName;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		int32 CurrentInventoryCount;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		int32 IdealInventoryCount;
};



Ok so even if I declare this struct somewhere else, same issue.

EDIT: Ok I managed to fix it. The fault is ultimately mine but boy oh boy the engine could have made this easier.

A long time back I had a blueprint struct with the same name. That was long ago renamed, but my only guess that some remnants of it must have been hanging around somewhere. I renamed my struct in code and now it all works.

Hey, i’m glad you found the issue. I always looked over the thread, but i didn’t know why this came up.

Seems like it was something that i couldn’t know at all.

I merged all your posts. I know that bumping a thread with new information seems necessary, but i would like you to step
back from double posting/bumping without a 4 day delay! You can always use the EDIT Button of your last post.

At this point, it was ok to double post, since you solved the issue etc. This is just a kind reminder for other threads and situation
that might come up (:

Sorry the intent wasn’t to bump, I was just posting things as I found them. On some forums edits in that case are actually discouraged because then people don’t know you’ve added new information. Anyway now I know.