XiaoRongEffect.cs 489 B

123456789101112131415161718192021222324252627
  1. // NiuZhiYing
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class XiaoRongEffect : MonoBehaviour {
  7. Material mat;
  8. public float range = 1.0f;
  9. // Use this for initialization
  10. void Start () {
  11. mat = this.GetComponent<Image>().material;
  12. }
  13. // Update is called once per frame
  14. void Update () {
  15. if (mat) {
  16. mat.SetFloat("_range", range);
  17. }
  18. }
  19. void OnEnable()
  20. {
  21. this.range = 1.0f;
  22. }
  23. }