I’ve been looking around at tutorials and documentation for buttons and I wanted to see if I could get a concise explanation about this. I’ve noticed that in my experimentation with doing my own custom button images that the UI button automatically assigns some sort of collider box type detection on your sprite swaps and in my case for the highlighted sprite I have done a glow which is bigger than the original button.
Is there a way to change the way this detection works so the hovered sprite only activates when you mouse over the normal sprite? I’m also wondering if it’s possible to do your own custom mouse detection for instance if you were hoping to do circular buttons or even more complicated shapes, there seem to be assets and extensions available for this sort of thing but I’m wondering what, if any built in options there are for this that I’m completely missing.
Okay I just got a much better understanding of what I was on about now sorry about that, been reading through and learning more.
I was talking about rect transforms, right now I’ve got an annoying situation where my rect transform is constantly scaling with the button sprite I’ve made while I’m changing it and I want to make it so it matches the sprite, I also want to know if it’s at all possible to do custom rect transform for irregular shapes.
Edit: Okay, I partly solved my problem and it was to do with the sprite editor! I just needed to cut out a custom rect transform by making the button sprite multiple. However, I still have a second problem that I needed to solve and it’s the sprites that you swap in from the assets folder in order to have the right effect.
They shrink in size to how they are when you put them into the game engine so that means the sprite swap effect turns my button really tiny, does anyone have any idea why this is?
Edit 2: Sometimes it’s really annoying when you end up fixing things all by yourself after making a detailed post, I hadn’t realised this but you can actually resize your sprite you intend to swap into a button when clicking within the editor then save that as a prefab and attach the image component of that sprite into button and the scaling will then be fixed.
Sorry about that all, hope this helps someone having the same annoyances though, it’s all down to designing skills now, for those wondering. I realised that if you use the polygon editor you can make custom rect transforms that way by simply slicing around your sprites and then that will mean the mouse detection should be extremely accurate no matter what shape you pick.