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
-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.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Ahm7ed
Sep 14, 2024 22:26
I just got this bug today
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.
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'.
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.
Loden_Heathen
Jan 02, 2018 16:02
I can confirm the issue is still with us in 2017.3
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!
toqueteos
Nov 29, 2017 22:59
Still an issue, I'm using Unity 2017.2.0f3 on Windows 10
Ghosthowl
May 29, 2017 23:16
This issue still exists for me in Unity 5.6.1f1
MATHIS-Nicolas
May 13, 2017 14:34
In Unity 5.6 I have the same bug.
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.