- Home /
Question by
Deeo · Dec 07, 2012 at 12:26 AM ·
movinggameobject
Moving an object at different speeds
I'm trying to make an object move at randomized speeds. I get this erroer :
error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected
When trying to do that with this code: using UnityEngine; using System.Collections;
public class Star_Script : MonoBehaviour {
// Use this for initialization void Start () { } // Update is called once per frame void Update () { float Speed = Random Time.deltaTime; transform.Translate(Vector3.right Speed); } }
any ideas?
Comment
Answer by konashadow · Dec 07, 2012 at 01:51 AM
Instead of using Random * Time.deltaTime, try assigning Speed a Random.Range and use Time.deltaTime with the transform.