This feature is so nice I’m sure it already exists but I’ve looked through the UPROPERTY specifiers and can’t find it. If someone could show me where to find it that would be awesome and if not how do we get a feature request into Epic?
In the editor there are drop down lists for arrays. These are indexed but closed by default (a good thing with large subobjects).
I would like to replace the text (“1 members” in the array below) with something more useful. In the case shown CartoonForest1 and all it’s friends would be much more useful inline in the array.
Hopefully this can be done and the text below is then useful only for historical purposes
With nested structures you would likely want to nominate an array ID property. There are three distinct levels of control I’ve tried over the years when approaching this in my own tools and the simplest is currently working for me. That’s (1) in the list below. I have no idea how feasible these are within Unreal’s reflection / editor system.
- Within a USTRUCT / CLASS that might go in arrays. UPROPERTY(UseAsArrayID) FString m_Name;
- Within the parent array UPROPERTY(ArrayEditorElement=m_Name) TArray
- Within the parent array UPROPERTY(ArrayEditorFormat(“%s spawns %d awesome things”, m_Name, m_SpawnCount))
While I’ve implemented and used (3) in the past I’ve not regretted it being missing in subsequent editors.
An example in my current clunky but happy C# data editor is below.
Cheers!
Bonus requests… these make all the difference in user experience!
CTRL + Up / Down to rearrange array elements.
Arrow Left / Right to goto parent / child element in tree, enter to enter edit mode.
This would be so awesome either as a new feature or someone saying 'dude just derive from UObject and override xxx. Note to self go look in UOBject just in case…
Given that no answer (which seems to be rather usual on this forum) simply means “NO”, I assume this is not possible?
As far as i know.
I’m posted it on the forums too and someone suggested it would be hard to implement. Not knowing the details of why I find this odd as it could be implemented in a non invasive manner of it couldn’t be embedded in a UPROPERTY. For instance arrays with custom item name handlers could be registered at runtime in the object constructor -
UCUSTOMARRAYNAME(&MyArray, &MyNameFunc)
FString MyNameFunc(void *pData)…
Just putting this down in case someone who can do something feels like helping. Most of my data is in my own tools but some is in the editor and not having custom names makes it very hard to navigate (resorting to print statements with indices and useful names in the output).
It could even be something per array…
RegisterNameFunction(MyArray, [this](const TMyArrayItem& item) -> FString { return SomeCoolString;});
And how about multi select, paste, delete
Or, even an array index in the reference view would be handy…
After many hours gnashing teeth trying to do exactly this…
I’ve found a fairly nice solution - Use this undocumented meta tag !
UPROPERTY(meta = (TitleProperty = "NameOfSomeMemberPropertyInFMyThing"))
TArray<FMyThing> MyArray;
The lovely thing is it will do its best to convert the value of the named property to display text automagically. (Or you can use an explicit string property if you want to do anything funky)
About a million times more useful than ‘N members’ !
3 Likes
Very nice - confirmed working for TArrays (any pointers for TMaps?) thank you!!!
Hmmm, sadly doesn’t seem to work with polymorphic arrays!