I want to place six objects(ball) on scene. I think the code look workable but I receive a console message. The message :
"Assets/GameScripts/Instance.cs(26,40): error CS0266: Cannot implicitly convert type
object' to
UnityEngine.Vector3'. An explicit conversion exists (are you missing a cast?)"
using UnityEngine; using System.Collections;
public class Instance : MonoBehaviour { public GameObject ball;
public ArrayList coordinateContainer = new ArrayList();
// Use this for initialization
void Start () {
coordinateContainer.Add(new Vector3(1f,1f,1f));
coordinateContainer.Add(new Vector3(2f,1f,1f));
coordinateContainer.Add(new Vector3(3f,1f,1f));
coordinateContainer.Add(new Vector3(4f,1f,1f));
coordinateContainer.Add(new Vector3(5f,1f,1f));
coordinateContainer.Add(new Vector3(6f,1f,1f));
//ball.transform.position = new Vector3(1f,1f,1f);
ball.transform.rotation = Quaternion.identity;
for (int i = 0; i < 6; i++) {
ball.transform.position = coordinateContainer[i];
Instantiate(ball,ball.transform.position,ball.transform.rotation);
}
}
// Update is called once per frame
void Update () {
}
}