• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

My Unity 3d questions: Bunch of them.

Status
Not open for further replies.
Hello Guys. I am really unexpirienced in coding, so instead of creating new threads each time I dont know something I will just post here. I have weak browser, so please dont screams at me "JUST GOOGLE IT", because trust me I have, and things that could learn I have, what I couldnt I ask here, instead of asking on the unity forums because unity answer respond really strange for my mobile.
If it is scripting question, I would like you answer with javascript.
Before answer put number of questions you are answering, and you can answer anyhow, suggestions, link or you answer by yourself.
Thank you:

1.GUI Buttons, well I understood some basics, like I have learnt to use calculations with screen height and width for all resoluutions, but I dont know how to resize font size of the text, even that on pc it looks big on android its much smaller, like size of button if you dont use "x screen.height/width". So how to change font size on gui.button.
2. GUI Buttons: how to move them, I know how to remove them with boolean but, but moving with transfor.Translate obviously dont work, or I dont know how to do it?
3. I still dont know how to change skin of gui buttons, but when I learn will I be bounded to only one texture? And can any texture, image be used for gui texture, button, or I have to use this from unity site, or some specialy created.
4 Resolution: So lets say I create game in unity for resolution 800 : 480, I have in game mostly sprites, gui.buttons, texts, and such things(no 3D at all), what will happen if someone play game on other device with different resolution? Does something change? And what changes. I know so far to make gui.buttons. Resize for every resoulution, but do I need to do it for plane model of background, and other sprite models? What about text, not 3d text, and 3d text.

Thank you again, sorry if they are begginer questions but I have to start from something.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
4. I assume Unity has the concept of viewports. That is, you can transform your whole scene by moving it, rotating it, or scaling it.
This is useful for when you want to have one set of resources (or multiple sets for different qualities of resources, as is common on mobile devices) and to simply scale them accordingly with the device's resolution.

The real issue isn't a different resolution, but a different aspect.
Suppose you make your scene work well for 16:9 monitors, how would it behave on a 15:9 monitor? or a 4:3 monitor? or any of the funky aspects different mobile devices use?
There are two common solutions:
  • You show more/less in each direction of the scene depending on the aspect. Note that this is probably not fair for games where seeing more can give you an advantage.
  • You create your scene for the most common aspect (e.g. if you are making it for phones, then the aspect of an iPhone might be the most used one), and then you always draw your scene at that aspect. This results in black bars to the left/right or top/bottom sides of the scene if the aspect is different, but anyone viewing your scene will ultimately see the same thing.

Can't give you any code samples since I don't use Unity, but it's a more specific direction you can look into.
 
1: See 3.

2: They're not objects in the game space. They're on your your GUI.
The OnGUI function paints stuff on your screen on every frame, thus if you wanted to move something, you'd have to change the position it is being displayed at.

3: GUISkin objects are essentially a set of how your GUI objects are seen. Applying one will allow you to change many things related to those controls, such as texture, color, boarders and text. Simply create one and edit it in Unity.

4: GUI things display differently depending on their anchor (aka which sides of the screen they're spacing away from). As for your 3D space, you can just lock a few resolutions and keep the ones that the game performs well on. Or you could set their locations to depend on the current resolution.

Hope this solves your problems :)
 
Status
Not open for further replies.
Top