Download

TArray<UHeirarchicalInstancedStaticMesh*> can't add blueprints in editor?

I have the following defined in my class:


UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Map)
TArray<UHierarchicalInstancedStaticMeshComponent*> Tiles;

It shows up as expected in the editor, but when I create a blueprint class of HeirarchicalInstancedStaticMesh I can’t add it to the array. I can add items in code without issue. Is there something else I’m supposed to do to be able to dynamically add items in the editor?

what kind of items?
you have an array of pointers. where did you want to get this pointers?
I think if you want to make object every time you add element to array, maybe you should process that array, add new object in code, with NewObject or DuplicateObject, and store pointer to it in that array. but it looks weird…

Are you sure you need an array of HISM components?
maybe you need one HISM component and array of instances in it?
then use HISM->AddInstance

The HISM items.

As I said, I can process this in code with no issues. I wanted to be able to expose the TArray to the editor so that I could customize the contents of the array without touching the code. The HISMs are types of tiles. The class that stores the HISMs use the contents of the array, those types of tiles, to instance out tiles out for a map. Think of it like a map editor - you choose a tile from the list, a brush size and you can paint those tiles out. Since each HISM can only instance a single mesh, I need to have a different one for each mesh - that is, each type of tile. As it is now, I have these hard-coded in the class since I can’t customize them in the editor. This works, but I would like to be able to modify the types of tiles at design time without touching the code again.

Details panels usually won’t show components on any dropdown lists.

No, you can see and select components only in components window.

I have a procedural system, that generates environment with hisms and special “procedure” components, which defines some algorithm of creating/modifying transforms for instances. I tried to make it like yours - to add procedures in some array of procedures, and process them. You can create array of pointers, and create components for it, but there is no way to edit them in editor - its not works in that way. So, I inherit them from scene component, and add manually as usual components.

Hmm well that’s unfortunate. I guess I’ll hard code them for now. It’s not a huge deal, just not what I would prefer.

I’m not sure this is 100% accurate, however. I can make a TArray<UStaticMesh*> edit anywhere and I can add static meshes to it with no problem. The issue seems to be that UHeirarchicalInstancedStaticMesh and a blueprint of HeirarchicalInstancedStaticMesh don’t seem to be the same thing, so you can’t add the blueprints to the array.

UStaticMesh is not a ActorComponent.

So you’re saying that that’s the difference: you can’t add AActor components to a TArray via the editor, but you can add other things?

You can if you build some Details Panel customizations for your tools, but by default Epic doesn’t seem to care about UActorComponents not showing up on certain dropdown lists.