No input after scene load
Hi I am having an issue with my application - The first scene is a small 3D room with a laptop, when the user clicks on a laptop a new scene is loaded which is a replication of a desktop, the scene is with a Camera, UI Canvas and a button, and also a cursor sprite with a script attached to it that makes the sprite follow the users input via a mouse ( where ever the mouse moves, the cursor will follow).
This works as should the sprite follows the mouse as required and my button takes me to the next scene as should - However once the whole application is built, upon accessing the laptop to load my OS scene I can't move the mouse, the application is acting as if its not the current window selected, if i press the windows key and then click back on the application it works again as should. I notice this during the building of the application, where upon that scene load from the initial main scene I would have to press ESC for the mouse to function. So I added in a text GUI to tell the user to press ESC to continue and this worked.... whilst testing at least but it doesn't fix the issue once the application is fully built, pressing the ESC key then does nothing. Attached below is my follow mouse script, any help would be greatful.
using UnityEngine;
using System.Collections;
public class FollowMouse : MonoBehaviour
{
public float distance = 1.0f;
public bool useInitalCameraDistance = false;
private float actualDistance;
// Use this for initialization
void Start ()
{
if(useInitalCameraDistance)
{
Vector3 toObjectVector = transform.position - Camera.main.transform.position;
Vector3 linearDistanceVector = Vector3.Project(toObjectVector,Camera.main.transform.forward);
actualDistance = linearDistanceVector.magnitude;
}
else
{
actualDistance = distance;
}
}
// Update is called once per frame
void Update ()
{
Vector3 mousePosition = Input.mousePosition;
mousePosition.z = actualDistance;
transform.position = Camera.main.ScreenToWorldPoint(mousePosition);
}
}
Number one, Props, you made this threat post not only organized, but did everything you were supposed to. VERY Professional, so good job.
So I got a question, When you build&run it, do you have any options enabled? Because if you put on Script debugging (I think it's called)
It may give you a couple of errors if there is one.
Now if the script fails to execute with a error message, it'll let you know.
Your answer
Follow this Question
Related Questions
How to change a button image with script? 1 Answer
UI button class 1 Answer
How do you change pressed sprite (C#) 1 Answer
How To input text from a button? 1 Answer
Next and Back Button? 0 Answers