FWaterUtils::GetOrCreateTransientMID

Creates a transient [UMaterialInstanceDynamic](API\Runtime\Engine\Materials\UMaterialInstanceDynamic) out of the material interface in input or returns the existing one if it's compatible (same parent material)

Choose your operating system:

Windows

macOS

Linux

References

Module

Water

Header

/Engine/Plugins/Experimental/Water/Source/Runtime/Public/WaterUtils.h

Include

#include "WaterUtils.h"

Source

/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterUtils.cpp

Syntax

static UMaterialInstanceDynamic * GetOrCreateTransientMID
(
    UMaterialInstanceDynamic * InMID,
    FName InMIDName,
    UMaterialInterface * InMaterialInterface,
    EObjectFlags InAdditionalObjectFlags
)

Remarks

Creates a transient UMaterialInstanceDynamic out of the material interface in input or returns the existing one if it's compatible (same parent material)

Returns

a compatible transient MID if InMaterialInterface is valid, nullptr otherwise

Parameters

Parameter

Description

InMID

is the current MID currently used. It will be the one returned if it's already compatible with InMaterialInterface

InMIDName

is the UObject's name in case we need to create a MID

InMaterialInterface

is the parent material interface of the desired MID: can be a UMaterial or UMaterialInstanceConstant, in which case a MID can be created, or a UMaterialInstanceDynamic, which will just be returned as-is (as we can't create MID out of another). In the latter case, it is expected to be a transient MID. InMID is read-only so it's up to the caller to decide to update or not the MID. Usually, the calling code will be : MID = FWaterUtils::GetOrCreateTransientMID(MID, ...)

InAdditionalObjectFlags

is the additional flags that should be set on the newly-created object, if any (it will come out with at least RF_Transient as the name of the function implies)