I have a game that is using GUITextures for buttons but it isn't working on different resoltutions. So I was told NGUI would do it very easily. But I already have the code written for the GUITexture buttons.

How do I do it for NGUI buttons using the same textures? I've searched everywhere and can not find any answers....the NGUI forums are not much help.

有帮助吗?

解决方案

Your Gameobject should have any type of collider component then in script do the following:

//Use UIEventListener to bind your gameobject with your desired method 

public GameObject YOUR_BUTTON_GAMEOBJECT;

UIEventListener.Get(YOUR_BUTTON_GAMEOBJECT).onClick += YOUR_METHOD_NAME;


//METHOD SIGNATURES 
void YOUR_METHOD_NAME(GameObject gameObject){
     //On Click Stuff
}

Hope this helps

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top