Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 11th, 2012  |  syntax: None  |  size: 1.39 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. // TODO: Needs own Camera and GUILayer to ensure the GUI is on screen!
  5. // TODO: Camera depth - must be set, and non-griefable by user. (auto set to highest depth)
  6. // TODO: Probably need a GUILayer to use with GUITextures and Camera
  7. // TODO: Need to place the ad image at bottom of screen, using percentage of screen real estate
  8. // TODO: Just print something upon user clicking icon
  9. // TODO: @velvetycouch the GO needs to be created with instantiate too otherwise it has no transform/position etc
  10.  
  11. public class ShowGUI : MonoBehaviour {
  12.         // For maximum control, the Tap For Tap plugin creates it's own new GameObject
  13.         GameObject go;
  14.         Texture2D texture;
  15.         GUITexture gnarGames;
  16.         Camera camera;
  17.         // Use this for initialization
  18.         void Start () {
  19.                 // Sets up a GUI
  20.                 go = new GameObject();
  21.                 texture = (Texture2D)Resources.Load("gnargames");//"Tap For Tap/Images/gnargames");
  22.                 gnarGames = new GUITexture();
  23.                 camera = new Camera();
  24.                 camera.depth = Camera.main.depth + 1;
  25.                 if( camera.depth == null )
  26.                         Debug.Log("scrimshaw");
  27.                
  28.                 go.transform.position = Vector3.zero;
  29.                 go.gameObject.AddComponent(guiTexture.GetType());
  30.                 //go.gameObject.AddComponent(camera.GetType());
  31.                 go.guiTexture.texture = texture;
  32.                 go.gameObject.guiTexture.pixelInset = new Rect(-64, -32, 128, 64);
  33.         }
  34.        
  35.         // Update is called once per frame
  36.         void Update () {
  37.         }
  38.        
  39.        
  40. }