Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jkaris

Pages: [1]
1
NGUI 3 Support / Re: NGUI Camera targetTexture to GUI.DrawTexture
« on: November 07, 2012, 05:45:48 PM »
Hi ArenMook,

I have attempted the following:

I have a game object in the Hierarchy named "NGUIObject" - I have attached a component UITexture to it.

I have created a UI Root (2D) and it simply contains 1 single label.

I have attached the following script to "NGUIObject"

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CameraToTexture : MonoBehaviour {
  5.        
  6.         public Camera NGUICamera;
  7.        
  8.         RenderTexture rt;
  9.         UITexture uiTexture;
  10.        
  11.         void Start () {
  12.                
  13.                 uiTexture = gameObject.GetComponent<UITexture>();
  14.                
  15.                 rt = new RenderTexture (Screen.width, Screen.height, 24);
  16.                 NGUICamera.targetTexture = rt;
  17.                
  18.                 uiTexture.mainTexture = rt;
  19.         }
  20. }
  21.  

When I run it, I can see in the Inspector for "NGUIObject" that the texture is being assigned to the Texture in UITexture - but I am seeing nothing on the screen.

Am I missing a step somewhere?

Thanks again,
J.

2
NGUI 3 Support / Re: NGUI Camera targetTexture to GUI.DrawTexture
« on: November 07, 2012, 05:54:47 AM »
Hi ArenMook,

Thanks for the speedy response - I've only had NGUI for a couple days and I'm not exactly sure how to do what you said.  Could you please explain a bit further how to achieve this?  Sorry for the noob-ness...

J.

3
NGUI 3 Support / NGUI Camera targetTexture to GUI.DrawTexture
« on: November 07, 2012, 12:54:05 AM »
Hi,

I'm attempting to draw the view of the camera to the GUI and I can't get it working.

This is basically what I have tried:

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class s_guiCam : MonoBehaviour
  5. {
  6.         RenderTexture rt;
  7.         public Camera guiCamera;
  8.        
  9.         void Start ()
  10.         {
  11.                 rt = new RenderTexture (Screen.width, Screen.height, 24);              
  12.                 guiCamera.targetTexture = rt;
  13.         }
  14.        
  15.         void OnGUI ()
  16.         {
  17.                 GUI.depth = -5001;
  18.                 GUI.DrawTexture (new Rect (40, 0f, (float)Screen.width, (float)Screen.height), rt);
  19.         }
  20. }
  21.  


Can someone let me know if this is even possible or what I'm missing.

Much thanks,
JK.

Pages: [1]