Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by orphea · Dec 06, 2010 at 01:02 AM · cameraguidisablelayerhide

Hide GUI while switchcam

Hi,

I would like to hide all my GUI (using Unity GUI) when I switch of camera (for a cutscene).

I heard I could put the GUI on a layer and apply a culling mask on my camera, but can't figure out how to put my GUI on a different Layer.

Do someone has an idea on how to do this?

Thank you Very much!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by The_r0nin · Dec 06, 2010 at 04:54 PM

private var inCutScene: boolean = false; function OnGUI(){

  if (!inCutScene){

       // Your GUI goes here

  }

}

function BeginCutScene (){

  inCutScene = true;
  // your cutscene begins here

}

function EndCutScene (){

  inCutScene = false;

}

Call BeginCutScene() when you start and EndCutScene() when you are done. No GUI...

EDIT

Or, as was suggested in the comments:

private var inCutScene: boolean = false; function OnGUI(){

  if (inCutScene) return;
  // Your GUI code here...

}

function BeginCutScene (){

  inCutScene = true;
  // your cutscene begins here

}

function EndCutScene (){

  inCutScene = false;

}

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image equalsequals · Dec 06, 2010 at 05:01 PM 1
Share

This is the correct way of doing it, since Unity GUI is immediate-mode. You could simplify this by ins$$anonymous$$d of checking if(!inCutscene){doSomething();} but ins$$anonymous$$d saying if(inCutscene) return; at the top of OnGUI(). This will do the same thing, but is actually a lot easier to throw in and pull out while still maintaining clean code.

avatar image The_r0nin · Dec 06, 2010 at 05:27 PM 0
Share

Good Point! I've edited my answer to show this option, as it makes very good sense.

avatar image
-1

Answer by oliver-jones · Dec 06, 2010 at 01:05 AM

You can deactivate the GUI on a particular camera in the Inspector. So just click on the camera in your scene that is the cut scene camera - and just deselect the GUI element.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image orphea · Dec 06, 2010 at 01:19 AM 0
Share

I desactivated the GUILayer element of my cutscene camera, but the GUI still appears. I took care of desactivating my main camera and all other cameras during the cutscene, so it can't be the problem. Anyone has another solution?

avatar image equalsequals · Dec 06, 2010 at 04:58 PM 0
Share

OnGUI will still render when the GUI Layer component of a camera is there or not. Removing/disabling it only works for GUITextures/GUIText. OnGUI is drawn after all of the Cameras are rendered in that frame, and therefore is separate from the camera.

avatar image
0

Answer by orphea · Dec 06, 2010 at 01:42 PM

anybody knows how I could do this?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

how can I disable all camera movements trough GUI? 2 Answers

Disabling/Hiding a Text Field with Enter Key 4 Answers

Render GameObjects over GUI.Layer 1 Answer

Is there a way to change the order of the "Layers" Tab? 0 Answers

GUI Buttons on a Mini-Map 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges