Why does Vector Image not scale in Unity 5.4.0f3?

0 votes
asked Sep 1, 2016 in Issue by Dave
First, I know I'm using an unsupported version of Unity, though I tried this in 5.3.0 and it still happens.

So, I'm using Vector Images to utilize icon fonts, but when I try to scale the image, the icon does not scale. Changing the size mode produces no discernible effect. If I use a button with a vector icon, changing the padding merely displaces the icon in relation to the side I'm padding. The bounding box for the UI element may change, but the icon always stays the same size.

Am I doing something wrong? Has anyone else had this issue? Is there some code I can edit to make this feature of the asset compatible with 5.4.0 or is it something that is far too complex and must be added in a future release?

Thanks,

Dave

1 Answer

0 votes
answered Sep 5, 2016 by admin (31,720 points)
Hey Dave!

Thanks for writing us.
Well the reason for that is because we force the scale to 1,1,1 on VectorImages, so we have always 100% good looking vector images. If you want to resize a VectorImage, simply change the size of the RectTransform or set the size mode to manual and specify a size right under the size mode. (take a look at the example scene 10).

~ Yohan
commented Sep 6, 2016 by Dave

Okay, so this answer really didn't take into account what I had said I tried (scaling and changing the size mode), but it did make me check out example scene 10. Vector scaling worked as advertized in this scene surprise So I compared the vector image component and the canvas with the one from my scene. I found that the canvas must have the MaterialUIScaler component. Once that was on, everything worked as it should.

This is something I missed in the documentation, but it is there. Perhaps a context menu option (MaterialUI > Canvas) to create a canvas with the MaterialUIScaler component attached would be helpful?

Anyway, thanks for the help!

Dave

commented Sep 6, 2016 by admin (31,720 points)
Glad to hear you managed to solve the issue :) I'm working on documentation and guidelines to help with things like this the future - in the meantime, that Canvas idea sounds good, I'll implement that in the next update. ~ Declan.
Welcome to MaterialUI support! Ask us anything :)
...