Improve array property view
Use Case
When I collaps array property item I see only class name
Problem Description
Its hard to navigate in a large array property.
Proposed Solution
How about display user defined data instead class name?
@ccclass('AppViewPrefab')
class AppViewPrefab {
@property(CCString)
@displayName // << like this
readonly id: string = "";
@property(Prefab)
readonly prefab!: Prefab;
// << like this
toString() { return id; }
}
@property([AppViewPrefab])
private prefabs: AppViewPrefab[] = [];
How it works
No response
Alternatives Considered
I think I can write custom editor for every list, but its not optimal
Additional Information
No response
Hello, can you tell me what the purpose is for displaying the name you need for yourself?
Sometimes I have list items with many properties
I want to collapse the list to find element easier
You have so much data, why not save it as a JSON file
Bad example. This is not game configs.
Typically this list closely associated with prefab nodes tree and contains refs to components.
enum AppButtonPhase {
Normal = 0,
Hover = 1,
Pressed = 2,
Disabled = 3,
}
Enum(AppButtonPhase);
@ccclass('AppButtonFaces')
class AppButtonFaces {
@property({ type: AppButtonPhase })
phase: AppButtonPhase = AppButtonPhase.Normal;
@property(Node)
target!: Node;
@property(CCBoolean)
active: boolean = true;
@property(CCFloat)
scale: number = 1;
@property(Vec2)
offsetX: Vec2 = Vec2.ZERO
@property(Color)
color: Color = Color.WHITE;
}
@ccclass('AppButton')
export class AppButton extends Component {
@property([AppButtonFaces])
private faces: AppButtonFaces[] = [];
}
I can turn AppButtonFaces into Component. But its looks like overengineering.
oke, I understand your feature. We will discuss it further.