public static void ValidateModifier(
NodeData node,
BuildTarget target,
List<Asset> incomingAssets,
Action<Type, Type, Asset> multipleAssetTypeFound,
Action noModiferData,
Action failedToCreateModifier,
Action<Type, Type> incomingTypeMismatch
)
{
Type expectedType = TypeUtility.FindIncomingAssetType(incomingAssets);
if(expectedType != null) {
foreach(var a in incomingAssets) {
Type assetType = TypeUtility.FindTypeOfAsset(a.importFrom);
if(assetType != expectedType) {
multipleAssetTypeFound(expectedType, assetType, a);
}
}
}
if(string.IsNullOrEmpty(node.InstanceData[target])) {
noModiferData();
}
var modifier = ModifierUtility.CreateModifier(node, target);
if(null == modifier ) {
failedToCreateModifier();
}
// 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()) {
var targetType = ModifierUtility.GetModifierTargetType(modifier);
if( targetType != expectedType ) {
incomingTypeMismatch(targetType, expectedType);
}
}
}