protected void LinkArgNameToValue(string argName, string propName, int index) { values[index] = null; string property = propName; string[] split = propName.Split('.'); string lastProp = split[split.Length - 1]; if (split.Length > 1) { split = split.Take(split.Length - 1).ToArray(); } else { split = null; } System.Action <object[]> action = (object[] o) => { IEmitter arg = Root.GetArgument(argName); if (Reflector.GetPropValue(arg, propName) == null) { //string a = argName + "......." + propName + " .. "+index; //Debug.Log(argName); //Debug.Log(propName); return; } //object val = GetPropValue(arg, propName).ToString(); //Debug.Log(String.Format("Argument object {0} has value {1}", propName, val.ToString())); SetValue(Reflector.GetPropValue(arg, propName), index); }; Root.ChangeArguments += () => { // Register the "Value update"-Lambda with the Root element's argument with this name. // Deregister old lambda from the element. // TODO: if argument changes, we should deregister the addedAction. IEmitter arg = Root.GetArgument(argName); if (split != null) { string join = string.Join(".", split); IEmitter lastEmitter = Reflector.GetPropValue(arg, join) as IEmitter; // TODO: try harder to find emitter (not is only the last) if (lastEmitter == null) { Debug.LogWarningFormat("Property '{1}' of '{0}' is not an emitter ({2}).", argName, join, propName); } else { arg = lastEmitter; property = lastProp; } } if (addedAction.ContainsKey(index)) { arg.RemoveAction("On" + property + "Changed", addedAction[index]); } addedAction[index] = arg.AddAction("On" + property + "Changed", action); }; }