Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Drag UI Object

Discussion in 'Project Tiny' started by Sly88, Feb 25, 2019.

  1. Sly88

    Sly88

    Joined:
    Feb 22, 2016
    Posts:
    73
    hi guys,
    I would like to create a system to drag UI object (rect transform). I try to get a current mouse position and translate it to UI coordinates.

    let displayInfo = world.getConfigData(ut.Core2D.DisplayInfo);
    let displaySize = new Vector2(displayInfo.width, displayInfo.height);
    let inputPosition = ut.Runtime.Input.getInputPosition();
    return ut.Core2D.TransformService.windowToWorld(world, cameraEntity, inputPosition, displaySize);

    I used it but not working well

    Do you have some idea how to handle it in the correct way?
     
  2. Deleted User

    Deleted User

    Guest

    From my experience,
    Input.getInputPosition()
    is already in UI coordinates.
    At least is to work here for Drag and Drop.
     
  3. Zoelovezle

    Zoelovezle

    Joined:
    Aug 7, 2015
    Posts:
    54
  4. Sly88

    Sly88

    Joined:
    Feb 22, 2016
    Posts:
    73