Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to transform screen position to local texture pixel coordinates

Discussion in '2D' started by OrfStudios, Jun 23, 2022.

  1. OrfStudios

    OrfStudios

    Joined:
    Nov 16, 2020
    Posts:
    4
    Hi, I have a problem while trying to make a simple pixel art system for the player using Texture2D and SetPixel. SetPixel works by giving it the pixel coordinates of the pixel you want to draw, how can I transform Input.mousePosition to the local pixel coords of the pixel inside the Texture2D?
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350