Search Unity

CustomRenderTexture crash

Discussion in 'General Graphics' started by cecarlsen, Aug 16, 2017.

  1. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    I have reported a consistent Editor crash that happens when creating a CustomRenderTexture from script and assigning a material to it. Let me know if you experience the same.

    OSX 10.12.6. Unity 2017.1.0f3.

    Here is a test script that should cause a crash.

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class ScriptedCustomRenderTextureTest : MonoBehaviour
    4. {
    5.     Material _mat;
    6.     CustomRenderTexture _tex;
    7.  
    8.     void OnEnable()
    9.     {
    10.         Shader shader = Shader.Find("CustomRenderTextureShader");
    11.         _mat = new Material( shader );
    12.  
    13.         _tex = new CustomRenderTexture( 512, 512 );
    14.         _tex.name = GetType().Name;
    15.         _tex.Create();
    16.         _tex.material = _mat;
    17.     }
    18.      
    19.     void OnDisable()
    20.     {
    21.         _tex.Release();
    22.         Destroy( _tex );
    23.         Destroy( _mat );
    24.     }
    25. }
    And the shader. Put it in a Resources folder.
    Code (CSharp):
    1. Shader "CustomRenderTextureShader"
    2. {
    3.     SubShader
    4.     {
    5.         Pass
    6.         {
    7.             Name "TEST"
    8.  
    9.             CGPROGRAM
    10.  
    11.             #include "UnityCustomRenderTexture.cginc"
    12.             #pragma target 3.0
    13.             #pragma vertex CustomRenderTextureVertexShader
    14.             #pragma fragment frag
    15.          
    16.             float4 frag( v2f_customrendertexture i ) : COLOR
    17.             {
    18.                 return float4( i.globalTexcoord.xy, 0, 1 );
    19.             }
    20.  
    21.             ENDCG
    22.         }
    23.     }
    24. }
     
  2. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    The bug has been confirmed by the QA team.
     
  3. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Oh great. I'm getting this too.
     
  4. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Also, not possible to create a CustomRenderTexture in Editor and add as a child of another asset.

    Such a shame that these new features aren't fully tested before being implemented.
     
  5. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    I've seen a lot of half done features being rolled by UT. I can't believe they didn't catch this bug in time. Test test test!

    Please report that problem to Unity as well, otherwise we may have to wait longer for a fix.
     
  6. cresquin

    cresquin

    Joined:
    Nov 14, 2015
    Posts:
    1
    Still seeing this in 2017.2.0f3 on both OSX and Windows.

    Appears fixed in 2017.2.0.p1 !!
     
    Last edited: Nov 7, 2017
  7. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,327
    what's the latest on those crashes?