I am not getting where i got wrong please solve this please. Assets\Scripts\Pipes.cs(8,31): error CS0501: 'Pipes.Pipe()' must declare a body because it is not marked abstract, extern, or partial This is the I am getting. The script is below using System.Collections; using System.Collections.Generic; using UnityEngine; public class Pipes : MonoBehaviour { public float shiftSpeed = 1; private static void Pipes.Pipe(); Transform selfTransform; // Start is called before the first frame update void Start() { selfTransform = transform; } // Update is called once per frame void Update() { Pipes.transform.position += Vector3.left * shiftSpeed * Time.deltaTime; } }
Should be. Code (CSharp): private static void Pipe() { } Methods unless they are declared as abstract must have a body which is basically { }.
After doing that I got another error Assets\Scripts\Piipe.cs(22,1): error CS0120: An object reference is required for the non-static field, method, or property 'Component.transform'
In Update you are trying to access a non static field through a static accessor. Change Update to this. Code (CSharp): void Update() { transform.position += Vector3.left * shiftSpeed * Time.deltaTime; }