How can I stop some units from being able to enter water in a strategy game?

I am currently working on a rts style strategy game with a large variety of units. What can I do to disallow land units from being able to enter the water? I really don’t know where to start with this so any suggestion will help.

Depending on how you’re moving your units, you could take a look at LayerMasks and figuring out if the position your unit is moving is on an applicable layer, and work it out from there.