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
1
Question by x4000 · Jul 06, 2010 at 04:49 PM · webplayerminimize

Is there a way to force the unity player to minimize?

Such as, for when I want to launch an external web page based on users having clicked some button, and the game should be temporarily minimized until the user wanting to come back to the application?

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

2 Replies

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

Answer by qJake · Jul 06, 2010 at 06:25 PM

Ordinarily, if you just call the default browser, it should pop up over your game, "minimizing it". Something like this should do the trick:

System.Diagnostics.Process.Start("http://google.com/");

Note that this doesn't work in the web player.

Other than that, you would have to write a C++ plugin that hooked into the actual application window so you could send a Minimize message, and I don't know if Unity exposes the Win32 application environment to plugins or not.

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 x4000 · Jul 06, 2010 at 06:40 PM 0
Share

Sure enough, in testing it does that automatically already. Problem solved!

avatar image
3

Answer by liuww · Dec 10, 2012 at 07:50 AM

I allways use this.

 import System;
 import System.Runtime.InteropServices;
 @DllImportAttribute("user32.dll")
 public  static function  ShowWindow(hwnd:IntPtr,nCmdShow:int):boolean{};
 @DllImportAttribute("user32.dll")
 public static function  GetForegroundWindow ():IntPtr{};        
 @DllImportAttribute("user32.dll")
 public static function  GetActiveWindow ():IntPtr{};  
 
 function OnGUI () {
     if(GUI.Button(Rect(100,200,100,50),"Minimize")){
         //Minimize the window
         ShowWindow(GetActiveWindow(),2);
     }
 }
Comment
Add comment · Show 4 · 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 Mr_Orange · Apr 22, 2015 at 11:19 PM 0
Share

Hi there, unfortunately the DllImport is not recognized by my $$anonymous$$onoDevelop. Can you imagine why? Thanks!

avatar image RodrigoSeVeN · Jan 10, 2017 at 05:10 PM 0
Share

2017 and it works perfectly right away. Thank you for this answer!

avatar image primitiveType · Jun 25, 2018 at 05:41 PM 0
Share

Am I correct to assume this won't work for a $$anonymous$$ac?

avatar image MaeL0000 primitiveType · Dec 06, 2018 at 02:46 PM 0
Share

Yes you are correct @$$anonymous$$tiveType

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

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Problem with webplayer and occlusion culling 0 Answers

How to remove a dotted line around the WebPlayer 4 Answers

how do you show stats in webplayer? 1 Answer

Can people access my game assets through the webplayer? 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