UnityVR - Having the both renders display the exact same image for each eye - unity3d

When Unity builds a VR project, by default it is set to make the two views stereoscopic. It slightly offsets the camera position of one eye to give the user a sense of depth.
For example a square will appear slightly to the left on the right view compared to the left view.
I want to make the camera truly monoscopic by removing the offset that is created when i build the project. Each camera should render all objects in exactly the same position for both eyes.
One of things i tried was creating two camera and setting them to the left and right eye. Then i manually set the position/rotation of one camera until it looked monoscopic
It worked fine on my pixel phone, but as soon as i put the project on my test phone i noticed that the difference in resolutions messed up the view i was going for. The blocks were not in the same position when i looked at both renders.
If anyone has any solutions or ideas as to how i can go about this, i would greatly appreciate it.
Thank you!

You can still use 2 cameras, but instead of offsetting them, you can just make the width of the camera half.
Make 2 cameras, set their positions to exactly the same.
On the left eye camera, set the width to 0.5 and the x position to 0.
On the right eye camera, set the width to 0.5 and the x position to 0.5.
You should now have 2 cameras rendering the exact same thing, but twice across the screen, with no sense of depth.

Related

Unity UI screen size issue

I'm quite new to Unity, so I'm sorry if this is a basic question. I've been trying to set up the UI for a mobile game, but I'm not quite sure how to make the UI lock it's position, no matter the screen size. I've tried using anchors (though I don't fully understand how to use them properly), I've tried using a canvas scaler, I've looked at the Unity document and I just can't seem to find an answer. The buttons are off screen/half off the screen when I build the game to my device/switch screen sizes in the game view. Does anyone know how to fix this?
You can set your anchor point by selecting the UI object (such as a button) and then clicking here and selecting the right anchor point. You can also press down shift to set the pivot and/or alt to move the object to that point at the same time. The object should now be anchored to that point and keep its position even if the resolution is changed. You can set a precise position from the inspector, too. Simply adjust the Pos X and Pos Y variables. It will still adhere to the anchor point.
Note that you might have to play around with the Canvas object's UI Scale mode and its settings to get the right setup.

How to animate UI position for different aspect ratio screens?

I know how to make a moving animation of an UI object, but how to make it supporting different aspect ratio screens?
For example, I have an UI object_1 in the left-lower corner and object_2 in the right-upper corner, both adjusted its position relative to the screen's corners. I want to make an UI image moving from object_1 to object_2.
The problem is that object_1 and object_2 are at different positions (even different ratio according to screen ratio) in different resolutions. Then how can I make the moving animation supporting different resolutions?
Thanks for any advice!
Screenshots:
1 Moving starting point where the left-lower checkbox is on 18:9 screen.
2 Moving ending point where the left-lower checkbox is on 18:9 screen.
3 Moving starting point, changed to 16:9 screen, and the screenshot shows that the position of the finger image does not match where the checkbox is.
4 Moving ending point on 16:9 screen, same problem with the above one.
OK, problem solved. It turns out the animation supports changing anchors at certain frames. So just turn on recording and adjust whatever you like.
In my project, first frame I set the finger image's anchor to the middle-lower point then record its position; when starts the moving animation, changes its anchor to middle-upper point then set the destination position. If the screen aspect ratio changes, since the animation also uses the right anchor data with the two check boxes, they'll match perfectly.
FYI, here's a screenshot of the animation window to help you understand.
This may help,
docs Unity3d site
This will support animations.

Unity: Positioning an element on canvas

I need to move an image down through canvas so that its central point would be where is now its top edge. It makes some 50 points, but if I decrease y by 50, it moves to different part of the screen on devices with different screen size. I guess, it's because my main canvas is set to scale with the screen size. So I suppose I need to manually divide the number 50 by my screen height and then code to multiply by Screen.height? Isn't there a more convenient way to move UI objects?
Allow me a second question: Do you think it is even wise to make a game purely on canvas? My game is simple 2D, only slightly animated and contains many layout elements, so I decided to go for it, but I have hard time to grasp the UI position rules.
you may have the problem of the anchoring.
Unity UI totally depends on the Anchoring, if you have got right anchoring there is no issue.
For example. if you anchored something at the Center than changing left and right value moves them according to the center anchor.
for clear visualization, you can paste a screenshot of the behavior.

Adjusting the 3D game to the screen size

How to make the 3D game adapt to the screen resolution?
I tried to change the fieldOfView of the camera, but this adjustment does not work correctly!
If you mean UI elements, there are little triangles usually in the middle of the canvas the element is under. These are anchors that will tell the element to try and stay in the same place on the canvas regardless of the screen resolution. You can read more about it here: https://docs.unity3d.com/Manual/UIBasicLayout.html https://docs.unity3d.com/Manual/HOWTO-UIMultiResolution.html
If you mean your actual game view, you'd probably need to write a script that adjusts the camera's FOV at the start of the game based on the resolution, but I have no idea where to even begin on the formula you'd use.

Sprites are disappearing when I zoom in Unity

In the scene view when I zoom in past a certain point all the sprites (apart from one) disappear and it makes it near impossible for me to edit them because they become too small to see clearly.
This only just started happening everything was fine before and I don't think I have really changed anything that could have affected their ability to show when zoomed in.
The z positions have to be same as that of the canvas I am using
Press the F key a couple of times after selecting the sprite... it's for focus or something after you see it focus ...you will be able to zoom in endlessly to edit this is for sure a bug....I tried restarting unity first..then I tried adjusting the clipping low rate on the camera that is usually 0.3 to pure 0...and that was not it... the F key always gets it done I don't know why...also I changed the cameras near clipping plane back to 0.3 because it was not the issue.