blue
New vMember
Posts: 11
|
Post by blue on Nov 18, 2016 14:12:43 GMT
Hi, I had a problem with buttons on the mobile controller, I use the top down camera with top down cursor and the example mobile UI in the asset pack. The problem was that all touch on mobile goes through the buttons and into the ground. So the the character runs the animation and then try to reach the location behind the button. forum.unity3d.com/threads/ispointerovereventsystemobject-always-returns-false-on-mobile.265372/And other forum posts I tested some solutions but I didn't get anything to work, yet. Did anyone have a fix on this...
|
|
|
Post by Chronicman on Nov 18, 2016 16:24:38 GMT
Have you tried attaching a canvas group to your buttons, Set the ignore ray cast to false.
|
|
|
Post by johnlanz on Nov 18, 2016 17:00:56 GMT
I've experienced this issue as well. It seems that block Raycast is not working even on canvas group.
|
|
blue
New vMember
Posts: 11
|
Post by blue on Nov 18, 2016 17:11:34 GMT
Thanx for trying, I was sitting here trying to get it to work. I even put a canvas group (transparent) under the buttons with a mask button.
I can probably use NGUI instead...
|
|
|
Post by Chronicman on Nov 19, 2016 5:47:57 GMT
Check the canvas layer, make sure its not set to ignore ray cast as well.
|
|
blue
New vMember
Posts: 11
|
Post by blue on Nov 19, 2016 18:34:34 GMT
I change buttons to NGUI and because they are using raycasts i could stop them from hitting behind the buttons. Now I need to change the input, anyone here knows how to change it to work with NguI. Where are the best place to write this new code?
The changes I made in vThirdperson input, i just check if the layer are my new UI layer or Else if raycast hits the clickMoveLayer:
RaycastHit hit; if (Input.GetMouseButton(0)) { if (Physics.Raycast (UICamera.GetComponent<Camera> ().ScreenPointToRay (Input.mousePosition), out hit, Mathf.Infinity, UILayer)) { Debug.Log ("Click in UI layer " + UILayer.value); return; } else if (Physics.Raycast(tpCamera.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition), out hit, Mathf.Infinity, clickMoveLayer)) {
|
|
blue
New vMember
Posts: 11
|
Post by blue on Nov 19, 2016 18:46:09 GMT
Check the canvas layer, make sure its not set to ignore ray cast as well. I use UI layer for all of the interface, I didn't notice any difference. Thanks for helping anyway.
|
|
|
Post by fighter on Dec 3, 2016 21:48:36 GMT
Hi,
i have the same Problem. Is there a solution for this.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 4, 2016 17:49:04 GMT
Have you tried just using unity ui? That might help, if it doesn't let me know.
|
|
|
Post by fighter on Dec 5, 2016 8:42:40 GMT
I tried it, same Problem. You can test it very easily. A simple plane and a character. For every button above the plane, the click goes through and the character runs.
|
|
blue
New vMember
Posts: 11
|
Post by blue on Dec 6, 2016 21:30:33 GMT
I didn't see the update on this before because i was away, but the problem is there. I got it even in the demo scene, my project is set to android (I didn't check other platforms), and when you run the project and change view to top down and press any button i saw particles on the floor and my character will try reach the destination.
I didn't find any solution more then NGUI, and it make it a hard problem for me to solve, I think that Unity UI has a problem to stop raycasts going through.
|
|
|
Post by Invector on Dec 6, 2016 23:03:21 GMT
I didn't see the update on this before because i was away, but the problem is there. I got it even in the demo scene, my project is set to android (I didn't check other platforms), and when you run the project and change view to top down and press any button i saw particles on the floor and my character will try reach the destination. I didn't find any solution more then NGUI, and it make it a hard problem for me to solve, I think that Unity UI has a problem to stop raycasts going through. Just try out the mobile scene to check this issue and indeed... there is something wrong with that raycast target bool I will try other approaches later and see if we can get a fix
|
|
|
Post by Invector on Dec 21, 2016 14:46:44 GMT
Finally found a fix for that!
Open the vThirdPersonInput and on the method ClickAndMove add this if:
if(!UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject(-1))
if (Input.GetMouseButton(0)) { if (Physics.Raycast(tpCamera.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition), out hit, Mathf.Infinity, clickMoveLayer)) { if(!UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject(-1)) { if (onEnableCursor != null) { onEnableCursor(hit.point); } cursorPoint = hit.point; } } }
|
|
|
Post by fighter on Dec 24, 2016 8:15:03 GMT
Great, works well
|
|