Simple Click To Move In Unity

First we need to add a Nav Mesh Agent component to our player, which will allow our player to move along a surface.
Next we have to actually bake our nav mesh on our walkable surface. This should work so long as your object is set to Navigation Static.
Once the game objects are ready, it’s only a few lines of code to get click to move working. Just a ray cast from the mouse pointer position to get a destination, then set the navigation to work.

--

--

--

Game developer with over 12 years of experience, mainly focused on MMOs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Configuring JetBrains PyCharm for your Snowpark Python Development

How to Make a Cool Messenger That Works Fast with a Weak Internet

Web Scraping: What is it and what is it used for?

Why FeatureBoard?

Unreal Engine 4 Rendering Part 3: Drawing Policies

Microsoft Graph API and Graph Explorer

REMOTE HIRE KOTLIN DEVELOPER IN MIAMI

Nest-Protocol x Im Community AMA Recap

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ben Pielstick

Ben Pielstick

Game developer with over 12 years of experience, mainly focused on MMOs.

More from Medium

How to Switch Between Cameras with Cinemachine and Timeline

Adding a thruster speed boost on keypress

My journey becoming a Unity game developer: 2.5D Infinite Runner-Regular jump to double jumping

Wall Jumping