Help needed with 2D Player Constant movement

Hi, I’m trying to make a 2D Platformer game and I’m stuck with this problem.

I’ve check with the source code of many 2D Platformer games but still my problem is unresolved even after 15 days. I decided to ask it here, I hope you guys will help a bit.

The Problem:

How can I move a 2D Player in X-axis in constant speed irrespective upward slope and downward slope? When the player approaches upward slope his speed decreases on X-axis, and when he approaches downward slope his speed increases on X-axis. I tried many things but it doesn’t help.

Here is the inspector view of the player:

Here is the code: (Any Help?)

using UnityEngine;
using System.Collections;

public class PlayerControllerScript : MonoBehaviour {

	public Transform groundCheck;
	bool grounded = false;
	float groundRadius = 0.1f;
	public LayerMask whatIsGround;
	float GetAxis;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	//	float move = Input.GetAxis ("Horizontal");
		GetAxis = Input.GetAxisRaw("Horizontal");
		rigidbody2D.gravityScale = GetAxis == 0 ? 0f : 2f;
		rigidbody2D.velocity = new Vector2 (1 * 3, rigidbody2D.velocity.y);

		//	transform.position = transform.forward * 10;
	}

	void FixedUpdate()
	{
		grounded = Physics2D.OverlapCircle (groundCheck.position, groundRadius, whatIsGround);

		if(grounded)
		{
			//Physics2D.gravity = new Vector3(0, 0, 0);
			print ("gravity is zero");
		}


	}
}

If your goal is to move at the same x-speed even if you’re approaching an upward/downward slope my first approach would be changing the 2Dmaterial of the slope, and setting it’s friction to 0 instead of 0.4(default from unity)
To do this, you need to first create a new Physics2D material (Assets/create/physics2Dmaterial) set the material friction to 0 and then pass it to the “Material” parameter of your 2D box Collider.

As soon as you’ll do this, you should notice that on an upward slope, if the character is not moving (getAxisRaw == 0) gravity will make you fall back a little time by time. To avoid this set the gravityScale to be zero at each update if getAxisRaw is zero

float GetAxis;

void Update () 
    {
        GetAxis = Input.GetAxisRaw("Horizontal");
        rigidbody2D.gravityScale = GetAxis == 0 ? 0f : 1f;
        //If getAxis is zero, gravity scale is set to 0 elseway 
        //gravity will be set to 1
    }

Okay… Forget the problem. I bought a unity plugin which solves all of my problems with 2D player controller. Thanks