I am curious as what might cause a script to run fine in the editor but not in standalone build?
IEnumerator MakeMaterialInvisible(Material mat)
{
float fadeAmount = mat.GetFloat("_FadeAmount");
while (fadeAmount < 1.0f roomVisibilityState == VisibilityState.MakeInvisible)
{
fadeAmount += Time.deltaTime * 1 / 0.5f;
mat.SetFloat("_FadeAmount", Mathf.Min(1.0f, fadeAmount);
yield return null;
}
}
In the editor, the material does “fade” away but in the standalone build, it is unaffected by these _FadeAmount changes. It seems like the material being manipulated could be an instance instead of what is applied to the objects but why would this behave differently in the editor vs. a standalone build? Am I missing something trivial here?
[Update] Seems like whatever material tweaks (texture assignments, etc) that might have been made in the editor, do not exist in the build version. Since I was making a copy of the original material. Changing its shader, I failed to assign a special texture needed to fade the object. In the editor, whatever tweaks I might have made to these objects using this shader was being remembered but that is not the case in the standalone version…