Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

PowerQuest

A Nifty 2D Adventure Toolkit for Unity · By Powerhoof

Character won't walk when clicking outside of Walkable Area.

A topic by JustinMucus created Aug 26, 2020 Views: 241 Replies: 5
Viewing posts 1 to 5

Hello again,

Whenever I click outside of my Walkable Area, my player character doesn't seem to want to walk to the nearest spot inside the Walkable Area. This was working fine earlier but just decided to stop after I imported an updated background and re-positioned the Walkable Area's collider. It seems that the player only wants to walk when A) I click inside the Walkable Area and B) there is direct line-of-sight to the point I clicked from the player character.

Any tips?

(1 edit)

Some more info. Turns out I'm getting log warnings saying 'Couldn't Find Path' whenever I click outside of the Walkable Area. But I connected another room to the room with the issues and when I click the Hotspot to transition to the new room, the character won't even walk to the WalkToClicked location and it'll just load the next room. But everything in the new room works fine. The player will spawn at the spawn point and walk to the right spot after entering. I can even click outside of the Walkable Area in that room and he moves as expected. But if I transition back to the problematic room, he just spawns in his original spawn point and I get lots more of those 'Couldn't Find Path' log warnings.

(1 edit)

Did some testing and there's two things that can cause that.

  • The Walkable area is inside-out. This could happen if you dragged the points out so the ones at the bottom originally are now at the top (or same for right/left). The easiest fix is to re-do the area (add another walkable area and delete the original). Edit: Just added something to check for this and handle it, so in later versions it won't be a problem
  • You have a "hole" that's blocking off a whole section of walkable area. This is on my todo list to fix. I do have an alternative way of blocking a section, so if you need to do this, let me know.

Unfortunately, neither of those apply. I reset the collider and carefully made sure not to overlap any points, and it seems to still be showing the same problem. And I currently have no holes in the area.

(1 edit)

Okay so I removed the Walkable Area completely through the interface, added a new one, and re-positioned it and it works (what you said to do). I think the issue occurred when I went to the polygon collider and hit 'reset' on the component itself. Lesson learned! Thanks for looking into it.

Cool, I think it's likely still the winding, so hopefully fixed in the next update, but either way, good to know the fix if it happens to others!