Changes to material from an image component during play mode persisting into edit mode
So I have a material which simulates a blur effect that I've attached to an Image component. I also have some code which accesses the material, and changes the strength of that blur effect.
void SetBlur(float size)
{
blur.GetComponent<Image>().material.SetFloat("_Size", size);
//Debug.Log(size);
}
However, any changes in play mode persist into edit mode. For example, if the size variable is initially set to 0, and is changes to 1 during play mode, it will remain at 1 when I exit play mode and re enter play mode. I've already done some research, and it seems that this is a problem with the .sharedMaterial property, and that .material should be used instead. However I'm already using the plain old .material component, so I think it's a problem with the Image component, as it doesn't have a renderer. How can I fix this? Ideally I'd like to keep using the Image component, as it's a part of my UI.
Your answer
Follow this Question
Related Questions
Change alpha on material with custom shader 0 Answers
So, tiling textures in UI Materials in not a thing? 0 Answers
Advanced UI animations 0 Answers
Android joystick doesn't work after 2nd level >.> 2 Answers
How do I use my Photoshop ui? 0 Answers