public Texture2D TakeSnapshot(GameObject obj) { m_objectToTextureCamera.defaultScale = m_scale; m_objectToTextureCamera.gameObject.SetActive(true); Texture2D texture = m_objectToTextureCamera.TakeObjectSnapshot(obj, m_fallbackPrefab); m_objectToTextureCamera.gameObject.SetActive(false); return(texture); }
private byte[] TakeSnapshot(GameObject obj) { m_objectToTextureCamera.defaultScale = m_scale; m_objectToTextureCamera.gameObject.SetActive(true); Texture2D texture = m_objectToTextureCamera.TakeObjectSnapshot(obj, m_fallbackPrefab); m_objectToTextureCamera.gameObject.SetActive(false); byte[] result = texture.EncodeToPNG(); Destroy(texture); return(result); }