private void AddPrefabAsDependency(string id, Object obj, Stack <PathSegment> stack) { Object correspondingObjectFromSource = PrefabUtility.GetCorrespondingObjectFromSource(obj); string assetId = NodeDependencyLookupUtility.GetAssetIdForAsset(correspondingObjectFromSource); string assetPath = AssetDatabase.GetAssetPath(correspondingObjectFromSource); string guid = AssetDatabase.AssetPathToGUID(assetPath); if (guid != NodeDependencyLookupUtility.GetGuidFromAssetId(id)) { AddDependency(id, new Dependency(assetId, ConnectionType, NodeType, stack.ToArray())); } }
public override Result GetDependency(Type objType, object obj, SerializedProperty property, string propertyPath, SerializedPropertyType type, Stack <PathSegment> stack) { if (type != SerializedPropertyType.ObjectReference) { return(null); } var value = property.objectReferenceValue; if (value == null) { return(null); } string assetPath = AssetDatabase.GetAssetPath(value); if (string.IsNullOrEmpty(assetPath)) { return(null); } if (ExcludedProperties.Contains(propertyPath)) { return(null); } if (ExcludedDependencies.Contains(Path.GetFileName(assetPath))) { return(null); } string assetId = NodeDependencyLookupUtility.GetAssetIdForAsset(value); string guid = NodeDependencyLookupUtility.GetGuidFromAssetId(assetId); if (!(guid.StartsWith("0000000") || value is ScriptableObject || AssetDatabase.IsSubAsset(value) || AssetDatabase.IsMainAsset(value))) { return(null); } return(new Result { Id = assetId, ConnectionType = ConnectionType, NodeType = NodeType }); }