Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [EditorWindow] Possible to create raycast on Terrain

Discussion in 'Immediate Mode GUI (IMGUI)' started by L_tD, Dec 19, 2022.

  1. L_tD

    L_tD

    Joined:
    Mar 8, 2017
    Posts:
    39
    Hi,

    I'm currently trying to create a small EditorWindow Tool to place Prefabs in a certain radius on a terrain surface.
    Is this possible by using a custom EditorWindow?

    If yes, how do I get the mouse position to create a ray into the scene and find out where to hit the surface of my terrain?

    Currently I just get the MousePosition in OnGUI(), but I need the mouse position in the scene View if the EditorWindow is enabled.

    Thanks a lot in advance
    L_tD
     
  2. L_tD

    L_tD

    Joined:
    Mar 8, 2017
    Posts:
    39
    Hi,

    I solved it, because I think I had missunderstand how EditorWindow scripts are working. It did it now the way how it is done in this video.



    Maybe it helps others if they want to do the same.

    Best
    L_tD