Search Issue Tracker

Won't Fix

Votes

29

Found in

5.1.0b6

Issue ID

695955

Regression

No

Texture2D.alphaIsTransparency API is editor-only but lives in UnityEngine.dll

Scripting

-

-e: Using Texture2D.alphaIsTransparency in a script causes the build to fail with the following error:

error CS1061: Type `UnityEngine.Texture2D' does not contain a definition for `alphaIsTransparency' and no extension method `alphaIsTransparency' of type `UnityEngine.Texture2D' could be found (are you missing a using directive or an assembly reference?)

-repro:
* Open attached example project.
* Go to File > Build Settings
* Select PC, Mac & Linux Standalone
* Select Target Platform "Windows x86"
* Press Build
* NOTICE the build fails.

Expected:
Using Texture2D.alphaIsTransparency should not break a build.
If this is intended to be an editor-only method, consider moving it in to UnityEditor.dll.

Update: This setting is available only in the Editor scripts. Note that changing this setting will have no effect; it must be enabled in TextureImporter instead.

Comments (15)

  1. Ahm7ed

    Sep 14, 2024 22:26

    I just got this bug today

  2. tmoneygames

    Dec 07, 2022 07:36

    I'm having the same issue with version 2020.3.42f1 as well. So I can say the bug is still there in this version as well.

  3. daniel_martins

    Aug 09, 2018 16:09

    I tested this on Unity3D version 2018.2.2f1 and the following error appears: error CS0117: 'UnityEngine.Texture2D' does not contain a definition for 'alphaIsTransparency'.

  4. Adherbal

    Jan 09, 2018 17:29

    Same problem. Hardware cursors won't work correctly using dynamically-loaded PNG textures because I can't set alphaIsTranparency in the game build, while it works fine in editor.

  5. Loden_Heathen

    Jan 02, 2018 16:02

    I can confirm the issue is still with us in 2017.3

  6. fatboynotslim

    Dec 20, 2017 16:53

    I am using texture arrays. At first run i build two different texture arrays; one for opaque textures and one for transparent textures. This works perfectly in the editor.

    However when I try to compile to build i get error 1061' same as the others.

    Please fix this as I need to use it at runtime to determine if a texture is transparent or not! Otherwise I don't know which texture array to put it in.

    NB I *can* do a workaround by naming all trans texures with a leading underscore and checking the name but this is (a) Slower than checking a alfa value (b) Kludgey (c) Prone to errors - i might accidentally underscore a texture that is not trans, or not underscore a texture that is.

    Please fix!

  7. toqueteos

    Nov 29, 2017 22:59

    Still an issue, I'm using Unity 2017.2.0f3 on Windows 10

  8. Ghosthowl

    May 29, 2017 23:16

    This issue still exists for me in Unity 5.6.1f1

  9. MATHIS-Nicolas

    May 13, 2017 14:34

    In Unity 5.6 I have the same bug.

  10. Hullabu

    Jan 04, 2017 14:04

    This bug still exists in Unity 5.5.0p3. Dynamically-created textures has artifacts on the edges. It a problem and it must be fixed.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.