Unable to use Unity UI elements on my android - unity3d

I just created a very simple 3D game, and I used Unity UI for the first time.
Inside the game editor I can click the buttons and move the sliders.
I build the game for my android,and I can see all UI elements on my device but however, for some reason, I just can't use them.
Can you please help me and explain what am I doing wrong? Is it a bug?

I found the problem.
The Canvas element comes with "EventSystem" object. All I had to do is to check the CheckBox called "Allow Activation on Mobile device"...

Related

Hololens + Unity: GameObjects are invisible

After I build my Unity project and send it to the Hololens, I have the following problem:
The splash screen appear followed by a debugging window on the bottom. In the background is a white net. However, you can't see any game objects. I've tested a lot but haven't found a solution for that. Visual Studio does not display any error messages. What I've looked at roughly:
These are my modules. Im using the 2019.4.22f1 version of Unity and the MRTK Foundation Toolkit 2.7.2.
My build settings
My project settings
I tried to place the objects in the middle of the camera and changed the colors.
MRTK settings I haven't changed anything most of the time
Main camera settings
My scene
When i start the scene i get this error in the console. I dont know if this has anything to do with my problem
i have two possible solutions (no guarantee)##
you could spawn the objects on input directly in front of the
camera, add a debug.log("object in front of you"); so you can find
the issue.
If this doesnt work i would try to test differnet types of materials
like you do with HDRP.
if this does not work either i probably cant help you out now.
It seems like your GameObject is too far to be hidden behind by the mesh. Please make the spatial mesh invisible by setting the Display Option property of Spatial Mesh Observer Setting to None, this item can be found under the Spatial Awareness profile of the MRTK profile.

Unable to add interactions to oculus handtracking in Unity

I'm using the oculus integration package to implement hand tracking and have added the OVRCameraRig. Under the LeftHandAnchor I have added OVRCustomHandPrefab_L and similarly done the right hand. I have also enabled physics so the hands work and I can push items off the table in game.
However, I want to implement grabbing mechanism so I added the HandsManager prefab to the scene and put the above mentioned hand prefabs for the left and right hand fields. FInally, I added in the InteractableToolsSDKDriver but none of the interactable tools are working, the little blue dots aren't visible at all.
I'm not getting any error either. Please help, how should I fix this to get the Interactable tools to work?
Well probably because you haven't add component "xr grab interactable" to the item that you wanna grab.

In unity how to make in-game menu?

I'm making a Unity2D mobile game but I'm stuck on making a menu. I want the in-game menu and if the player touches the screen or clicks the screen, the game will start and the menu will be have store, options but I don't know how to do it. I tried to do the same scene but this time when it goes to the next level, the menu disappears. I searched on the internet but couldn't find it. Thanks.
You should first create a UIManager script for yourself.
In this script, you must define 2D elements such as Text, Canvas, Panel and provide their functionality.
Then you can control these functions in your main manager (GameManager).
To put it simply, it takes almost a video tutorial to explain it.
Because this is not a simple code error question, man.

Google VR Unity SDK - Unable to Detect Touch in VR Mode

I am using GVR Unity SDK Version: 1.1 with Unity 5.5.0f3. I need to display a button similar to the Gear Icon that is rendered by the Google VR SDK. This button should accept touches and should be visible at all times. The issue with using a Button created in the Unity Canvas is that it does not process touches because the GVR Input Module takes precedence over the StandAlone input Module.
I have looked at the google vr sdk code and have found that the gear icon is rendered using OpenGL calls in the PostRender.cs file but still am not able to find where the touch is processed. Beyond this I am stuck as I dont have much knowledge of OpenGL.
My question : How do I render a button on top of the existing UI (so that it is visible at all times just like the gear icon) and get it to accept touches (by calling a function in my code).
I know that you have to do some recasting from the controller to the UI. There is a demo scene called "Scrolling UI". Try checking there to see if there is something that can help out.
I'm not a hundred percent sure, but just some advice to the right direction.
Hope you find your answer!
The simplest way I found for enabling regular touch inputs on top of the VR scene is to use a Screen Space - Overlay canvas with a regular Graphic-Raycaster and add a Standalone Input Modul to the EventSystem game object.
This way the buttons in that canvas are clickable.
Hope it helps.

Randomly Appearing Popups In Unity3D

How can i make an image to randomly appear while in-game in Unity3D ? It will serve as my popup advertisements for my game. I want to have ads without using AdMobs or any other plugins.
Depending on how you plan to display your images. You could write a script to randomly Enable a GUI Image, then have the GUI Image become disables after a specified time is over or by a button click (like a "X" symbol or close button).
My recommendation would be some mix of the following:
Create an UI Image GameObject. Use this as the main Advertisement GameObject.
Create a script to set this gameobject active/inactive randomly throughout the game. Place this script on an object in the hierarchy that will exist throughout the game.
Create a script that will be your advertisement handler. Attach this to your UI GameObject. In this you can create some sort of structure to hold different ads or however you plan to populate the ads. Then you can customize the way the ads will be displayed. Will it be random? Will it happen sequentially? Are there different types of ads?
Create logic to disable the gameobject based on a timer or by way of a close button.
If you get around to coding and have trouble, then please feel free to ask about the coding. Also, check out the Unity Forums for questions specific to Unity.