N
N
NoobNoob22021-08-15 20:39:19
C++ / C#
NoobNoob2, 2021-08-15 20:39:19

Invalid token return and also invalid token; what to do?

I wrote one of the movement codes and here it is:
6119512654e4d349791606.png
here is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class BaseState : MonoBehaviour
{

    protected BaseMotor motor;

    #region baseState implementation


    public virtual void Construct()
    {
        motor = GetComponent<BaseMotor>();
    }

    public virtual void Destruct()
    {
        Destroy(this);

    }

    public virtual void Transition()
    {


    }


    #endregion

    public abstract Vector3 ProcessMotion(Vector3 input);
    public abstract Quaternion ProcessRotation(Vector3 input);
    
      return transform.rotation;
    
}

What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-08-15
@NoobNoob2

1. Shelve Unity
2. Install Visual Studio Community
3. Learn C# until error messages become clear.
4. Get the unit off the shelf
5. Set up the unit so that you can write code in the studio, and not in a notepad or built-in editor.
Delete the line that says
return transform.rotation;
It shouldn't be there.
return can only be written inside methods

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question