12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using DG.Tweening;
- using System;
- using UnityEngine;
- using UnityEngine.UI;
- using XRTool.Util;
- namespace XRTool.WorldUI
- {
- public class XRIcon3D : XRImage3D
- {
- private Renderer icon;
- [HideInInspector]
- public Texture2D img;
- protected override void Start()
- {
- base.Start();
- SetIcon();
- }
-
- public Renderer Icon
- {
- get
- {
- if (!icon)
- {
- icon = UnityUtil.GetBreadthChild<Renderer>(transform, "Icon");
- }
- return icon;
- }
- }
- public void SetIcon()
- {
- if (Icon && img && Icon.enabled)
- {
- try
- {
- UnityUtil.ChangeMateTexture2D(Icon, img);
- }
- catch (Exception ex)
- {
- UnityLog.LogError(icon.material + " have no mainTexture");
- }
- }
- }
- }
- }
|