OnMouseEnter over a cube

I have a OnMouseEnter function that is acting weird.

My set up is a cube with a box collider and a OnMouseEnter function.

When I mouse over the cube, Everything is fine as long as I mouse over on the left side, if I mouse over on the center or the right side of the cube, the cube will not sense that the mouse just entered.

The cube was created inside Unity then I added the texture.

If I use just GUITexture, all is fine.

I am using a cube for a GUI because I’m having a hard time lining up GUITexture when the screen resolution changes.

Attaching an image because I’m not sure if I’m saying this right. :? GUI1 image(Top), mouse over the left side of cube and GUI2 image(Bottom) mouse on center of cube

Thanks,
Ray

34329--1254--$gui1_121.jpg
34329--1255--$gui2_460.jpg

I think the collider is smaller than the cube.

I think I agree with the above idea. Can you confirm/deny whether that’s the case?

Collider size fits the entire box(cube).

Cube scale is 0.4(x), .25(y), 0 (z)
Collider size originally was 1,1,1
change it to 1,1,0(z) and mouse over(enter) is at least reaches the center of the cube but still not the whole cube.

collider location is 0(x), 0(y), 0(z)

See image of button and collider

Thanks,
Ray

34455--1259--$collider_144.jpg

Don’t know if this would effect anything but try not setting the z scale to 0. I think generally 0s in scale are bad. (just a hunch)

An actual cube with a scale of .4, .25, 0 wouldn’t be nearly that long and skinny. So maybe it is an issue with the collider not being big enough. Or is this some custom object? If so, make sure there’s not anything invisible that might be in front of the cube, and if there is, either move it or put it on the Ignore Raycast layer.

–Eric

So I just did a quick test with a cube, scale of (0.4, 0.25, 0), collider scale of (1,1,0) and position (0,0,0), all worked just fine. And for reference, my cube was most certainly a different shape than yours (as Eric indicated). Just looking at the numbers your cube’s height should be more than half the width and that’s not the case in your images.

So I’m stumped…

@Yoggy
Why is a 0 scale in z bad?

@ Eric5h5
Moved the objects to the front of the character, so far it 's better but still not covering the whole cube. Will play with raycasting.

@HiggyB

Created a cube size it at .4.25.0 and yes the size is different than what I have. When I moved that cube to become a child of my character, cube size change to .8, 2.5 ,0, then I adjusted it back to .4, .25, 0. The new cube works fine but once I moved it to position, it has the same problem.

Getting closer to fixing it I think.

Need to read raycasting,

Thanks,
Ray

Got it to work!

Sorry for being an idiot.
Not about the size,
I had a charactercontroller(collider) from the original FPS that’s causing the problem. As I was adding my own character and colliders, I forgot to remove that thing and it overlaps the boxes.

Eveyones insight did help a lot!

Thanks, Again,
Ray