スクリーンショット// 公共ボイドCaptureScreen2(カメラC、R&LTのRect) { //キャプチャカメラ画像は、文字列に変換され、 RenderTexture RenderTexture新しい新しいRT =((INT)r.width、(INT)r.height、0); // targetTexture目標テクスチャ c.targetTexture = RT; //は、マニュアルカメラのレンダリングレンダリング c.Renderを(); アクティブレンダリングテクスチャで//現在アクティブ RenderTexture.active = RT; にTexture2Dスクリーンショットの新しい新にTexture2D =((INT)r.width、(int型偽の)r.height、TextureFormat.RGB24、); //読み出した画素 screenShot.ReadPixels(R&LT、0、0); screenShot.Apply(); //ターゲットテクスチャカメラレンダリング c.targetTexture =ヌル; RenderTexture.active = NULL; GameObject.Destroy(RT)。 //将此纹理编码为PNG格式 バイト[]バイト= screenShot.EncodeToPNG()。 文字列filename = @ "D:\フォトwhzq Screenshot.png \"。 System.IO.File.WriteAllBytes(ファイル名、バイト)。 PlayerPrefs.SetString(画像ファイル、ファイル名); }