Download

Additional Flag "Create Dynamic Material Instance" in UPrimitiveComponent

I’d like to have a feature that automatically creates Dynamic Material Instances for every Material a UPrimitiveComponent uses.
LandscapeComponent already has this flag and I’m sure alot of people would like to have this for StaticMeshComponent and SkeletalMeshComponent aswell.
(and also would get rid of a stupid initialization routine that does exactly this)

You already have something similar:


/** Material parameter setting and caching */

    /** Set all occurrences of Scalar Material Parameters with ParameterName in the set of materials of the SkeletalMesh to ParameterValue */
    UFUNCTION(BlueprintCallable, Category = "Rendering|Material")
    void SetScalarParameterValueOnMaterials(const FName ParameterName, const float ParameterValue);

    /** Set all occurrences of Vector Material Parameters with ParameterName in the set of materials of the SkeletalMesh to ParameterValue */
    UFUNCTION(BlueprintCallable, Category = "Rendering|Material")
    void SetVectorParameterValueOnMaterials(const FName ParameterName, const FVector ParameterValue);

These are part of UMeshComponent and will initialize all materials to dynamic material instances when you first call them.