using UnityEngine;
using System.Collections;
using FrameBase;
[ExecuteInEditMode]
public class UIEffectQueue: MonoBehaviour
{
private GameObject mBaseWidget;
public GameObject basewidget {
set {
mBaseWidget = value;
widget = mBaseWidget.GetComponent ();
if (widget == null)
GameDebug.GameLogError (gameObject.name + " widget is null!");
render = GetComponent ();
}
get {
return mBaseWidget;
}
}
public int rendererOffset = 0;
public bool runOnce = false;
UIWidget widget;
Renderer render;
void Update ()
{
//if (basewidget.GetComponent () != null) {
// w = basewidget.GetComponent ();
//}
//Renderer r = GetComponent ();
//if (widget == null)
//{
// widget = GetComponent();
//}
if (widget != null && widget.drawCall != null && render != null) {
int targetQ = widget.drawCall.renderQueue + rendererOffset;
if (targetQ > 0) {
#if UNITY_EDITOR
render.material.renderQueue = targetQ;
#else
render.sharedMaterial.renderQueue = targetQ;
#endif
}
}
#if UNITY_EDITOR
if (runOnce && Application.isPlaying) {
#else
if (runOnce ) {
#endif
this.enabled = false;
}
}
}
网友评论