SearchValue OnPropertyFilter(GameObject go, string propertyName) { if (!go) { return(SearchValue.invalid); } if (string.IsNullOrEmpty(propertyName)) { return(SearchValue.invalid); } using (var view = SearchMonitor.GetView()) { var documentKey = SearchUtils.GetDocumentKey(go); var recordKey = PropertyDatabase.CreateRecordKey(documentKey, PropertyDatabase.CreatePropertyHash(propertyName)); if (view.TryLoadProperty(recordKey, out object data) && data is SearchValue sv) { return(sv); } foreach (var c in EnumerateSubObjects(go)) { var property = FindPropertyValue(c, propertyName); if (property.valid) { view.StoreProperty(recordKey, property); return(property); } } view.StoreProperty(recordKey, SearchValue.invalid); } return(SearchValue.invalid); }
SearchValue OnPropertyFilter(GameObject go, string propertyName) { if (!go) { return(SearchValue.invalid); } if (string.IsNullOrEmpty(propertyName)) { return(SearchValue.invalid); } #if USE_PROPERTY_DATABASE using (var view = SearchMonitor.GetView()) #endif { #if USE_PROPERTY_DATABASE var documentKey = SearchUtils.GetDocumentKey(go); var recordKey = PropertyDatabase.CreateRecordKey(documentKey, PropertyDatabase.CreatePropertyHash(propertyName)); if (view.TryLoadProperty(recordKey, out object data)) { return((SearchValue)data); } #endif var gocs = go.GetComponents <Component>(); for (int componentIndex = 0; componentIndex < gocs.Length; ++componentIndex) { var c = gocs[componentIndex]; if (!c || (c.hideFlags & HideFlags.HideInInspector) == HideFlags.HideInInspector) { continue; } var property = FindPropertyValue(c, propertyName); if (property.valid) { #if USE_PROPERTY_DATABASE view.StoreProperty(recordKey, property); #endif return(property); } } #if USE_PROPERTY_DATABASE view.StoreProperty(recordKey, SearchValue.invalid); #endif } return(SearchValue.invalid); }
public GameObjectData(GameObject go) { this.go = go; this.key = SearchUtils.GetDocumentKey(go); }