Search code examples
c#unity-game-engineoverridingmonodevelop

Error CS1585: Member modifier 'public' must precede the member type and name


Guys I was working on Unity3D's MonoDevelop. I was implementing my classes however I got an error I cannot figure out what is. The problem I get is in the title at the line where I override the abstract methods proceed and isFinished. What is the problem?

namespace tool
{

    public class TaskManager
    {
        public TaskManager ()
        {
        }
    }

    public abstract class Task {
        public bool isEvitable = true;
        public abstract void proceed();
        public abstract bool isFinished();
    }

    public class MoveTask : Task {
        float speed;
        Vector3 targetPosition;
        GameObject movingObject;

        private MoveTask(GameObject gameObject, float speed, Vector3 target) {
            this.movingObject = gameObject;
            this.speed = speed;
            this.targetPosition = target;
        }

        @override
        public void proceed() {
            Vector3 objPos = movingObject.transform.position;
            movingObject.transform.position = new Vector3 (Mathf.Lerp(objPos.x, targetPosition.x, speed),
                                                           Mathf.Lerp(objPos.y, targetPosition.y, speed),
                                                           Mathf.Lerp(objPos.z, targetPosition.z, speed));
        }

        @override
        public bool isFinished() {
        }

    }

}

Solution

  • try this. yours is java syntax.

    public override void proceed(){
    }
    
    public override bool isFinished(){
        return false;
    }