UMaterialInterface::GetReferencedTexturesAndOverrides

Add to the set any texture referenced by expressions, including nested functions, as well as any overrides from parameters.