Slight problem I found while testing: If you right click to unselect while drawing a line or rectangle it will instantly draw when you make a new selection. This is easily fixed by adding "holdActive=false;" and "previewMap.ClearAllTiles();" to the SelectedObj setter. Otherwise, great video!
@@ManjeetKumar-xk8jf Sorry for the late response. It's cool that you work as a game developer. I'm a software dev who enjoys playing games, so it just happened one day that I tried game development, but it's just a hobby for me.
Hi. Thanks for the video. It helped me navigate myself through the mechanism. However I had some issues and don't know if it is specific to my project but this helped me solve it. instead of the one in the video use this: _dragRectangleBounds.xMin = Mathf.Min(_currentGridPosition.x,_holdStartGridPosition.x); _dragRectangleBounds.xMax = Mathf.Max(_currentGridPosition.x,_holdStartGridPosition.x); _dragRectangleBounds.yMin = Mathf.Min(_currentGridPosition.y,_holdStartGridPosition.y); _dragRectangleBounds.yMax = Mathf.Max(_currentGridPosition.y,_holdStartGridPosition.y);
Thank you so much for the tutorial. The IsPointerOverGameObject() now throws a warning that calling the event system in an event callback only gives information from last frame. I fixed with RaycastAll. Code below: List raycastResult = new List(); PointerEventData pointer = new PointerEventData(EventSystem.current); pointer.position = playerInput.Gameplay.MousePosition.ReadValue(); EventSystem.current.RaycastAll(pointer, raycastResult); // Old UI check: !EventSystem.current.IsPointerOverGameObject()) if (SelectedObj != null && (raycastResult.Count == 0)) This is in BuildingCreator.csm, in OnMouseLeftClick().
If anyone else faces this and you want to maintain similar logic you would just need to set it as a field variable in the update method and reference that instead in your cose private void Update() { isPosOverGameObject = EventSystem.current.IsPointerOverGameObject(); ..... }
Awesome, thank you!
So happy with how this series is coming along 🙂
That's great to hear, glad you like it ;)
Brilliant work. Thank you.
Another useful video as always.
Thank you :)
Slight problem I found while testing:
If you right click to unselect while drawing a line or rectangle it will instantly draw when you make a new selection. This is easily fixed by adding "holdActive=false;" and "previewMap.ClearAllTiles();" to the SelectedObj setter.
Otherwise, great video!
10:55 the Line95 In my case it only work as "if (ctx.interaction is SlowTapInteraction)" was it a mistake or i messed up something?
This really helped! Thanks! :D
How to deal with rectangles, pentagrams, solid circles, and hollow circles with only borders?
Great tutorial can we see your face on your next tutorial?
Haha, maybe. It requires more preparation
@@VelvaryGames what's your job?
I work as a software developer
@@VelvaryGames Wow, i work as a game developer. How you started developing games?
@@ManjeetKumar-xk8jf Sorry for the late response. It's cool that you work as a game developer. I'm a software dev who enjoys playing games, so it just happened one day that I tried game development, but it's just a hobby for me.
Hi. Thanks for the video. It helped me navigate myself through the mechanism. However I had some issues and don't know if it is specific to my project but this helped me solve it.
instead of the one in the video use this:
_dragRectangleBounds.xMin = Mathf.Min(_currentGridPosition.x,_holdStartGridPosition.x);
_dragRectangleBounds.xMax = Mathf.Max(_currentGridPosition.x,_holdStartGridPosition.x);
_dragRectangleBounds.yMin = Mathf.Min(_currentGridPosition.y,_holdStartGridPosition.y);
_dragRectangleBounds.yMax = Mathf.Max(_currentGridPosition.y,_holdStartGridPosition.y);
Oh this is definitely a great way to get those values. Thanks for pointing it out :)
Thank you so much for the tutorial. The IsPointerOverGameObject() now throws a warning that calling the event system in an event callback only gives information from last frame. I fixed with RaycastAll. Code below:
List raycastResult = new List();
PointerEventData pointer = new PointerEventData(EventSystem.current);
pointer.position = playerInput.Gameplay.MousePosition.ReadValue();
EventSystem.current.RaycastAll(pointer, raycastResult);
// Old UI check: !EventSystem.current.IsPointerOverGameObject())
if (SelectedObj != null && (raycastResult.Count == 0))
This is in BuildingCreator.csm, in OnMouseLeftClick().
If anyone else faces this and you want to maintain similar logic you would just need to set it as a field variable in the update method and reference that instead in your cose
private void Update()
{
isPosOverGameObject = EventSystem.current.IsPointerOverGameObject();
.....
}