I would like a game object to essentially spawn in with a random y value initially, I’m getting an error that states that it can’t “convert the double expression to type float.” None of my ideas of what’s going on have worked, and I can’t find the solution with the Scripting API. There’s probably a really obvious error, can anybody help?
using UnityEngine;
using System.Collections;
public class Upward : MonoBehaviour {
Vector3 velocity = Vector3.zero;
public Vector3 AntiGravity;
float RandomInt = Random.Range(-0.755f, 0.755f);
// Use this for initialization
void Start () {
transform.position = new Vector3(RandomInt,-3.4,-1.0);
}
// Update is called once per frame
void Update () {
if (transform.position.y <= 3.35) {
velocity -= AntiGravity * Time.deltaTime;
transform.position -= velocity * Time.deltaTime;
}
}
}