AssetBundleGraph.ModifierUtility.GetModifierTargetType C# (CSharp) Method

GetModifierTargetType() public static method

public static GetModifierTargetType ( IModifier m ) : Type
m IModifier
return System.Type
        public static Type GetModifierTargetType(IModifier m)
        {
            CustomModifier attr =
                m.GetType().GetCustomAttributes(typeof(CustomModifier), false).FirstOrDefault() as CustomModifier;
            UnityEngine.Assertions.Assert.IsNotNull(attr);
            return attr.For;
        }

Same methods

ModifierUtility::GetModifierTargetType ( string className ) : Type

Usage Example

        public static void ValidateModifier(
            NodeData node,
            BuildTarget target,
            IEnumerable <PerformGraph.AssetGroups> incoming,
            Action <Type, Type, AssetReference> multipleAssetTypeFound,
            Action noModiferData,
            Action failedToCreateModifier,
            Action <Type, Type> incomingTypeMismatch
            )
        {
            Type expectedType = null;

            if (incoming != null)
            {
                expectedType = TypeUtility.FindFirstIncomingAssetType(incoming);
                if (expectedType != null)
                {
                    foreach (var ag in incoming)
                    {
                        foreach (var assets in ag.assetGroups.Values)
                        {
                            foreach (var a in assets)
                            {
                                Type assetType = a.filterType;
                                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
            // expectedType is not null when there is at least one incoming asset
            if (incoming != null && expectedType != null)
            {
                var targetType = ModifierUtility.GetModifierTargetType(modifier);
                if (targetType != expectedType)
                {
                    incomingTypeMismatch(targetType, expectedType);
                }
            }
        }
All Usage Examples Of AssetBundleGraph.ModifierUtility::GetModifierTargetType