- Home /
MaterialPropertyBlock how to access GetColor()
I am looking at the docs for Unity's MaterialPropertyBlock and there doesn't seem to exist a GetColor(...)
function, but has Get*()
for all other types.
I need to read a Color
from the MaterialPropertyBlock. Is there any way to do that?
Answer by meat5000 · May 06, 2016 at 11:47 AM
Have you tried it anyway? Sometimes the docs are incomplete.
So, I looked at the class in the Scripting API and I see that the SetColor function requires the name or ID of the property you are trying to set.
You can access these properties from script but yes GetColor seems to be missing.
Instead of using this, perhaps you could try returning the value as a Vector as GetVector wants a Vector4, which is what a color is, I do believe.
Confirmed - GetVector will return the color set by GetColor.