AllowedClasses - Picker is empty

Hi,

If I define one property like:

UPROPERTY(EditDefaultsOnly, Category = Test, meta=(AllowedClasses=“MyAssetClass”, ExactClass = false))
FStringAssetReference MyAsset;

and MyAssetClass define as AMyAssetClass::AActor in the module.

If I create a blueprint, and try to edit this property, the AssetPicker is empty.

Thanks,

Hey -

What type of class are you adding this property to (Actor, Character, Pawn, etc)? Also, what class is MyAssetClass based off of? Are you making a blueprint of the MyAssetClass? Please list the steps that reproduce this issue.

Cheers

Hi,

I’m adding this property to Struct class.

MyAssetClass inherited from Actor, but I have also other classed inheriting from SoundCue, Character or UObject, and I can’t get them work at all.

I’m making a BP of MyAssetClass and this is what I wanted to be seen in the AssetPicker.

In term of steps, I don’t know what to say:

  1. Create a C++ Struct class blueprintable - FMyStruct
  2. Add a UProperty FStringAssetReference defined as in the original post
  3. Create a C++ AMyAssetClass::AActor
  4. Create a BP from AMyAssetClass
  5. Create a BP from FMyStruct
  6. in the BP of FMyStruct, open the asset picker from its properties and it’s empty while we should see the BP from AMyAssetClass.

ExactClass is false be default (as per my understanding) so it’s means that all classes MyAssetClass & Child of MyAssetClass should be listed.

Thanks,

I’m not sure what you mean by creating a blueprint from the struct? I created a new class (MyActor) and added a struct:

USTRUCT(BlueprintType)
struct FMyStruct
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditDefaultsOnly, Category = Test, meta = (AllowedClasses = "MyAssetClass", ExactClass = false))
		FStringAssetReference MyStructAsset;
};

After compiling I created a blueprint of MyActor and was able to add a variable of MyStruct. After compiling the blueprint I could select the My Struct Asset drop down which showed all available actors/classes.

Can you elaborate on your setup or what I’m doing differently.

Ok. We can continue from what you did.

So you have a C++ class ‘AMyActor’ with a Struct property of type FMyStruct.
You created a BP from AMyActory called MyBP.

In MyBP, you can see the MyStruct variable and open up the picker. That’s great.

As “MyAssetClass” is not existing, the pciker show you all the classes and didn’t filter anything (strange but that seems to be the default behavior).

Now we want to filter out the picker, so you should set properly the AllowedClasses meta property to filter a subset of the classes. By example, try to filter AMyActor. You should have 1 result, your newly created BP.

In my case, I wasn’t able to get the proper result when setting the AllowedClasses to a existing classes, the picker was empty.

Thanks,

Here’s what my header file looks like:

#pragma once

#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

USTRUCT(BlueprintType)
struct FMyStruct
{
	GENERATED_USTRUCT_BODY()

		UPROPERTY(EditDefaultsOnly, Category = Test, meta = (AllowedClasses = "AMyActor", ExactClass = false))
		FStringAssetReference MyStructAsset;
};

UCLASS()
class MYPROJECT13_API AMyActor : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMyActor();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
		FMyStruct StructProperty;
};

As you stated, I created a blueprint based on MyActor. When I expand the dropdown for MyStructAsset it still shows available classes.

Can you post the code you’re using along with a screenshot of what your blueprint details look like for comparison?

You must remove the A in the classname in allowedclass.
It is the way you should set it as per some example in the github code.

Hey -

After further testing I found that the drop down list is populated based on what is in the level. Each instance of the blueprint that is added to the level will appear in the list. This includes other blueprints based on MyActor once an instance exists in the level.

Cheers

Thanks for the time spent on this case to finally understand how the meta property works.

My question now is more, is this by design? It’s very limited is term of use to only filter asset instance.
or does AllowAbstract or anoter property allow for us to not only have instance in the pickup?

the goal is to have something like “TSubClassOf” for StringAssetReference.

Thanks,

So, for clarification, you want to be able to select the drop down and have it only show things that are of type StringAssetReference or derived from StringAssetReference, is that correct?

This will not work since the drop down list will be populated for UObjects however a Struct is not a UObject thus won’t appear in the list.

Hi,

No, I just want to see all BP of Type AMyActor, and only the one that are instanced in the level. I mean if I create a BP based on AMyActor in the content browser, I want to be able to see it in the pickup list.

When you have a variable of TSubClassOf, the pickup is properly filled, I want the same but with StringAssetReference and the metadata “AllowedClasses”.

Hey ,

I’m just trying to make sure I enter the correct feature request for what you’re asking. So you want StringAssetReference and TSubClassOf to work in tandem, such that the dropdown list only shows the actors of a specified type (as per TSubClassOf) and only shows actors placed in the level (does not show content browser assets)? If I’m still misunderstanding, please provide an example of what you’re trying to accomplish.

Hi,

My request is to be able to see actor of a specific class (and child of it) from at least the Content Browser asset.

As of today and as per your test, we can only see Actors placed in level. I need the browser assets.

thanks,

Hey -

I’ve entered a feature request to have all available assets appear when using StringAssetReference and AllowedClasses (Ue-29817).

Cheers

Perfect Thanks,