In Cocos Creator, there are built-in asset sorts like:
cc.JsonAssetcc.SpriteFramecc.Prefab
These enable us to import recordsdata (JSON, pictures, prefabs, and so forth.) and assign them to @property fields in Parts.
My Purpose
I wish to create my very own customized asset sort.
Instance:
- Create a customized file:
.ptsor.take a look at - Retailer my very own information
- Drag this file into the Inspector
- Use it like a traditional asset in
@property
What I Tried
Customized Asset Class
import { Asset, _decorator } from 'cc';
const { ccclass } = _decorator;
@ccclass("PleaseWork")
export class PleaseWork extends Asset {}
Editor Extension
- Created extension
- Used
and - Edited
.metaimporter - Adopted official docs
However it nonetheless doesn’t work.
Present Drawback
Cocos Creator doesn’t acknowledge .pts recordsdata as legitimate property:
- Can’t assign in Inspector
- Not transformed to customized Asset
- Not importable
Query
How do I make Cocos Creator:
- Acknowledge customized file sorts
- Import them as Property
- Bind them to customized courses
Like JsonAsset or Prefab?
Please assist. Thanks!
- Adopted official docs
However it nonetheless doesn’t work.
I attempted following the documentation and certainly, at the least on Home windows, plainly some element is lacking for the extension to work correctly.
Since your class extends Asset, you should utilize @property({ sort: Asset }) newDataFile: PleaseWork; and drag and drop will work, nonetheless with out proscribing the asset sort to the specified file sort.


