Example #1
0
    public static CustomAudioBtn Get(GameObject go)
    {
        CustomAudioBtn cab = go.GetComponent <CustomAudioBtn>();

        if (cab == null)
        {
            cab = go.AddComponent <CustomAudioBtn>();
        }
        return(cab);
    }
 public void InitBtnClick(GameObject pageObj = null)
 {
     Button[] btnAry;
     if (pageObj != null)
     {
         btnAry = pageObj.GetComponentsInChildren <Button>(true);
     }
     else
     {
         btnAry = FindObjectsOfType <Button>();
     }
     foreach (var btn in btnAry)
     {
         if (string.IsNullOrEmpty(CustomAudioBtn.Get(btn.gameObject).m_AudioType))
         {
             CustomAudioBtn.Get(btn.gameObject).m_AudioType = "BtnClick";
         }
     }
 }