I have been searching on how to create a native top bar in Unity with menu item for Android mobile game (the 3 vertical dots and the back arrow) but I couldn't find anything.
So I was wondering if there is a standard Unity way to create a top bar like the native Android or I have to create a custom one?
Here is an image with what I am describing (yellow color is all the bar, and red color the 3 vertical dots)
Thank you.
There is no standard Unity way to create a top bar like the native Android. You have to create a similar UI that looks that the Android menu with the components Unity's UI system This can easily be done if you know the basics of Unity's UI system.
Breaking down the Android menu for Unity:
The three dots can just be represented with the Image or RawImage
component. If you decided to have 3 images(one for each dot) instead
of one image with three dots then use the VerticalLayoutGroup
to group all dots into one.
The search icon could just be a UI Button, Image or RawImage
component.It really doesn't matter. Any of these should work.
You will need a grey background image just the color from the Android
Menu Item. Again, this image will also use the Image or RawImage
component.
You will also need a Text component to show your "Action Buttons" text or any or text you wish to display in the menu.
Finally, group all the components mentioned above into a panel then
use anchor and pivot point to position the panel to the top of the screen.
If you still want to show the Android menu, it is still possible to do:
Create new Android project with Android Studio (Not from Unity. From there, create the
Android menu item.
Export your Unity project and import it into your Android
project in Android Studio.
Modify your Manifest and Activity class code to display your Unity
game as sub-view. You can find more information here. From there
you can even call Unity's function from your Android project with the
UnityPlayer.UnitySendMessage function if needed. Your game will run with any Android UI.
I don't recommend this because it would only work on Android. Also, each time you make changes to your game, you would have to export it again. This is annoying and time consuming. Use the Unity UI system to create this.
Related
I'm working on my game and I want to add an inventory type system, when I added the panel it was a little transparent while the one in the video was watching was not. I didn’t see any setting for transparency in the Unity inspector for both the canvas and the panel. The UI mode is an overlay
I didn’t try much other than clicking all the check boxes, and I was excepting for the up to be a solid color.
If you have a Canvas Group in your hierarchy, it can come from here (Alpha property).
I needed to go to colors and slide this slider all the way up or down (the slider you need to change)
I have created a simple Unity AR Foundation app which places objects on a plane whenever the screen is touched. I would like to add some UI so the user can press a button rather than anywhere on the screen.
I have followed several different tutorials which seem to be doing mostly the same thing. I right-click the Hierarchy -> UI -> Button. I have scaled it so it should fit my mobile screen and anchored it to the center so it should be easy enough to find.
These are the canvas settings:
Might the UI somehow be hidden behind the camera feed from the AR Session Origin -> AR Camera? Am I missing any steps to anchor the UI to the screen?
As you can probably tell, I am very new to Unity but I feel like I have followed the tutorials for creating a UI, but it simply won't show. If you need more information, please just ask and I will provide.
Not sure but sounds like you might need to have that Canvas Scalar to scale with the screen size. Change the UI scale mode to Scale with Screen Size.
I was compiling the wrong scene. I had two very similar scenes, so when I compiled I didn't realize there were no changes and that I was inspecting the entirely wrong scene.
Once I changed to the correct scene the setup above worked as expected.
In all canvas training videos in unity, when creating a canvas, blue dots appear that you can use to scale the object. I don't have any:
enter image description here
How do I add them? Maybe my settings are not the same
The settings are not different. I believe what you are describing is the Rect Tool. You can either select the tool on the top left selection by clicking the icon with 4 vertex points or when you have the editor open, click T and it will automatically swap to this tool. The points on your UI image will appear and you will be able to scale it using them.
I am working on a project in unity5, while I am making a menu contain buttons, I need button to make glowing outline, need help in this regard.enter image description here
same in the picture, I need button like this in my Unity 5
if you are using canvas you can do that without using any functions or events it can be easily done select button in inspector you will see button (script) component set transition to sprite swap and drop the desired sprite in pressed sprite box.
I am a complete beginner with Unity and VR and I've downloaded a few demo scenes into Unity with Google Cardboard all set up.
These scenes work, however I have seen several VR applications where the stereo view (the 2 screens for the 2 different eyes) is NOT separated by Google's little divider with the gear icon at the bottom -
These applications look a lot cleaner and just have a split, stereo screen with no divider or anything. Here is a video of what I'm talking about: https://www.youtube.com/watch?v=ZZC0ef604WU
There is no divider, just 2 stereo screens. I don't know what this is called.
I've downloaded some demos that have this but cannot figure out where/how they disabled Google's divider and moreover the black around the 2 screens.. How do you do this with Google cardboard's Main camera?
Please explain everything clearly as I'm new to this.
In Unity select the "CardboardMain" gameobject. You will see a checkbox for Alignment Marker and Settings Button. Uncheck those and you should be set.