I am trying to make a custom Startup window Or Before start Window for unity3d Standalone.
I do not know how to start Working on It i have Researched but got noting that can point me on the direction or a Kick start.
Is it even Possible to Do it As i have seen option in Player Settings--> Display Resolution Dialog-->Hidden By default But how dose it work and how i can set up my own window
If you have the Personal edition, you can't do a true customized start screen, as per their licenses page: https://unity3d.com/get-unity. You also cannot turn off the default Unity startup screen without using the Professional edition.
The Player Settings -> Display Resolution Dialog -> Hidden by Default options is to enable/disable a screen allowing the player to set the resolution before game start. Allowing the player to do this can have some undesired effects, depending on how you've set up your game's resolution. On this resolution screen, you can set a splash image by scrolling down the Player Settings inspector a bit.
To make a pseudo-startup screen that occurs after the actual Unity startup is not actually difficult. Take the image you want for your startup window, put it on a quad. Set your camera so that the quad fills the whole camera space. Add some light and you're done. You can add effects or animation as well. There are a number of other ways but this is probably the easiest.
Edit: I only have the Personal edition myself so I can't confirm any of the stuff in the following link works firsthand, but I expect you will find it and/or the links it contains to be very helpful in your efforts (the links referenced in it give quite a few worthwhile looking suggestions to accomplish it that I am unable to test):
https://gamedev.stackexchange.com/questions/72087/can-i-legally-remove-the-default-unity-splash-screen-by-removing-it-from-the-apk
Related
I've been working with GoogleVR on Unity for quite a while now and the application I'm developing actually needs to be able to have a higher field of view than the one offered by Google Cardboard, since I'm trying to see my hands through the app and I need to really stretch my arm if I want that. I tried setting it manually by code and couldn't find a way to do it. I also tried increasing the resolution of the camera but also couldn't. I also tried setting a fixed DPI on the Resolution Scaling Mode on Unity, but then the GoogleVR framework broke and didn't work when I did that. I have also tried setting a custom cardboard profile and tested with a lot of different ones, but none of those increased the fiel of view significantly.
Does anyone has any idea on how to solve this?
Thanks!
You don't want to change "mockFieldOfView". That only affects the
in-editor FOV. The value you want to change is "matchMonoFOV" on the
StereoController. You also have to set a "CenterOfInterest" game
object on the StereoController. It makes the stereo FOV attempt to
match the FOV on the Main Camera (or whichever camera has the
StereoController script).
I think this is what you are searching for:
Unable to change FOV of the google card board camera
The game looks fine inside the Unity screen view, but if I build and choose a different resolution screen size the game looks goofy and dis-proportioned. Especially when I go into full screen mode. I'm using Unity 2019.1.1a (I think it's still in beta?). I'm developing a top down 2D game for Windows PC.
How can I fix it to where the game will look the same on any screen size?
Unity has some good tutorials on this topic:
https://unity3d.com/es/learn/tutorials/topics/user-interface-ui/ui-tools-resolution-device-independence
https://docs.unity3d.com/Manual/HOWTO-UIMultiResolution.html
I've never encountered an issue like this before and everything I've tried to fix it has achieved nothing.
We have an app that uses Unity's built in Google Cardboard support that we have available on Android and iOS. The issue has never appeared on Android before, and also doesn't appear in a different project we have created using the same version of Unity (2018.1.1).
It appears the somehow when configuring the separate viewports for each eye it seems to get confused. The aspect ratio has been squished vertically and is stretching the displayed image. On top of this, the left and right eye appear to be facing in a cross eyed manor, where they should be facing more-or-less in the same direction. Here is an image representing the issue, with a line drawn around the current display area for each eye:
iOS cardboard display
This picture is of an iPhone 6, however this has been replicated on multiple devices including iPhone 8, iPhone X, and a few others that I cannot recall. Like I mentioned previously this has never happened on Android and also does not appear on iOS in a similarly setup project.
I have a suspicion that it has something to do with the way my Unity scenes are setup so I'll give a brief description of how things work at the moment.
Scene 1 - Menu scene
This is an entirely UI based scene (like most menus) and is setup in Portrait. It has a main camera that remains in standard mode (non-VR).
Scene 2 - Experience scene
This scene switches into Landscape view using code Screen.orientation = ScreenOrientation.Landscape. It has one camera in the scene that is initially in standard mode (non-VR) but can be toggled into VR using a button with this code:
public void SetStereoViewState(bool isActive) {
XRSettings.enabled = isActive;
#if !UNITY_EDITOR
// if device is a tablet (> 7" screen) always disable cardboard switch
// otherwise display only when cardboard mode is inactive
overlayCanvas.gameObject.SetActive(ScreenUtils.IsTabletDevice ? false : !isActive);
// needed to fix the aspect ratio when switching back to mono mode
vrCamera.ResetAspect();
#endif
Debug.Log("XRManager::SetStereoViewState | Enabling VR: " + isActive);
}
In a previous version of this app (running Unity 2017.2.0p2) this was never an issue, and is not an issue in a separate project also created in 2018.1.1.
What I've Tried So Far
camera.ResetAspect() - This was here to fix aspect issues when switching for VR to non-VR. I have enabled and disabled this when switching for every which way VR -> non-VR, non-VR -> VR etc. I have also delayed this until the next frame but without any change to the results
Enabling 'Cardboard' mode in the Landscape scene - The way I have always set my scene up in the past is to XRSettings.LoadDeviceByName({device_name}) at launch, in this case XRSettings.LoadDeviceByName("cardboard") but not enabling it with XRDevice.enabled = true until it is actually needed. | VR XRDevice.enabled = true - Non-VR XRDevice.enabled = false
Camera Setup
I don't think it's relevant since VR works perfectly fine on Android, but here is my somewhat default camera is setup:
Unity camera setup
I have considered setting up multiple cameras (left and right eye) but I can't see how this would make a difference as the aspect ratio is one of the issues.
If anyone has experienced a similar issue and has a fix, or has any advice in how to approach the situation in a different way that would be awesome.
NOTE:
Currently we are using Unity 2018.1.1 but I have also tried up to the most recent (at the time) 2018.1.5. A downgrade to 2017.x.x is not really possibly due to HttpWebRequests and Apple's somewhat frustrating IPv6 requirements which are broken until Unity 2018.x.x
FIXED
The issue is when loading 'cardboard' mode while in Portrait. Here is the code that I run at app launch to solve the issue:
private IEnumerator SetupCardboard() {
Screen.orientation = ScreenOrientation.Landscape;
XRSettings.LoadDeviceByName("cardboard");
yield return null;
Screen.orientation = ScreenOrientation.Portrait;
}
So in this maze kind of game I'm making, I will show the maze to the player for 30 seconds.
What I don't want is that the player taking screenshot of the maze.
I want to do something like Snapchat, or Instagram, how it detects when you take a screenshot of a snap/story.
I'm using C#. It can also prevent user to take screenshot. I don't mind.
Is there a possible way to detect when the user takes screenshots or prevent it in Unity?
No, you can't detect this reliably. They also could make a photo with a digi cam. Furthermore there are endless ways to create a screenshot and the os has no "callback" to inform an application about that. You could try to detect the "print screen" key but as I said there are other screenshot / screen recording tools which could use any hotkey or no hotkey at all. I have never used Snapchat but it seems it's not safe either.
There are even monitors and video projectors which have a freeze mode to keep the current image. You could also run your browser in a virtual machine. There you can actually freeze the whole virtual PC or take screen shots from the virtual screen and an application running inside the VM has no way to even detect or prevent that.
I once had to do something similar. If you just want to do what snapchat did then it can be done but remember that as long as the app is running on anyone's device instead of your server, it can be de-compiled, modified and compiled again so this screenshot detection can be circumvented.
First of all you need to know this about Apple's rule:
2.5.9 Apps that alter or disable the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, or other native
user interface elements or behaviors will be rejected.
So, the idea of altering what happens when you take a screenshot is eliminated.
What you do is start the game, do the following when you are showing the show the maze to the player for 30 seconds:
On iOS:
Continuously check if the player presses the power and the home button at the-same time. If this happens, restart the game and show the maze to the player for 30 seconds again. Do it over and over again until player stops doing it. You can even disconnect or ban the player if you detect power + the home button press.
On Android:
Continuously check if the player presses the the power and volume down buttons at the-same time. Perform the-same action described above.
You cannot just do this with C#. You have to use make plugins for both iOS and Android devices. The plugin should use Java to the the detection on android and Object-C to do the detection for iOS. This is because the API required is not available in C#. You can then call the Java and Objective-C functions from C#.
Other improvement to make:
Check or external display devices and disable them when you are
showing the maze to the player for 30 seconds. Enable them back
during this time.
When you detect the screenshot button press as described above,
immediate take your own screenshot too. Loop through images on the player's picture gallery and load all the images taken that day.
Compare it with the screenshot you just took and see if they match.
If they do, you are now very sure that the player is trying to cheat.
Take action like banning the player, restarting the game or even
trolling the player by sending their screenshot to the other player. You can also use it as a proof to show that the user is cheating when they complain after being banned.
Finally, you can even go deeper by using OpenCV. When you are
showing the player the maze for 30 seconds, start the front camera of
the device and use OpenCV to continuously check if any object other
than the player's head is in front of the camera. If so, then the
player is trying to take a screenshot with another device. Take
action immediately. You can use machine language to train this.
How far to go depends on how much time you want to spend and how much you care about player's cheating online. The only thing to worry about is players de-compiling the game and removing those features but it is worth implementing.
My Android phone takes screenshots differently. I swipe down from the
top of the screen and select the "Capture" option.
Nothing is always the-same on Android. This is different on some older or different Android devices. You can detect swipe patterns on the screen. The best way to do this is to build a profile that handles each Android device from different manufactures.
For those commenting, this is possible to do. You must do it especially if it is a multiplayer game. Just because a game can be hacked does not mean that a programmer should not implement basic hack prevention mechanism. Basic hack prevention mechanism should be implemented then improved as you get feedback from players.
How do I locate the coordinates and size of a DirectX game?
My current code uses window sizes (user32.dll, GetWindowRect), which includes window chrome, but I want it to work accurately even if chrome is customized or if there is no chrome (e.g. fullscreen).
As an example, Fraps can create an overlay of the FPS of a game in a particular corner. If I wanted to do that, how do I find that window viewport?
Thanks in advance for your insight.
There is a GetDisplayMode function.