Skip to main content
deleted 2 characters in body
Source Link
noone
  • 96
  • 6

It may lead to longer load times, but you could switch shaders in Awake based on the platform:

// Your Assets folder should contain a folder called Resources,
// containing a renderershader called mobileShader
Shader mobileShader = Resources.Load("mobileShader") as Shader;
 
// Called when a GameObject with this script is loaded
void Awake() 
{
    // Check if we are on mobile
    if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
    {
        // Change just the shader
        GetComponent<Renderer>().material.shader = mobileShader;
    }
}

It may lead to longer load times, but you could switch shaders in Awake based on the platform:

// Your Assets folder should contain a folder called Resources,
// containing a renderer called mobileShader
Shader mobileShader = Resources.Load("mobileShader") as Shader;
 
// Called when a GameObject with this script is loaded
void Awake() 
{
    // Check if we are on mobile
    if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
    {
        // Change just the shader
        GetComponent<Renderer>().material.shader = mobileShader;
    }
}

It may lead to longer load times, but you could switch shaders in Awake based on the platform:

// Your Assets folder should contain a folder called Resources,
// containing a shader called mobileShader
Shader mobileShader = Resources.Load("mobileShader") as Shader;
 
// Called when a GameObject with this script is loaded
void Awake() 
{
    // Check if we are on mobile
    if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
    {
        // Change just the shader
        GetComponent<Renderer>().material.shader = mobileShader;
    }
}
Source Link
noone
  • 96
  • 6

It may lead to longer load times, but you could switch shaders in Awake based on the platform:

// Your Assets folder should contain a folder called Resources,
// containing a renderer called mobileShader
Shader mobileShader = Resources.Load("mobileShader") as Shader;
 
// Called when a GameObject with this script is loaded
void Awake() 
{
    // Check if we are on mobile
    if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
    {
        // Change just the shader
        GetComponent<Renderer>().material.shader = mobileShader;
    }
}