Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Camera.SetReplacementShader doesn’t work on PS4

Discussion in 'PSM' started by SakaRin, Aug 28, 2015.

  1. SakaRin

    SakaRin

    Joined:
    Aug 27, 2015
    Posts:
    1
    SOS! There’s a plane with Standard shader, a box with a simple shader to show texture. I want to replace the box’s shader in main camera when it runs. How can it be working on PC, but not work on PS4?

    I just add a script on the box:
    void Start () {
    Camera.main.SetReplacementShader(Shader.Find("Custom/ReplaceShader"), "RenderType");
    }

    When it runs , it should search the all the shaders in the scene ,when found the same rendertype with Custom/ReplaceShader, it replace that shader with Custom/ReplaceShader.

    Screen shot on PC befor running:

    Result on PC:

    Result on PS4:

    The shader I use on the box befor has the same tag with Cunstom/ReplaceShader:

    Shader "Custom/ReplaceShader" {

    Properties {

    }

    SubShader {

    Tags {"RenderType" = "Overlay"}

    PASS {

    CGPROGRAM

    #pragma vertex vert

    #pragma fragment frag

    #include "UnityCG.cginc"

    fixed4 _Color;

    struct v2f {

    float4 pos : SV_POSITION;

    };

    v2f vert (appdata_base v)

    {

    v2f o;

    o.pos = mul (UNITY_MATRIX_MVP, v.vertex);

    return o;

    }


    fixed4 frag (v2f i) : SV_Target

    {

    return float4(0,0,1,1);

    }

    ENDCG

    }

    }

    }

    Did I miss something?