I want there to be a 2D texture in space, not applied to any gameobject. I want to be able to reference this texture in another script that isn’t applied to the texture itself. Here is what I have so far.
#pragma strict
private var OutsideB: Transform;
private var OriginalspotB : Transform;
private var moved = false;
static var main : Camera;
private var CameraBlack : Transform;
private var CameraStart : Transform;
var aTexture : Texture;
private var stringToEdit : String = "This is Black";
function Start () {
OriginalspotB = transform.Find("/Black-start");
OutsideB = transform.Find("/Black");
CameraBlack = transform.Find("/CameraBlack");
CameraStart = transform.Find("/MainCameraStart");
}
function OnGUI () {
GUILayout.BeginHorizontal();
GUILayout.Space(20);
if(GUI.Button(Rect(0,0,150,50), "Examine Black")){
aTexture.gameObject.active = false;
if(moved){
moved = false;
}
else
{
moved = true;
}
}
GUILayout.EndHorizontal();
if(moved){
transform.position = OutsideB.position;
stringToEdit = GUI.TextArea (Rect (150, 175, 150, 50), stringToEdit, 20);
Camera.main.transform.position = CameraBlack.position;
aTexture.gameObject.active = true;
}
else{
transform.position = OriginalspotB.position;
Camera.main.transform.position = CameraStart.position;
aTexture.gameObject.active = false;
}
}
I want the texture to toggle off with the button. With this current script I’m getting this error " Assets/Black.js(22,18): BCE0019: ‘gameObject’ is not a member of ‘UnityEngine.Texture’. " Any help?