Hey folks, you’ve all been so helpful and I’m very close to finally completing a big assignment. Just one more obstacle.
I’m using Vectrosity to have a user draw an input in the game. I’m then using the script below to apply the user’s drawing as a texture to a plane. The user-generated drawing is successfully being applied to the plane as a texture, but I want to take that texture and bring it into another scene.
To clarify, a user is exploring an area with a first-person controller, then collides with an object that takes the user into another scene. This other scene is where the user drawing is done and applied to a plane within this other scene. I want to take that texture back into the main scene where the user began. Any help would be much appreciated!
This is the code I’m currently using to take a screenshot and apply as a texture:
//C#
using UnityEngine;
using System.Collections;
public class TexturePixels : MonoBehaviour {
void Start () {
}
void Update ()
{
if (Input.GetKeyDown("c"))
{
Texture2D tex = new Texture2D(Screen.width,Screen.height,TextureFormat.RGB24,false);
tex.ReadPixels(new Rect(0,0,Screen.width,Screen.height),0,0,false);
tex.Apply();
if (renderer != null)
renderer.sharedMaterial.mainTexture = tex;
}
}
}