If anyone is still looking for a way to use a color ID mask in Unreal you can find a color ID mask function (any color) as part of Extile’s non repetitive tiling material here:
Short video on how it works: