Hello, I'm a 3D artist and I'm new to Unity, I discovered a lot of very cool fonction using Unity, it's very cool! I'm learning script and I have some problems in scripting some fonction. I'd like to learn how assign to switch component of an object by clicking custom GUITexture? In fact, I made two HUD buttons and I'd like to make them assign an object to a public value to antother. May be I'm not clear about what I'm searching for... May be someone has some cool tuts to share? Many thanks! (sorry for my poor english) ++
I'm not sure if this is what you meant but did you want to toggle a skybox? if you did then you could do something like this: (c Sharp) Code (CSharp): using UnityEngine; using System.Collections; public class Skybox_Toggle : MonoBehaviour { public Skybox skybox1; public Skybox skybox2; void OnGUI () { if(GUI.Button(new Rect(0, 0, 300, 140), "Toggle Skybox")) { if(RenderSettings.skybox == skybox1) { RenderSettings.skybox = skybox2.material; } else { RenderSettings.skybox = skybox1.material; } } } }
(JS) Code (CSharp): #pragma strict var skybox1 : Skybox; var skybox2 : Skybox; function OnGUI () { if(GUI.Button(Rect(0, 0, 150, 40), "Toggle Skybox")) { if(RenderSettings.skybox == skybox1) { RenderSettings.skybox = skybox2.material; } else { RenderSettings.skybox = skybox1.material; } } }