unity3d take screenshot of a particular gameobject

Hi all…

SO far i am able to take a screenshot of the game…but i want to take the screenshot of the player alone with other AI around it…like 150 x 150

I cannot use render texture because this is going to be released under unity3d basic licence…

Pls help on how to target the players position while taking the screen shot

thanks all for the time

aCat Game Dev

bump…guys need some help

The only solution I see is to take a screenshot of the whole view, load the image file, edit/crop it the way you like, then save it back on disk.

to take a simple picture, you can first set your player and AI guys on a layer, and set culling mask property of the camera to those/that layer only. then take a screenshot, load it from the path you saved it to via Texture2D and WWW, then resize and re-save and/or use in-game, like alexz said.

hi guys…thanks for the reply…

I got it to work myself…i was able to tweak the parameter in the basic screen shot script in unifycommunity and was able to finish after like a hour or two after posting this…

I’ll post the sample here…so we can have more people posting in game screen shots…

thank you all

var grab: boolean; // The “display” is the object whose texture will be set // to the captured image.
var display: Renderer;
var ray111: Ray ;
function OnPostRender() {
if (grab !captureOnce) {
// Make a new texture of the right size and
// read the camera image into it.
var tex = new Texture2D(150, 150, TextureFormat.ARGB32, false);

var screenPos : Vector3 = camera.WorldToScreenPoint (player.transform.position);

tex.ReadPixels(new Rect(screenPos.x- 80,screenPos.y-80, Screen.height, Screen.width), 0, 0);
tex.Apply();

// Set the display texture to the newly captured image.
customMats.gameObject.renderer.material.mainTexture = tex;
// customMats.gameObject.active = true;
// Reset the grab variable to avoid making multiple
// captures.

captureOnce = true;
grab = false;
}
}