How to make custom component and function drop now in cocos creator

Hi,

How do I make my own dropdown selection for components and function like the button component?
image

Thanks

The way to find out the secret is to dig into the API documentation, then you will find the clickEvents property is an array of ComponentEventHandler

So you can define your component property in the same way to have the same inspector fields

image
seems that I can’t define it as an array property
I tried, Component.EventHandler, cc.Component.EventHandler,ComponentEventHandler[],cc.ComponentEventHandler[]

What’s the correct way to write it so that it’ll appear in the cocos creator?

You can refer to Button component source code in the engine repo

Be aware of the engine version you are using