Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Discussion Target the ground using new InputSystem/PlayerInput

Discussion in 'Input System' started by halfblue3, Sep 10, 2022.

  1. halfblue3

    halfblue3

    Joined:
    Mar 5, 2019
    Posts:
    12
    Basically what I'm trying to do is spawn something in front of a perspective camera that is attached to a world space canvas and would move using mouse.

    I have used InputSystem before for my character's movement. I know I need to create some methods that I need to link to an action to use InputSystem. But when I was researching about how to use mouse with InputSystem, it seems to be done in a different way. You can directly access the InputSystem mouse anywhere not just inside a method which I'm accustomed to with when I implemented character movement, which I saw on this informative yt video and some articles. I could use direction keys and such to move the targetting thing, but I think mouse is more appropriate for this scenario as you can move a mouse quicker and maybe more precise than WASD or direction buttons, etc.. So I want to know if this "free-range" (lol) mouse is the way to go or there is still that method that I need to use or there are other ways to do what I wanted to do.
     
    Last edited: Sep 10, 2022
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,262
    If you don't plan on having controller support go with Mouse.current.position.ReadValue. If you do plan on controller support I would setup a value action with vector 2 as the control type and go from there.
     
  3. halfblue3

    halfblue3

    Joined:
    Mar 5, 2019
    Posts:
    12
    Thanks for the info