In my project I’m using the Unity UI to make the inventory of the character. at the scene, there are objects with raycast that when they are clicked, activate a UI with information about them. if i’m in front of these same objects, and Enabled the IU Inventory, and click on the objects with Raycast, the UI with information about it appears, and hinders the process of inventory. I tried a few methods to make the UI block Raycast Collider (Physics Raycast). The only one that worked was this:
At the top:
using UnityEngine.EventSystems;
In void Update
: if (EventSystem.current.IsPointerOverGameObject ()) {
In the editor of Unity, everything works perfectly. But the problem is in the build, which does not work. I use:
void Start ()
{
Screen.lockCursor = true;
Cursor.visible = false;
}
To lock the mouse pointer in the center of the screen, and i see if disable this function, the script with Collider Raycast
(Physics Raycast
) works perfectly in the build.
So I was wondering if someone can help me, can be a method to make the UI block Raycast Collider
(Physics Raycast
), or some other method to lock and hide the mouse pointer, or something similar.
in short: I need a method, to make the UI block Physics Raycast
(Raycast Collider
).
Note: sorry for bad English, I used a translator.
[Mods] Watch the user and his answerer. They could be bots.
– Crucifixion