Would referencing the Mouse.Hit property cause slowness?

I am curious. Does referencing Mouse.Hit in code cause the game to calculate Mouse.Hit, or is it always calculated regardless of being referenced?

No it doesn’t cause slowness, and it is always changing, it’s not like you get it only when you read it. That would be even slower.

If your game is slow I don’t think reading the Hit property is your bottleneck.

1 Like

I was just curious. I am designing a system where the mouse changes based on what you hover over (certain parts, for example), and I was intending on using a system attached to Mouse.Move, and was curious if calling Mouse.Hit would clog a bit of the system.

Use Mouse.Target, it only gives information based on the part, or asset, it is hovering over. Mouse.Hit gathers information about the certain position on the workspace in relation to the mouse’s position on the screen.

Sorry, meant to say Mouse.Target. But they both do the same thing, firing a raycast from the camera at the Mouse’s direction. One is the part value of the tuple, one is the position value of the tuple.

Oh okay, it’s ok, and I understand, thanks!