I am getting this error error CS0246: The type or namespace name LinkedList1’ could not be found. Are you missing a using directive or an assembly reference. I am making continuous road which is moving towards the player. I have searched it but none of the solution work.Please help me thanx.
using UnityEngine;
using System.Collections;
public class MoveScript : MonoBehaviour {
public Transform prefab;
public LinkedList<Transform> roads = new LinkedList<Transform>();
private float posY = 0.0f;
private int numberOfRoads = 3;
void Start()
{
for(int i=0;i<numberOfRoads>;i++)
{
Transform road = Instantiate(prefab) as Transform;
road.Translate(0, posY, i* road.localScale.z);
roads.AddLast(road);
}
}
void Update()
{
Transform firstRoad = roads.First.Value;
Transform lastRoad = roads.Last.Value;
if(firstRoad.localPosition.z < -5f)
{
roads.Remove(firstRoad);
Destroy(firstRoad.gameObject);
Transform newRoad = Instantiate(prefab, new Vector3(0,posY,lastRoad.localPosition.z + last.Road.localScale.z), Quaternion.identity)as Transform;
roads.AddLast(newRoad);
}
foreach(Transform road in roads){
road.Translate(0,0,-8f*Time.deltaTime);
}
}
}