My apologizes in advance if this has already been answered.
How can I manually set the canvas to a specific size?
Or alternatively force it to make use of the standalone default resolution?
It seems to be dependent on the game view (in editor) resolution and ignores that ‘Maximize On Play’ is enabled which is not helpful as it results in the canvas taking an obscure, unusable size.
I’m aware that it can be done with WorldSpace, but I don’t see why it should force me to do that. Rather the fact it works on the game view size (while in editor) is not logical.
That component still works off game view size, while in editor.
As a temporary solution I added a custom editor script that sets it to the correct size, however whenever I switched tabs it reset again, so I changed it so the script executes in editor and changes canvas size on update.
Then I realized I was over complicating things and have the canvas set to WorldSpace, then there’s a simple script that switches it to overlay mode on awake.
If some one does know of a better solution, I would love to hear it.
Just to clarify and avoid confusion, the Canvas uses the Game View resolution, not the Scene View resolution, although in certain cases they are the same. The Game View is a representation of the entire screen, even if its resolution is not always the same as the final player or app will have. The Canvas is meant to cover the entire screen when set to Screen Space modes, hence the entire Game View when in the editor.
If you want the Canvas to match the screen in the final player or app, change the current platform in the build settings to be the platform of choice using the Switch Platform button ( http://docs.unity3d.com/Manual/PublishingBuilds.html ), and then choose the appropriate resolution from the drop down in the upper left corner of the Game View.
Unfortunately the Game View has a limitation that if it’s physically smaller than the desired resolution, then it won’t be able to represent the chosen resolution and will choose a smaller one instead. We wish to fix that problem but won’t be able to do it for 4.6. However, if you add a ReferenceResolution component to the Canvas (and set its reference resolution to the desired values), the Canvas will scale down and work in a way very similar to in the final player or app.
I’m aware, it was a typo on my part. I’ve corrected the post.
Indeed that’s the issue I created this thread about, which I was hoping there was a solution to. So I guess I’ll be waiting on a future version.
The reason I do not wish to use the ReferenceResolution component is that if I ever alter the game views aspect ratio (in editor), it will alter the canvas size in the scene, I wish for the canvas to remain a fixed size while editing. I’ve also noticed the component has precision issues, I’ve experienced up +/- 0.7f.
Scale appropriately.
I think you may be misunderstanding me, while working in editor I want to have the canvas set to the standalone default resolution so I can work off a resolution I’m comfortable with (as working in normalized device co-ordinance is not an option).
Yes, I know. If you set the Game View to be a resolution smaller than the window size, then it will be exactly that resolution, it won’t be dependent on the window size. Then you can author your UI whilst thinking in pixels, and stick a ReferenceResolution on the canvas to make it scale to different resolutions in the build.
To be clear, the Game View got a new feature in Unity 5.4 to be able to zoom the view. With this feature, the Game View now correctly uses the specified resolution, rather than using a lower resolution if the specified one doesn’t fit. This is what Richard “Superpig” Fine is referring to. (This isn’t available if you’re using Unity 5.3 or lower.)
hi superpig :), Hi, the canvas just does not change height, it always stays at 503 pixels and not 576, the canvas scales with the width but not the height, screenshot: https://drive.google.com/open?id=0B_ReTiIOnFd0bkhyWldaRktLSEU
im just not able to fix this pls help thx!
This is by design when you have the Canvas Scaler set to match width and not height. If you want to match by height instead, move the slider over to the “height” position.
The Canvas Scaler does not support non-uniform stretching, i.e. stretching by different amounts horizontally and vertically, since it most often looks really bad. Hence it cannot match both width and height at the same time, though it can do a little of each.
If you want to do it anyway, it would be possible to grab the source code for the Canvas Scaler component (most of the UI system is open source) and make a new version that fits your needs.
Just to make clear and avoid confusion, the Canvas uses the Game View choice, not the Scene View resolution, although in sure cases they may be the equal. The Game View is a representation of the whole show display screen, despite the fact that its decision isn’t usually similar to the very last player or app may have. The Canvas is supposed to cowl the complete display while set to Screen Space modes, consequently the whole Game View even as inside the editor. If you want the canvas prints to match the display display inside the final participant or app, trade the current platform within the assemble settings to be the platform of choice the use of the Switch Platform button ( http://medical medical doctors.Unity3d.Com/Manual/PublishingBuilds.Html ), and then pick out the correct choice from the drop down in the top left nook of the Game View. Unfortunately the Game View has a dilemma that if it’s physically smaller than the favored choice, then it may not be able to constitute the chosen decision and will pick out a smaller one rather. We want to restore that trouble however might not be capable of do it for four.6. However, in case you add a ReferenceResolution difficulty to the Canvas (and set its reference decision to the preferred values), the Canvas will slash and work in a manner very similar to within the very last participant or app.
Have you tried placing the Game View to use a fixed resolution, using the dropdown in the pinnacle left corner of the Game View?
What about a second camera and put its view to a specific size, render to a rendertexture and put that in a rawimage on your maincanvas with aspectratio to your needs on the rawimage. So it will scale with only max height or width of gameview canvas?