[SOLVED] cocos2d::ui::Button not showing up

Hi,

I am trying to use this code, but unfortunately, the button is not showing up. I don’t see the button sprite on the screen. All I can see is the ‘Retry’ text, which is very small. But no button in sight.

mRetryButton = cocos2d::ui::Button::create("asset_button_up.png", "asset_button_down.png", "asset_button_hover.png");
mRetryButton->setAnchorPoint(cocos2d::Vec2(0.5f , 0.5f));
mRetryButton->setPosition(cocos2d::Vec2(screenSize.width / 2.0f , screenSize.height / 2.0f));
mRetryButton->setTitleText("Retry");

mRetryButton->addTouchEventListener(
	[&](cocos2d::Ref * sender , cocos2d::ui::Widget::TouchEventType type)
	{
		
	});

I added the button to the Scene.

this->addChild(mRetryButton, 6);

I have not made or add it to a Menu, it just a simple button.

I’ve checked the .plist file and I can see the asset name listed accordingly.

Can you help figure out why it doesn’t show up?

Thank you!

Try and display your images as normal sprite … do they still not showing?

Thanks! I was able to show it now. It was just a problem with z-index. I able to fix and it was now showing up!

Thank you!