Exemplo n.º 1
0
    public static void SetSkin(this UnityEngine.UI.MaskableGraphic graphic, string skinCode)
    {
        var comp = graphic.GetComponent <UiSkinner>();

        if (comp == null)
        {
            comp = graphic.gameObject.AddComponent <UiSkinner>();
        }

        comp.SkinCode = skinCode;
        comp.Update();
    }
Exemplo n.º 2
0
        public static UIClickSensor Init(MaskableGraphic target, Action <UIClickSensor> action, int id = 0)
        {
            var sensor = target.GetComponent <UIClickSensor>();

            if (sensor == null)
            {
                sensor = target.gameObject.AddComponent <UIClickSensor>();
            }

            sensor.id     = id;
            sensor.target = target;
            sensor.action = action;

            return(sensor);
        }