- Home /
Load Render Textures into Raw Image Object via C#
Hello Everyone,
I'm Roshan Aravinda and newcomer for unity. I'm developing a project as my final year project in university. With that project I have a UI panel and there is a Raw image object named as "rawmodel".
And also I have two render textures models as follows. (box_model and spr_model)
Now my problem is I need to change the Texture property of Raw Image(rawmodel) object as box_model or spr_model by using C# script. Manually I can change the Texture property with those render textures and also it works perfectly. But I need to do with it C#.
If there is a anyone who is like to help me, I appreciate your valuable response for me.
Thank You!
Answer by Ali_Jaffer · Sep 24, 2018 at 07:38 AM
it is simple bro make two variables of type Texture
public Texture renderTexture1; public Texture renderTexture1;
now make a RawImage Variable
public RawImage rawImage;
now change the texture of rawImage that you want;
rawImage.Texture = renderTexture1;
and vice versa;
Hello @Ali_Jaffer
Thanks for your response for me. I solved this problem with your support. Now it's working perfectly.
Thank You!
Your answer
![](https://koobas.hobune.stream/wayback/20220612175125im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make the camera render RenderTexture if the camera is in another scene? 1 Answer
Render Texture vs 3D model in screen space - camera 1 Answer
How do I get the width and height of text then apply it to a UI panel? 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers