Cannot get vertex position after vertex shader has modified it

I have a simple perlin noise vertex shader making ocean waves, everything in that regard is working fine. I am hoping to have a boat on this ocean and have the boat float along with the vertex shader perlin noise waves.

The problem is, no matter what I poke at I can’t seem to access this adjusted vertex value anywhere?! I have tried the following:

var mesh = Ocean.GetComponent<MeshFilter>().mesh;
Vector3[] vertices = mesh.vertices;  // I've looked at UVs and Normals as well, not 
                                     // exactly sure what they are but I looked! :)

// for v in vertices, print v.y -- It's always the same no matter what the waves are doing

I also tried raycasting to see if I could hit the ocean and get the correct value, but I believe the collider on the ocean is not changing from the vertex shader results. That makes some sense, but I am very confused on how the vertex shaderis changing the vertices, but I cannot access this value?

Could it be I need to grab the position from somewhere else?

No, you can not access the result of the vertex shader since this all happens on the GPU in video memory where the CPU has no access to. Vertex and fragment shaders are part of the rendering pipeline and are only responsible for rendering / displaying. They aren’t meant for calculating data that you can use on the CPU. There are compute shaders which allow you to send information to specialized shaders which compute things on the GPU and pass the results back to the CPU. However this sending to the GPU and back has some bandwidth limits. So apart from the fact that you need a rather new GPU to support this, you have to ask yourself if the amount of work is worth it to offload it to the GPU.

If you just want to query a position on your perlin noise generated water, you just need to recreate the exact same algorithm on the CPU. Since you don’t need to calculate the whole mesh but you are only interested in one (or a few) points this should be really fast on the CPU.

Since we don’t know anything about your actual shader we can not really help you any further here.