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 (13)

  1. De553833e28f69bc50c3bc4f811bacf7?d=mm

    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'.

  2. 86c902e85cb66c0d98af626f4d916dbc?d=mm

    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.

  3. F83bcc607030068940b7bd939d5c9e1e?d=mm

    lodendsg

    Jan 02, 2018 16:02

    I can confirm the issue is still with us in 2017.3

  4. Bacdee6e8c0bb82009a05a3c8c96b6bd?d=mm

    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!

  5. 65b71b786d574e90a25650b6302d52be?d=mm

    toqueteos

    Nov 29, 2017 22:59

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

  6. Fb49fcac6d7c8fbe19b0cb41072f42ed?d=mm

    Ghosthowl

    May 29, 2017 23:16

    This issue still exists for me in Unity 5.6.1f1

  7. 4db5267409c3c5ea6a6e699096af2303?d=mm

    MATHIS-Nicolas

    May 13, 2017 14:34

    In Unity 5.6 I have the same bug.

  8. D2e4ba46f6d6671f49eb77455318bd05?d=mm

    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.

  9. Fd40c78d2bb8063aa0701ed0c2e1c0cb?d=mm

    ArtyBrest

    Jan 04, 2017 14:03

    Reproduced in v5.5.0p3.

  10. 3d0c5c45f3dcb91a0b809b220d39797b?d=mm

    BMacZero

    Nov 18, 2016 23:13

    This flag needs to work at runtime to use dynamically-created textures as cursors, otherwise the cursors throw a "Invalid texture used for cursor" warning.

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.