I would like to keep my game the same size on any screen. I don't want it to resize though. I would a player to see more of a game field. All game assets should be fixed size, instead player should see more map. How to do this in Unity 5?
Move the camera backwards, increase the orthographics size of the camera, or increase the FOV, then scale the assets up as a function of distance from the camera.
Related
I'm trying to make my game to work on every device screen, i'm using images to be able to scale my game for every screen size.. When i use a collider on my image and when the screen size changes, the collider doesn't follow the image size correctly, how do i do to make it work? My game is 2D, i tried everything to make the game to scale with all screen sizes but only setting anchors right using images worked, sprites doesn't match the screen size correctly
hierarchy
2d sprite
panel UI
in game
Fist make sure your canvas' Render Mode is not set to Screen Space - Overlay.
If it is, then switch it to Screen Space - Camera and then change its Render Camera property to point to your main camera.
You can then use the following canvas' properties to control where it appears in relation to other sprites (which appears on top of which), the same way you control any other 2D Sprite:
Sorting Layer
Order in Layer
Also worth noting that 2D Sprites with same Sorting Layer and Order in Layer will use the distance to the camera to decide which one appears on top of which, and the same is true for the canvas:
If your canvas' Render Mode is set to Screen Space - Camera, it will always be positioned in front of your camera and you need to use its Plane Distance property in order to position it correctly.
If your canvas' Render Mode is set to World Space, you can position it freely in the world in the same way you position any other sprite.
First of all the hierarchy window in unity is completely irrelevant when its about positioning.
In Unity everything is 3D, even if you switch to 2D perspective.
So in your case you still have your camera, your sprite and your canvas in a 3D Dimension.
To set your sprite in front of the canvas you only need to increase the positioning stats (seen in your "panel UI" screenshot) at least slightly closer to your camera than the canvas is.
I'm using unity 2018 and my game 2d but i use 3d (Orthographic Camera).
How to make below links coin effect?
https://youtu.be/hiRdux33UCs?t=18
I tried with above guide. I made world space canvas and create ui image object under the canvas for coin image. But my project was orthographic project and i made zoom in and zoom out features by set size of camera's orthographic size. So the world space canvasses(coin pregfabs) can getting bigger or smaller when i zoom in or out. I want the coin (world canvas > ui image) has equal size even if i resize the orthographic camera.
Is there have any good ideas?
I am trying to make everything that is rendered by my perspective "Camera A" appear 100 points higher. This is due to the fact that my App has an interface with an open space on the upper part.
My app uses face detection to simulate the face movement into an in game avatar. To do this I compute the "Model-View-Matrix" to set it into the camera's "worldToCameraMatrix".
So far this works well, but everything is rendered with the center as the origin, now i want to move this center origin a certain distance "up" so that it matches my interface.
Is there a way to tell Unity to offset the rendered camera result?
An alternative I thought about is to render into a texture, then I can just move the texture itself, but I thought there must be an easier way.
By the way, my main camera is orthographic, and i use this one to render the camera texture. In this case simply moving the rendering game object quad up does the trick.
I found a property called "pixelRect", the description says:
Where on the screen is the camera rendered in pixel coordinates.
However moving the center up seems to scale down my objects.
You can set the viewport rect/orthosize so that its offset or you can render to a render texture and render that as a overlay with a offset or diffirence in scale.
Cheers
I making viewer big model in Unity3d for mobile.
How rotate camera on one touch around self
Here is doc about TouchInput Unity Doc. E.g You can count screen width and hight to angle and rotate camera object. Or You can use one of assets from Asset Store e.g : Simple Touch Camera Script