AssetBundleGraph.IntegratedGUIImportSetting.ValidateInputSetting C# (CSharp) Method

ValidateInputSetting() public static method

public static ValidateInputSetting ( NodeData node, BuildTarget target, List incomingAssets, Action multipleAssetTypeFound, Action unsupportedType, Type>.Action incomingTypeMismatch, Action errorInConfig ) : void
node NodeData
target BuildTarget
incomingAssets List
multipleAssetTypeFound Action
unsupportedType Action
incomingTypeMismatch Type>.Action
errorInConfig Action
return void
        public static void ValidateInputSetting(
			NodeData node,
			BuildTarget target,
			List<Asset> incomingAssets,
			Action<Type, Type, Asset> multipleAssetTypeFound,
			Action<Type> unsupportedType,
			Action<Type, Type> incomingTypeMismatch,
			Action<ConfigStatus> errorInConfig
		)
        {
            Type expectedType = TypeUtility.FindIncomingAssetType(incomingAssets);
            if(multipleAssetTypeFound != null) {
                if(expectedType != null) {
                    foreach(var a  in incomingAssets) {
                        Type assetType = TypeUtility.FindTypeOfAsset(a.importFrom);
                        if(assetType != expectedType) {
                            multipleAssetTypeFound(expectedType, assetType, a);
                        }
                    }
                }
            }

            if(unsupportedType != null) {
                if(expectedType != null) {
                    if(expectedType == typeof(UnityEditor.TextureImporter) 	||
                        expectedType == typeof(UnityEditor.ModelImporter) 	||
                        expectedType == typeof(UnityEditor.AudioImporter)
                    ) {
                        // good. do nothing
                    } else {
                        unsupportedType(expectedType);
                    }
                }
            }

            var status = GetConfigStatus(node);

            if(errorInConfig != null) {
                if(status != ConfigStatus.GoodSampleFound) {
                    errorInConfig(status);
                }
            }

            if(incomingTypeMismatch != null) {
                // if there is no incoming assets, there is no way to check if
                // right type of asset is coming in - so we'll just skip the test
                if(incomingAssets.Any() && status == ConfigStatus.GoodSampleFound) {
                    Type targetType = GetReferenceAssetImporter(node).GetType();
                    if( targetType != expectedType ) {
                        incomingTypeMismatch(targetType, expectedType);
                    }
                }
            }
        }