- Home /
Question by
cdrzal · Nov 02, 2015 at 07:22 PM ·
iosshadersmaterial color
Changing mesh shader not working iOS
I have 2 custom shaders that we allow players to cycle through which show different topographical details on our terrain mesh. Players can toggle each shader with a button click in our UI. This has worked beautifully in our Android builds, but does not work on an iPhone. When I try and toggle the shader, it blips to pink for a split second, then goes back to what it was before. Also, it does work on an iPad just fine, which is odd. Could there be a graphics setting I am overlooking? Is this an iPhone hardware issue? Below is the script for the button to rotate shaders on our meshes.
public class NewLayersButton : MonoBehaviour
{
public Material green;
public Material collar;
public Material rough;
public Material[] layers;
public string[] labels;
public float labelTime = 1.0f;
private Text label;
private Image image;
private int layerIndex = 0;
private float labelTimer;
public void Awake()
{
label = this.GetComponentInChildren<Text> ();
image = this.GetComponent<Image> ();
}
public void OnGUI()
{
if (Time.time > labelTime + labelTimer) {
label.text = "";
image.enabled = true;
}
}
public void tapFunction ()
{
layerIndex = (layerIndex >= layers.Length - 1)? 0 : layerIndex + 1;
green = layers [layerIndex];
collar = layers [layerIndex];
rough = layers [layerIndex];
label.text = labels [layerIndex];
image.enabled = false;
labelTimer = Time.time;
}
}
Comment