Hi!
I’m new to Unity, and I just got two errors that I don’t really understand.
The console in Unity gives me two red errors saying:
I’m not exactly sure what I’m doing wrong.
The game still runs and nothing seems wrong there, but I don’t want to continue before that error is fixed.
I only have one script in the game so far, which is this:
using UnityEngine;
using System.Collections;
public class Controller : MonoBehaviour
{
public GameObject grassplot;
public GameObject trainstation;
private Vector3 movement;
private float horizontal;
private float vertical;
// Use this for initialization
void Start ()
{
GameObject plottedgrass;
for(int i = 0; i < 41; i++)
{
for(int j = 0; j < 41; j++)
{
plottedgrass = Instantiate (grassplot);
plottedgrass.transform.position = new Vector3 (i*2-40f, 0, j*2-40f);
}
}
GameObject plottedtrainstation;
plottedtrainstation = Instantiate (trainstation);
plottedtrainstation.transform.position = new Vector3 (32, 0, 2);
}
// Update is called once per frame
void Update ()
{
horizontal = Input.GetAxisRaw ("Horizontal");
vertical = Input.GetAxisRaw ("Vertical");
movement = new Vector3 (horizontal, 0, vertical);
transform.Translate(movement * 5f * Time.deltaTime,Space.World);
}
}
I hope someone can help me out
Thanks in advance!