Unity by using UIBehaviour make light UI button system.

Unity UI Button contains all the selectable datas so it's too heavy. 

It's waste of resources when it comes to the mobile development.
In order to cutoff the useless resources for button we have to make new Button system (all UI systems which use selectable are same) by using UIBehaviour and put only the data which we need.

In this post I developed that for button.


Custom UIBehaviour button.

________________________________________________________________________________

using UnityEngine.EventSystems;

using UnityEngine.Events;


public class Joybutton : UIBehaviour, IPointerClickHandler  //HGK

{

    public UnityEvent onClick = new UnityEvent();


    public void OnPointerClick(PointerEventData eventData)

    {

        onClick?.Invoke();

    }


    protected override void OnDestroy()

    {

        onClick.RemoveAllListeners();

    }

}


Crazy Selectable datas

_______________________________________________________________________________________



댓글

이 블로그의 인기 게시물

About AActor!!! "UObject" has no member "BeginPlay"

UNREAL Android build information

C++ 생성자 위임 (delegating constructor)