![alt text][1]hi there im trying to generate a floor for my level in a checkered pattern that is expandable by setting the columns and rows that are needed but im getting two errors :
error CS1502: The best overloaded method match for `UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)' has some invalid arguments
and :
error CS1503: Argument `#2' cannot convert `System.Collections.Generic.List' expression to type `UnityEngine.Vector3'
at lines 38,41,47 and 50 of the following:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class floor : MonoBehaviour
{
public GameObject greytile;
public GameObject blacktile;
public int colunms;
public int rows;
public Transform floorholder;
private List gridpos = new List ();
void Start ()
{
initializelist ();
makefloor ();
}
void initializelist ()
{
gridpos.Clear ();
for (int x = 0; x < colunms; x++) {
for (int z = 0; z < rows; z++) {
gridpos.Add (new Vector3 (x, 0, z));
}
}
}
void makefloor ()
{
for (int x = 0; x < colunms; x++) {
for (int z = 0; z < rows; z++) {
if (x % 2 == 0) {
Instantiate (greytile, new Vector3(x,0,z), Quaternion.identity);
} else {
Instantiate (blacktile,new Vector3(x,0,z), Quaternion.identity);
}
}
}
}
}
could someone please tell what im doing wrong and what to change,thank you in advance, P.s im am aware that columns is spelled wrong in the code i will fix that p.p.s i also know about the dot in the first part of makefloor and it hase been changed on my end
this is what it looks like after the changes
http://imageshack.com/a/img905/6392/DkT55T.png
↧