I've been knocking errors out of my script after working thoroughly through them but this one has me stumped, even though I'm sure it's something really simple. This is the following error that I'm getting:

Assets\Scripts\Movement_Scripts\FirstPersonCharacter\Scripts\FirstPersonController.cs(44,9): error CS1585: Member modifier 'private' must precede the member type and name

From my script:

using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
using UnityStandardAssets.Utility;
using Random = UnityEngine.Random;
using MouseLook = UnityEngine.MouseLook;

public class FirstPersonController : MonoBehaviour
    [SerializeField] private bool m_IsWalking;
    [SerializeField] private float m_WalkSpeed;
    [SerializeField] private float m_RunSpeed;
    [SerializeField] [Range(0f, 1f)] private float m_RunstepLenghten;
    [SerializeField] private float m_JumpSpeed;
    [SerializeField] private float m_StickToGroundForce;
    [SerializeField] private float m_GravityMultiplier;
    [SerializeField] private MouseLook m_MouseLook;
    [SerializeField] private bool m_UseFovKick;
    [SerializeField] private FOVKick m_FovKick = new FOVKick();
    [SerializeField] private bool m_UseHeadBob;
    [SerializeField] private CurveControlledBob m_HeadBob = new CurveControlledBob();
    [SerializeField] private LerpControlledBob m_JumpBob = new LerpControlledBob();
    [SerializeField] private float m_StepInterval;
    [SerializeField] private AudioClip[] m_FootstepSounds;    // an array of footstep sounds that will be randomly selected from.
    [SerializeField] private AudioClip m_JumpSound;           // the sound played when character leaves the ground.
    [SerializeField] private AudioClip m_LandSound;           // the sound played when character touches back on ground.

    private Camera m_Camera;
    private bool m_Jump;
    private float m_YRotation;
    private Vector2 m_Input;
    private Vector3 m_MoveDir = Vector3.zero;
    private CharacterController m_CharacterController;
    private CollisionFlags m_CollisionFlags;
    private bool m_PreviouslyGrounded;
    private Vector3 m_OriginalCameraPosition;
    private float m_StepCycle;
    private float m_NextStep;
    private bool m_Jumping;
    private AudioSource m_AudioSource;
    readonly AudioSource AudioSource;
    public UnityStandardAssets.Characters.FirstPerson.MouseLook

    // Use this for initialization 
    private void Start()   /* This is line 44 */
        m_CharacterController = GetComponent<CharacterController>();
        m_Camera = Camera.main;
        m_OriginalCameraPosition = m_Camera.transform.localPosition;
        m_HeadBob.Setup(m_Camera, m_StepInterval);
        m_StepCycle = 0f;
        m_NextStep = m_StepCycle / 2f;
        m_Jumping = false;
        m_AudioSource = GetComponent<AudioSource>();
        m_MouseLook.Init(transform, m_Camera.transform);

    // Update is called once per frame
    private void Update()
        // the jump state needs to read here to make sure it is not missed
        if (!m_Jump)
            m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");

        if (!m_PreviouslyGrounded && m_CharacterController.isGrounded)
            m_MoveDir.y = 0f;
            m_Jumping = false;
        if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded)
            m_MoveDir.y = 0f;

        m_PreviouslyGrounded = m_CharacterController.isGrounded;


Now I know the problem is private void Start() on line 44, and from everything I've read, it's in the wrong place (to make sure, I changed it to public void, then just left it as void, both resulting in errors) however I'm stumped as to where I should move Private Void too.

I appreciate any and all advice on this.

  • 1
    \$\begingroup\$ I bet it has to do with that public UnityStandardAssets.Characters.FirstPerson.MouseLook. What is that? Is it a function or a variable? \$\endgroup\$
    – Casanova
    Commented Nov 17, 2019 at 12:59
  • \$\begingroup\$ @Casanova It was the issue, a friend helped me out and we found by commenting that line out, it resolved the issues :) I came back to add that but everyone's spotted the problem so quickly! \$\endgroup\$ Commented Nov 21, 2019 at 13:32

1 Answer 1


As Casanova says, it looks like your problem is here:

public UnityStandardAssets.Characters.FirstPerson.MouseLook

// Use this for initialization 
private void Start()

Note that you didn't finish writing the declaration of your MouseLook field, or end the line with a semicolon. So the parser figures the declaration must continue on one of the subsequent lines. It keeps reading on, ignoring white space and comments, until it has a complete declaration. In its reading, it thinks you're trying to say this:

public UnityStandardAssets...MouseLook private void Start() { ...

...which is gibberish. This is not a valid declaration in C#, so it fails to parse and tells you the first thing it found that was wrong with the declaration, which is that you have private after the type, when modifiers like this need to go before the type. That's true, but in context, the real fix is this:

public UnityStandardAssets.Characters.FirstPerson.MouseLook giveThisVariableAName;

// Use this for initialization
public void Start()

Now there's a complete declaration for the parser to find:

public      UnityStandardAssets...MouseLook    giveThisVariableAName  ;
 ^ Modifier   ^ Type                            ^ Identifier          ^ End of Line

So it parses the Start declaration as its own separate statement, rather than trying to interpret it as a continuation of the line above.

This is a basic programming syntax error that doesn't require game-specific expertise to solve, so you should always check our general programming sister site StackOverflow for topics like this. Often you'll find them answered already, sometimes several times over.

  • \$\begingroup\$ Also, you may want to modify readonly AudioSource AudioSource; to readonly AudioSource audioSource; Creating a variable that is named identically to the class it's typed as is... not really a good plan. \$\endgroup\$ Commented Nov 17, 2019 at 18:00
  • 1
    \$\begingroup\$ Looks like that line might be an unintentional duplicate of the private AudioSource m_AudioSource; on the line above, since this second variable seems to never be assigned to. \$\endgroup\$
    – DMGregory
    Commented Nov 17, 2019 at 18:06
  • \$\begingroup\$ @DMGregory A friend of mine (A far more experienced Indie than me) helped out and we found that by commenting out lines 5 and 45, seemed to remove these issues. i came back to add that in an answer, but everyone has absolutely nailed this question, it's amazing! I'm just bummed I haven't had a chance to be able to check in until now :( \$\endgroup\$ Commented Nov 21, 2019 at 13:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .