On the Ecosystem, there's an action called "Material Compare" which should do what you need.
Get the material on the object and store the variable. Use the Material Compare action to compare it against the red material.
Alternatively, use the "Get Property" action on the material component of the object, and store it's name as a string.