/// <summary> /// Resolve the value by traversing the property path /// </summary> /// <param name="root"></param> /// <param name="index"></param> /// <returns></returns> public object GetValue(object root, object[] index) { if (!IsValid) { return(null); } if (root == null) { if (WarnOnGetValue) { Debug.LogWarningFormat("Cannot get value to {0} on a null object", Path); } return(null); } if (PropertyPathAccessors.ValidateGetter(_pPath, ref _getter)) { return(_getter(root)); } // ReSharper disable once ForCanBeConvertedToForeach - unity has bad foreach handling for (int i = 0; i < _pPath.Length; i++) { if (root == null) { if (WarnOnGetValue) { Debug.LogWarningFormat("value of {0} was null when getting {1}", Parts[i - 1], Path); } return(null); } var part = GetIdxProperty(i, root); if (part == null) { return(null); } root = part.GetValue(root, null); } return(root); }