just need help with a code

:hushed:

using UnityEngine;
using System.Collections;

public class NewBehaviourScript2 : MonoBehaviour
{
    float Horizontal1;
    float Vertical1;
    float Horizontal2;
    float Vertical2;
    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

        float inputHorizontal1 = Input.GetAxis("Horizontal");
        float inputVertical1 = Input.GetAxis("Vertical");
        Horizontal2 = Horizontal1 + inputHorizontal1;
        Vertical2 = Vertical1 + inputVertical1;
        Horizontal1 = Horizontal2 / 2.0f;
        Vertical1 = Vertical2it / 2.0f;

        print(Horizontal1);
        print(Vertical1);
        //Left
        if (inputHorizontal1 < 0)
            {

            }
            //Down
            if (inputVertical1 < 0)
            {

            }
            //Right
            if (inputHorizontal1 > 0)
            {

            }
            //Up
            if (inputVertical1 > 0)
            {

            }

            transform.Translate(Horizontal1, 0, Vertical1);
       

    }
}

It does not print my debug message and it does not move my character. :frowning:

Is this script attached to a game object and one that actually has some thing being drawn to the screen?
I assume the answer is yes. If so, then I don’t know why you aren’t seeing the print messages. I usually use Debug.Log(string) myself.

As far as moving your character, i’m pretty sure it is. Horizontal1 and Vertical1 are always going to be between -1 and +1, so your constantly moving your character a very tiny amount that you probably aren’t noticing. try this

float moveSpeed = 10f;  // put this up top with your variables

// in the update function change the Translate to this:
transform.Translate(Horizontal1*moveSpeed,0,Vertical1*moveSpeed);

Also just to point out this code basically does nothing:

float inputHorizontal1 = Input.GetAxis("Horizontal");
float inputVertical1 = Input.GetAxis("Vertical");
Horizontal2 = Horizontal1 + inputHorizontal1;
Vertical2 = Vertical1 + inputVertical1;
Horizontal1 = Horizontal2 / 2.0f;
Vertical1 = Vertical2it / 2.0f;

Horitzonta1 and Vertical1 will alawys just equal inputHorizontl1 and inputVertical1. You double them, then divide them by 2. which is basically the same thing as doing nothing.

Also note that update doesn’t run on inactive objects.