Vector in Image button script error
Hi.
I'm trying to import a vector image on a Button with this script:
https://forum.unity.com/threads/unity-ui-svg-support-script.551254/
got this message in the console
Assets\SVGImage\SVGImage.cs(81,41): error CS1061: 'Sprite' does not contain a definition for 'HasVertexAttribute' and no accessible extension method 'HasVertexAttribute' accepting a first argument of type 'Sprite' could be found (are you missing a using directive or an assembly reference?)
Do you have an idea what the problem is?
Thanks
Answer by Max_Bol · Oct 27, 2020 at 04:36 PM
I also had this issue. With Unity 2020.x, there's some kind of internal conflict with certain code refereeing to some of the definition set within the Experimental.U2D. Some of its references were moved to released U2D. If you look closely at the top of the SVGImage.cs script, you'll notice that the UnityEngine.Experimental.U2D is grayed out as it's not used.
The HasVertexAttribute and GetVertexAttribute are, since 2020.x, part of the regular U2D library and no more into the experiental U2D. So the fix is simply to remove using UnityEngine.Experimental.U2D at the top of the script and add using UnityEngine.U2D; instead.