I'm creating a Unity app for Mac and Windows.
When I build it as standalone and open the app/exe file it gives a screen to select the resolution and some other options.
Is it possible to make it auto detect the current computer's resolution(by writing a script for that) and auto open the window when we double click the exe or app file and open with that resolution correctly without showing that screen to select resolution.
If it's possible please let me know how I can do that.
Thanks
Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);
This sets it to fullscreen and detects your current desktop resolution.
To go back to windowed mode use
Screen.SetResolution (1024, 768, false); //enter res
The problem most people have is resizing the GUI, which is beyond my range of knowledge in Unity3D. Hope that helps you a little.
Related
I am making a custom Unity Editor GUI window and I just want it to stay and the exact center of the screen. Surprisingly, this is harder than I thought it would be on Macs.
This is my code:
....
windowRect.center = new Rect(0, 0, Screen.currentResolution.width, Screen.currentResolution.height).center;
....
The problem is, on a 5K iMac, which has a native resolution of 5120*2880, by default the macOS uses HiDPI to scale everything to 2560*1440. In Unity, Screen.currentResolution returns 5120*2880 without considering HiDPI scaling, but I need that sweet scaled resolution.
I've tried other functions as well. Display.main.systemWidth returns 1920 instead of 5120 or 2560.
Is there a way to do this? Or am I just out of luck? I am using Unity 2018.1.9f1.
Also, if there is a way to get the size of the whole Unity Editor Window(not the game window), I would be fine with it. Thanks in advance!
In Editor, Screen.currentResolution show the resolution of game window. You can enable Maximize On Play to use the maximized window resolution.
And if you deploy to MacOS app, it should be the 5K resolution correctly.
This in an old thread, but in case someone is still wondering, I found out that the highest resolution returned by Screen.resolutions on a retina device is the « magic » resolution. It’s the one that you see in the device settings as « Looks like X x Y ».
This is not mentioned in the doc as far as I could see, so I am not certain in can be relied upon in the long run, but it’s the case currently with Unity 2018.3.
Not quite the same as centre of the screen, but I was having a similar issue and solved it using:
EditorGUIUtility.GetMainWindowPosition().center;
How to do screen record in unity?
I want to record my screen(gameplay) during my running game.
That should be play/stop , replay , save that recording on locally from device, open/load from my device (which is already we recorded).
In my game one camera which can capture native camera, and one 3d model.
I wish to record that both and use my functionality whenever i want.
Thank you in advance.
This is hard to implement, but not impossible. Because every frame or interval you need to capture screen shot of your camera view and store it in the list. You need good, (Smaller interval but not much. Because when it becomes smaller, needs more memory) interval value. If your interval is big raplay can be seen laggy.
While you play game your ram becomes full and os will terminate the app. So you need to fully cover memory optimization. Another solution is assets in Unity Asset store.
EZ Replay Manager can be used. (Keep in mind: I haven't tried it yet.)
Free
Pro
Check out this open-source project: https://github.com/getsocial-im/getsocial-capture.
By default our project records Main Camera's rendered content. C# examples are in the repo.
You can record in 2 modes:
Continuous mode - capture last X frames.
Manual mode - capture frames on your own when needed. For example, record a timelapse of the level.
Once the recording is done, you can generate GIF, get raw bytes and do whatever you want. E.g. let your users share that GIF with friends.
Here's the recording of a game session from the test app. The recorded GIF shows up in the end:
Disclaimer: I worked at GetSocial at the time of writing.
well i know a guy who post a similar project on github. link :- https://github.com/thanh-nguyen-kim/Unity_Android_Screen_Recorder
but there is a limitation and that is this code is only works on android devices(android means only android not even on ios).
but this is very powerful recorder and it is capture whatever appear on screen(so basically it is a screen recorder made with unity) and also it will capture your microphone output.give it a try.
and if you find any other solution then please also tell me. because it will very helpful for me.because i want to record video with in-game audio and also save it into gallery
Unity now has a screen recording tool builtin. It's called Recorder and doesn't require any coding.
In Unity, go to the Window menu, then click on Package Manager
By default, Packages might be set to "In Project". Select "Unity
Registry" instead
Type "Recorder" in the search box
Select the Recorder and click Install in the lower right corner of the window
That's about all you need to get everything set up and hopefully the
options make sense. The main thing to be aware of that setting
"Recording Mode" to "Single" will take a single screenshot (with
F10)
NOTE: This is a copy of my answer from a Unity screenshots question
unfortunately i have some problems with my new notebook and javafx development.
Whenever i use a webview to display content in my program i'm getting really small and nearly unreadable fonts - now i'm not sure what exactly the problem is:
Is it the new Win8.1 environment which is extremly bad for javaFX (+webView) development, or
Is it the new notebook with 1920x1080 resolution on an 13" display which is way to much for a small screen, or
Is it only a matter of configuration and i've overseen some basics :-)
i would really appreciate every possible suggestion
thanks :)
p.s.: I'm using JDK7 and NetBean 7.4 - i also tried JDK8 but that didn't change anything?!
Apply the WebView fontScaleProperty to scale the text displayed in the WebView.
If you think it's an issue (e.g. the fontScaleProperty should default to some better value for your particular configuration), you might want to also take a screenshot (maybe even a digital photo of the laptop screen), and log an issue in the JavaFX issue tracker.
Using dwmapi.dll it is possible to "project" a real-time image of a desktop window onto another windows hwnd (DwmRegisterThumbnail) as used by the activity bar previews of running apps in Windows.
Now I want to project this image onto a texture in Unity3D instead. I haven't really tried yet but I'm guessing it actually could be impossible. Perhaps I can project it planarly directly onto a running Unity3D-app but that's only close. I need it to be as a surface in full 3d.
Have anyone tried this? Please outline how it could be done if you think it is possible.
I need to capture image from Windows Mobile PDA after specified interval..
Kindly tell me any code... I tried so many forums but didn't found any working solution:s
It's not a tested solution, but I believe this should do the trick.
In your main program
Create a timer thread.
Launch a camera capture dialog.
Use the FindWindow to find the window handle to the camera capture dialog.
Fake the needed keypress to save the image with PostKeybdMessage(typical will be left soft menu to take picture, then left soft menu to dismiss camera dialog).
Retrieve filename from the camera capture dialog.
I'll advice you to use Windows Mobile Professional to avoid problems with security.