hii… i am new in unity and making a racing game…
i want to take a screen shot at a time of game over and display it.
my image is loaded perfetly but of different color…
here is my code…
// code for screenShot //
using UnityEngine;
using System.Collections;
public class ScreenShot : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Application.CaptureScreenshot (Application.streamingAssetsPath + "/ScreenShot.jpg");
takeShot = false;
}
}
// code for load and display image//
using UnityEngine;
using System.Collections;
public class GameOver_Script : MonoBehaviour {
public GUISkin skin;
public GUIStyle style;
bool display_screenShot = false;
WWW www;
Texture2D tex_screenShot;
// Use this for initialization
IEnumerator Start () {
www = new WWW ("file://D:/New folder/Reverse Gear/Assets/StreamingAssets/ScreenShot.jpg");
yield return www;
tex_screenShot = new Texture2D (1024, 512, TextureFormat.DXT1, false);
www.LoadImageIntoTexture (tex_screenShot);
display_screenShot = true;
}
// Update is called once per frame
void Update () {
}
void OnGUI(){
// GUI.Label (new Rect (10, 10, 300, 200),"High Score : "+PlayerPrefs.GetInt("Score"),style);
if (display_screenShot)
{
GUI.DrawTexture (new Rect (250, 100, Screen.width / 1.5f, Screen.height / 1.5f), tex_screenShot);
}
}
}
please help…