public void SetMaterial() { mGraphic = this.GetComponent<MaskableGraphic>(); if (mGraphic != null) { if (mGraphic.material == null || mGraphic.material.name == "Default UI Material") { //Applying default material with UI Image Crop shader mGraphic.material = new Material(Shader.Find("UI Extensions/UILinearDodge")); } } else { Debug.LogError("Please attach component to a Graphical UI component"); } }
protected virtual void Start() { _graphic = GetComponent <MaskableGraphic>(); }
/* * SetOpacity - only changes the alpha of a given color * Params: * - MaskableGraphic UIElement: the object to have its opacity changes * - float alpha: the new transparency value, range 0-1 * Returns: Color for the object */ private Color SetOpacity(MaskableGraphic UIElement, float alpha) { return(new Color(UIElement.color.r, UIElement.color.g, UIElement.color.b, alpha)); }
// Use this for initialization void Awake() { graphic = GetComponent <MaskableGraphic>(); rectTransform = graphic.rectTransform; }
protected abstract void ApplyAnimation(MaskableGraphic target, float delta);