- Home /
OnMouseEnter/Exit fail when Parent. [Solved]
Hi! I've made a script with OnMouseEnter/Exit that change the renderer color. It work perfectly but when I put the 3D text parent to the main camera (because it's my pause menu) the color don't change. How can I fix this? Thanks!
*Doesn't
Try making an empty gameObject, parent it to the camera, then parent the text to that. Does it work?
Also, because the text is moving with the camera and with therefor your mouse pointer, the mouse simply could not be in front of where your text is.
Sorry, english is not my first language!
Thanks, I tried it but that DOESN'T work ;).. but the camera and the player isn't moving, because when I press "P", the timescale goes to 0.0f and the text is shown. So nothing is moving. At the begining I was thinking that it was because of that but when I deparent it, it worked even if the timescale was to 0.0f.. so I don't know what to do..
Have you considered using GUI text? Also you could try a SCRIPT that makes it follow the camera ins$$anonymous$$d.
Here is one I just found on the internet:
var target : Transform;
var smooth : float = 5;
function Update () {
transform.position.x = $$anonymous$$athf.Lerp(transform.position.x,target.position.x,Time.deltaTime*smooth);
transform.position.y = $$anonymous$$athf.Lerp(transform.position.y,target.position.y,Time.deltaTime*smooth);
}
(This is actually for smooth follow)
Thanks it work but do you know how to make follow the rotation too(x,y)? I've search but i didn't find!
Try adding these components:
private var speed : float = 5;
function Update ()
{
rotation = Input.GetAxis("Horizontal") * speed;
transform.Rotate(0,rotation,0);
}