I'm making a 2D tile game. Yellow-brown tile is the hero character, while dark blue tiles consider walking distance.
On Hero, a Sprite Renderer is added to the box collider 2D and a harsh 2D game object; The layer letter is 1 x 1 unit size and is co-ordinated (0, 0).
Again, I have 4 floating-range tiles (prefab repeat, size 1x1 unit, layer is foreground) around the hero OnMouseDown ()
to work For, I added a box collider 2D to the prefab. After adding the collider, the problem was raised. The hero keeps on moving, because this 4 floating range tile is going to collide with a non-stop. How can I stop the collision? I think they will not bump into different layers, but in fact they collide!
Note: Am I not using the Reoad method (because this code is very complex)?
The last thing is, I aim to target the mobile version along with the desktop version, what is the global way of detecting touch? Click at the same time?
I think if they are in different layers, they will not collide
only if you set Edit it properly -> Go to Project Settings -> Physics -> Layer Collision Matrix. If any box is checked, related layers collide.
I am targeted to target the mobile version along with the desktop version, what is the global way of detecting touch & amp; Click at the same time?
Mouse and touch inputs are divided into unity, so there is no global way, but one touch can simulate mouse behavior on the mobile platform (ie OnMouseDown ()) triggers Can be done), while the mouse can not simulate touch (i.e. empty Input.touches). Therefore, if this is suitable for you, you can use mouse input on both platforms, otherwise (for example, Multitatch is facing difficulties) to make you dependent on platform-based control (for viewing for platforms) Will happen.
Comments
Post a Comment