// Use this for initialization void Start() { var finder = new FindCanvasUI(); UIRect ui = null; var components = this.GetComponents <Behaviour>(); foreach (var component in components) { ui = ui ?? finder.Find(component); } Assert.IsNotNull(ui); Debug.Log("FindCanvas is Pass"); }
protected CanvasUIRect GetRoot(Canvas root) { var find = new FindCanvasUI(); foreach (var component in root.GetComponents <Behaviour>()) { var container = find.Find(component); if (container != null) { return(container as CanvasUIRect); } } return(null); }