Hiya! I’ve developed a Cocos Creator editor extension
This picture exhibits how the scriptable asset will present whenever you add it as a element to your node
As you’ll be able to see, this software makes it simpler to grasp proper out of your inspector along with your JSON information. It renders your JSON primarily based on the schema which is documented there:
export kind DataTargetType =
{
kind: string,
properties: Array
}
JSON Format Specification
- For predefined varieties, observe this desk:
Sort Wished | Legitimate Values |
---|---|
Quantity | quantity, Quantity, CCInteger, CCFloat |
String | string, String, CCString |
Node | cc.Node |
JSON | cc.JsonAsset |
Sprite Body | cc.SpriteFrame |
Bitmap Font | cc.BitmapFont |
TTF Font | cc.TTFFont |
Every other asset kind, merely prefix it with cc.
.
Customized Varieties
- You could outline a property inside your json file, referred to as
customTypes
. - For utilizing them, it’s worthwhile to prefix your kind title with
.
Auto Incrementing Enum
For that, merely use array syntax. They are going to be handled as numbers, all ranging from 0.
Solely strings are allowed within the array.
{
"customTypes": {
"DamageType": [
"Pierce",
"Blunt",
"Slash"
],
}
}
Dictionary-like
Use the article syntax for that. Every worth will maintain the worth you assign to their key. Solely a single kind of worth is allowed. i.e: Don’t combine strings and numbers.
{
"customTypes": {
"DamageType": {
"Pierce": 0,
"Blunt": 1,
"Slash": 2
},
"EnemyType": Orc",
}
}
Relying on the recognition of the software, I may additionally improve its functionalities for one thing past my utilization. That will imply including each Array and a key-value assist.
Thanks, All
1 Like
Hiya, may you please present us the package deal/extension