- Home /
Question by
MISIKE · Jun 11, 2013 at 10:34 PM ·
gameobjectunexpected
What do I get this error message for?Unexpected symbol gameObject
This code is assigned to a cube.
using UnityEngine;
using System.Collections;
public class RotateScript: MonoBehaviour
{
private Transform fromr;
private Transform to;
private float rotationSpeed;
// Use this for initialization
void Start()
{
fromr.rotation = Quaternion.identity;
to.rotation = Quaternion.Euler( new Vector3(0, 0, 90));
rotationSpeed = 10f;
}
// Update is called once per frame
void Update()
{
if(Input.GetKey(KeyCode.A)
gameObject.transform.rotation = Quaternion.Slerp(fromr.rotation, to.rotation, rotationSpeed);
}
}
Comment
Answer by robertbu · Jun 11, 2013 at 10:41 PM
You are missing a closing ')' on line 22. It should be:
if(Input.GetKey(KeyCode.A))
Note that the the error triggering an error message is often on the line above the one that is highlighted.
Your answer
Follow this Question
Related Questions
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
Unexpected symbol, "Projectile" while attempting to delete gameObject.Projectile 1 Answer
Is there any way to convert Collision to a Gameobject or Transform? 1 Answer
How can i check if GO collided with collider starting with name (string) 1 Answer