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

Feedback Provide Editor API to read original texture width and height

Discussion in 'Editor & General Support' started by Peter77, Jun 11, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,589
    It would be very useful if I could read the width and height of a source texture. I'm aware that there are reflection workarounds for this (link). However, I needed this in every project so far and it would be very useful for me if that's officially supported by Unity.

    Why do I want get the original texture width/height?
    We had an issue with a cubemap that showed ugly artifacts. The problem was the artist created a 2084x1536 rather than 2048x1536 texture (horizontally not dividable by 4). Unity imports it fine as "6 Frames Layout", but it causes ugly artifacts. It took quite a while to figure out why that was.

    To avoid these mistakes in the future, I want to write some validation code that makes sure "6 Frames Layout" cubemap's have the correct size. But for that, I need to get my hands on the original texture width and height.

    (Case 1163002) Cubemap artifacts if frame width/height do not match
     
    Last edited: Jun 16, 2019