1

In the Button component we have CustomEventData. In my understanding the purpose it to send extra parameter when user tap the button.

enter image description here

I have tried to use it like this:

use_powerUp(par: string){
    console.log("MapScreenManager::use_powerUp() = ", par);
}

The Button will call the function and I thought the CustomEventData will be automatically become 1 parameter that will fill the par parameter. But turns out it didn’t.

Can anyone guide me how to properly use the CustomEventData?

I am using Cocos Creator 3.5.0 with Typescript.

noobsee
  • 806
  • 15
  • 29

1 Answers1

2

I just found the solution, it's very simple

use_powerUp(event: Event, CustomEventData)
{

}
noobsee
  • 806
  • 15
  • 29