void Start() { if (fields.Count != 0) { return; } for (var i = 0; i < 5; ++i) { Transform gameObjectOfFieldParent; try { gameObjectOfFieldParent = transform.FindChild(FieldObjectsPrefix + i); } catch (NullReferenceException) { Debug.LogErrorFormat("The object {0} has no {1} child", transform.gameObject.name, FieldObjectsPrefix + i); continue; } if (gameObjectOfFieldParent == null) { continue; } var field = new MyUiEditField(gameObjectOfFieldParent); fields.Add(field); Debug.LogFormat("{0} obtained", field); } }
void Start() { if(fields.Count != 0) return; for (var i = 0; i < 5; ++i) { Transform gameObjectOfFieldParent; try { gameObjectOfFieldParent = transform.FindChild(FieldObjectsPrefix + i); } catch (NullReferenceException) { Debug.LogErrorFormat("The object {0} has no {1} child", transform.gameObject.name, FieldObjectsPrefix+i); continue; } if (gameObjectOfFieldParent == null) continue; var field = new MyUiEditField(gameObjectOfFieldParent); fields.Add(field); Debug.LogFormat("{0} obtained", field); } }