I seem to be having a silly issue and I’m very confused as to what could be the problem. I am using the “Single Joystick” prefab from the Standard Assets (Mobile) package to get input from the user. The joystick moves and will return a value for the movement.
function Update () {
intensity = GameObject.Find ("SingleJoystick").GetComponent(Joystick).position;
GameObject.Find ("SHIP").transform.Rotate(0,0,120*Time.deltaTime*direction.x);
atext.text = "Intensity: " + intensity.x;
}
The script is attached to the “PLAYER” node which is located at the top of the tree that contains the ship, camera, and some effects. The structure is as follows
PLAYER
Camera
SHIP
Burner
Burner_Effect
The problem is, for the first 10 seconds that the scene if active, the “atext” will properly output the intensity of the joystick move however the ship will not rotate. That being said, the ship WILL properly rotate after those first ten seconds, and the issue will not occur again until the scene is reloaded.
Perhaps an interesting piece of information is that in another scene with the same hierarchy (In which the “SHIP” node’s rotation is different than the “PLAYER” node for a turning effect on the camera) the parent “PLAYER” is able to be freely rotated, while once again the child “SHIP” cannot be rotated for the first ten seconds. In this instance after this 10 second delay has transpired the “SHIP” will rotate properly and correctly until the scene is reloaded.
I cannot for the life of me figure out where the delay is coming from…
EDIT: In attempting to diagnose the issue I added a node that the ship is attached to and instead of rotating the ship I rotate its parent so that the structure is now
PLAYER
Camera
ShipRoot
SHIP
Burner
Burner_Effect
And for some reason it now works perfectly and without delay??? I’m not sure why but I’m just glad it works?
How do I mark this answered?