Okay, I have a single line of code that isn’t working.
using UnityEngine;
public class Obstacle : MonoBehaviour
{
public Vector2 velocity = new Vector2(-4, 0);
public float range = 4;
void Start()
{
GetComponent<Rigidbody2D>().velocity = velocity;
Transform.position = new Vector3(transform.position.x, transform.position.y - range * Random.value, transform.position.z);
}
}
Transform.position = new Vector3(transform.position.x, transform.position.y - range * Random.value, transform.position.z);
Causes an error of
An object reference for the non-static field, method, or property UnityEngine.Transform.position.get
I fixed like 5 other errors in this code and this is the one I can’t figure out.
Thanks for your help!