Wednesday, June 29, 2022
HomeGame DevelopmentTypescript Map Property - Cocos Creator

Typescript Map Property – Cocos Creator


Good day,

I’m attempting to make a element property utilizing the Map typescript class.

Here’s a minimal instance.

import { _decorator, Element, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('NewComponent')
export class NewComponent extends Element {
    @property(Map)
    public myMap: Map<string, string> = new Map<string, string>([['a' , 'b']]);
}

This compiles, however here’s what is displayed within the editor :

I discovered on the top of this subject from 2018 that maps weren’t supported. Typescript array @property – #13 by jare
It has been 4 years although, and that i don’t discover another mentions within the doc or the discussion board.

The truth that it compiles and show one thing with out errors or warning makes me ask myself whether or not it’s nonetheless not supported or if it’s me doing one thing flawed. May somebody inform me which one it’s ?

If it isn’t but supported, is there a solution to constraint two completely different Array properties to all the time have the identical measurement within the editor ? In order that i can safely remap them at runtime.

Thanks prematurely.


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments