/// <summary> /// Registers the passed callback for this view event. /// </summary> /// <param name="callback">Method to call when the specified view event occurs on the target behaviour.</param> /// <seealso cref="Field" /> /// <seealso cref="Source" /> public void Register(ViewEvent.EventDelegate callback) { if (this.source == null || string.IsNullOrEmpty(this.field)) { Debug.LogWarning("Can't register, source of field not set."); return; } // Get event property. ViewEvent viewEvent = (ViewEvent)this.source.GetType().GetField(this.field).GetValue(this.source); viewEvent.Event += callback; }