![]() RenderTexture.ReleaseTemporary(objectImageCamera.targetTexture) Īnd that’s about it. This code saves the active render texture, makes our render texture active, creates a new Texture2D instance, then copies the pixels from the render texture to the Texture2D.įinally, we call Texture2D.Apply to actually perforom the pixel copy.Īll that’s left now is to clean up after ourselves by restoring the previously active render texture, releasing the temporary render texture we acquired earlier, and destroying the cloned game object. Texture.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0) Texture2D texture = new Texture2D(width, height) RenderTexture.active = camera.targetTexture įloat width = įloat height = RenderTexture saveActive = RenderTexture.active Now we need to get that object into a texture. So at this point we should have our object rendered to the render texture.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |