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
3
Question by ren · Feb 21, 2011 at 09:45 PM · screenmodefull

Full Screen Mode

how do you switch out of full screen and to full screen fast? Like keyboard shortcut?

Comment
Add comment · Show 1
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 Bunny83 · Feb 23, 2011 at 09:39 PM 0
Share

Next time go a little bit more in detail... and yes, a question can be longer than a single line ( much longer ).
http://answers.unity3d.com/faq

6 Replies

· Add your reply
  • Sort: 
avatar image
8
Best Answer

Answer by Bunny83 · Feb 22, 2011 at 02:01 AM

What you want is something like:
Edit
Since you didn't tell us what language you want to use, here's the Javascript version of the full script:

function Update()
{
    if (Input.GetKeyDown(KeyCode.F))
        Screen.fullScreen = !Screen.fullScreen;
}

And here's the C# version (in c# the file must have the same name as the class: "ToggleFullscreen"):

using UnityEngine; using System.Collections;

public class ToggleFullscreen : MonoBehaviour { void Update() { if (Input.GetKeyDown(KeyCode.F)) Screen.fullScreen = !Screen.fullScreen; } }

Scripts have to be attached to a GameObject in your game. For this script it doesn't matter on which object. Just drag it from your project view onto the gameobject you like (eg. MainCamera).

Comment
Add comment · Show 3 · 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 ren · Feb 23, 2011 at 06:17 PM 0
Share

okay, but where do I put it in? where's the folder with the text file?

avatar image Bunny83 · Feb 23, 2011 at 09:37 PM 0
Share

What do you mean? Don't you know how to create a script file and how to use it on a GameObject? I will edit my answer to show you how a full script would look like.

avatar image ren · Apr 20, 2011 at 05:17 PM 0
Share

Bunny83, I didn't understand how to do this: create a script file and how to use it on a GameObject?

Sorry, I posted this comment as an answer.

avatar image
3

Answer by GLeBaTi · Aug 13, 2015 at 01:43 PM

 public class FullScreen : MonoBehaviour {
     private int defWidth;
     private int defHeight;
     public void Awake()
     {
         defWidth = Screen.width; 
         defHeight = Screen.height; 
         if(!Application.isWebPlayer)
         {
             Destroy(this);
         }
     }
     public void ChangeFullScreen()
     {
         if (!Screen.fullScreen)
         {
             Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
         }
         else
         {
             Screen.SetResolution(defWidth, defHeight, false);
         }
     }
 }
Comment
Add comment · Show 1 · 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 Pawciu · Jul 15, 2018 at 09:48 AM 0
Share

This is the best answer because Screen.fullScreen = !Screen.fullScreen; doesn't restore windowed mode

avatar image
0

Answer by ren · Feb 21, 2011 at 09:50 PM

Joshua, thanks for that solution, but I meant you can pretty much switch to fullscreen by right clicking then clicking full screen.

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 Bunny83 · Feb 22, 2011 at 01:54 AM 1
Share

Don't use answers as comments!! Use comments! http://answers.unity3d.com/faq

avatar image evgeniy_trifonov · Jul 10, 2014 at 03:49 PM 0
Share

No, this was useful comment. I searched for question «How switch to full screen in Unity3D?» and operatively found answer by request «unity3d full screen» in Google on second position in search already. Very thanks for this comment! alt text

P.S.: but yes, maybe that little bit uncomfortably, but maybe that imperfection of system answers too? Don't know. And somebody know there are keyboard shorcuts for toggle player to full screen? Re$$anonymous$$d: that ask in first question.

avatar image
-1

Answer by ren · Apr 20, 2011 at 05:16 PM

Bunny83, I didn't understand how to do this: create a script file and how to use it on a GameObject?

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
avatar image
0

Answer by Joshua · Feb 21, 2011 at 09:47 PM

Well, by default the button to go out of fullscreen is esc. And what do you mean, make unity fullscreen, make your scene fullscreen, make 'an' unitygame fullscreen?

Comment
Add comment · Show 1 · 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 Bunny83 · Feb 22, 2011 at 01:58 AM 0
Share

Well, esc works only in the webplayer "automatically", but only for security reasons. You will also unlock the mouse if it was locked.

  • 1
  • 2
  • ›

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

There is nothing in the GAME mode and nothing shows when the game is installed. 2 Answers

Playing movie without plane 1 Answer

Full screen coordinates 1 Answer

Make my HUD full screen 2 Answers

How do I make my game fullscreen 3 Answers


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