- Home /
How to drawing 2 image in one Texture2d
So I have screenshot of my screen (capture it using Application.CaptureScreenshot(screenshotName)
, and another one I have 1 copyright image. I want this copyright image to be drawn on top of my screenshot image. This image will be uploaded to fb or twitter. How do I do that in Unity? I have unity pro license.
What I want to do is to make an image file which consist :
Screenshot of my screen
The copyright image (which is not seen by user)
Answer by robertbu · Mar 11, 2013 at 07:10 AM
I'm puzzling to see where the problem is here. Assuming you are using GUI to draw the textures, the last texture drawn will be on top. You can import a PS or PNG with an alpha channel if you need transparency.
var tex1 : Texture;
var tex2 : Texture;
function OnGUI(){
GUI.DrawTexture(Rect(100,100,400,400), tex1);
GUI.DrawTexture(Rect(200,200,100,100), tex2);
}
tex2 will appear on top.
I am sorry, seems my explanation is not clear enough. What I want to do is to make an image file which consist : 1. Screenshot of my screen 2. The copyright image (which is not seen by user)
RenderTexture is limited to only 2power-n resolution, which isn't satisfied my problem. The screen size will be not limited to those size
irrelevant, just use it like this
var tempRT:RenderTexture = new RenderTexture(picW,picH, 24 );
Your explanation is fine, my reading was flawed. If you don't want to use a render texture, you can combine by hand and write them out...Texture2D.GetPixels(), merge in the image, Texture2D.SetPixels(), Texture2D.Apply(), Texture2D.EncodeToPng(), write the bytes out.