public class NGUIComponent : MonoBehaviour {
private NGUIComponent root;
private NGUIComponent parent;
// Use this for initialization
void Start () {
parent = Find(transform.parent);
root = Find (transform.root);
Debug.Log (string.Format ("[NGUIComponent, Source: {0}, Parent: {1}, Root: {2}] ", transform, parent, root));
}
private NGUIComponent Find (Transform source) {
if (null == source) {
return null;
}
return source.GetComponent<NGUIComponent> ();
}
public void OnDestroy () {
parent = null;
root = null;
}
}