Hello,
For my project I managed to found a program to use a A* pathfinding between a target and my camera.
However the path is drawn by Gizmos.DrawCube and I want to show the cubes in the build. Red Boxes are obstacle (they are attached to big dark red cubes). Green Boxes are the path.

My game view without gizmos :

My game view with gizmos (the result I want) :

Does anyone solved this problem before ?
Thanks for checking it.
Yours.

If i understand you correctly, you want to draw these Objects in the Game view, right? Then you habe multiple options.

  • use GameObject.CreatePrimitive to create cube Objects instead of Gizmo.DrawCubes().
  • create a custom Mesh where you place the vertices at the cube positions. This is better than generating a lot of cubes, as you reduce the amount of objects/draw calls. Its a bit more complicated, though :slight_smile:
  • if you simply want one path, you can also use LineRenderer.

Hello @Klarzahs,
Thanks for replying.
I also saw this function in the new Unity.

Do you know this function ? It looks like what I am looking for.
I’ll keep you update of my further investigations.
Do you have an idea of what the scripts will look like with the mesh or line renderer solution ?
Yours.