Search Unity

No preview shown for RenderTexture in Custom Material Editor.

Discussion in 'Immediate Mode GUI (IMGUI)' started by npatch, Apr 5, 2017.

  1. npatch

    npatch

    Joined:
    Jun 26, 2015
    Posts:
    247
    Hi all,
    I've written a custom material editor for a material with some texture inputs. Most of the texture inputs are Texture2Ds which are being changed on runtime using Texture2D.LoadRawData(byte[]) but there is one texture input which is a RenderTexture which is a processed version of one of the Texture2Ds.

    I'm using MaterialPropertyBlocks to assign the texture resources to the renderer which will render the material.

    Usually MPBs don't update their data and show a message that values are driven by MBPs, but I've found that I can update the values properly using the custom MaterialEditor by causing Repaints per frame.

    Since the Texture2Ds are being updated through cameras,I'd like that realtime preview update functionality in order to know what's happening in the editor and be able to know if something is wrong.

    My problem is that I have a preview problem in the texture input that comes from the RenderTexture.

    All Texture2Ds are properly updating their preview realtime but the RenderTexture slot shows a default icon for a non-previewable resource.

    Any ideas as to why that is? Or how I can rectify it?

    Thanks

    UPDATE: Forgot to mention, RT is initialized and created on Awake and released OnApplicationQuit. So at least,during runtime , it should be previewable as it's a Texture basically.