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. Dismiss Notice

Question Writing texture or other data to material

Discussion in 'Shaders' started by xOrfe, May 5, 2023.

  1. xOrfe

    xOrfe

    Joined:
    Apr 21, 2013
    Posts:
    31
    Hello, I can't figure out how to write texture or other data (like JSON) inside a material in the Unity engine, How can i do that and is it possible to write JSON data?

    upload_2023-5-5_12-40-18.png
     
  2. xOrfe

    xOrfe

    Joined:
    Apr 21, 2013
    Posts:
    31
    Any idea :?
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    You want a material to write to JSON? Not possible. Materials, or more specifically the HLSL shader code, runs entirely on the GPU and the only data it writes is the color for each pixel of the render target it's visible in.

    If you want the material inspector in the editor to write to JSON, that is possible. You would need to write a custom editor for your material.
     
  4. xOrfe

    xOrfe

    Joined:
    Apr 21, 2013
    Posts:
    31
    Thank you for your ansver @bgolus , but istead of writin inside shader i just want to write to .mat asset in the assets folder like below
    upload_2023-5-5_22-9-27.png