Author Topic: How do i change player speed?  (Read 1294 times)


  • Playmaker Newbie
  • *
  • Posts: 20
    • View Profile
How do i change player speed?
« on: June 27, 2017, 06:18:16 AM »
Hello guys,
I just bought Playmaker and this is my first message here.

For my 3D project, I am using Unity 4's First person control prefab in the standard assets for mobile.

I want to add a 2d button that will toggle "Run" on and off. I am not sure how to.
For example my speed is 16 at the moment. When the user clicks on the button, the character should start moving at like 30 and when he clicks again, it will return back to 16.

I am not sure how to do it. Help appreciated!

Thanks in advance..


  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
    • View Profile
Re: How do i change player speed?
« Reply #1 on: June 27, 2017, 06:28:36 AM »
Hi there

You need to use the on button click event action, if you don't have it download eco system and get it from there.

Then you get that speed variable and set it to desired value.

You can have 4 states, one with button event, and then if button is clicked it goes to state 2 and sets the value to run like 30, then you setup another state with button event again, if button is clicked go to first state, then at the top of the first state you can put default value like 16.


  • Playmaker Newbie
  • *
  • Posts: 20
    • View Profile
Re: How do i change player speed?
« Reply #2 on: July 03, 2017, 01:35:09 PM »
Thanks a lot.


  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Re: How do i change player speed?
« Reply #3 on: October 11, 2017, 08:16:44 PM »
Hey. I just found this while searching for a way to control the values in the Unity first person controller. In case other people find this thread for that reason, I just wanted to add the solution I figured out:
Go into the first person script FirstPersonController.cs and change the [SerializeField] variables that are declared as "private" to public. So it should then look like:

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

I left a few things private that I don't intend on using, but there you go.

You can then control the public values by using Set Property in PlayMaker and dragging that script from the gameobject into the Set Property object field.

I used this to add areas where my player's speed is decreased while within a collider.