jtcc34
January 3, 2013, 12:06am
1
I am making a movement script and is giving me errors here is what I am working with
using UnityEngine;
using System.Collections;
public class PlayerMove : MonoBehaviour {
void Start () {
}
void Update () {
transform.Translate(0,0,Input.GetAxis("forward")*30* Time.deltaTime);
transform.Rotate(0,Input.GetAxis("rotate")*30*Time.deltaTime,0);
}
void AddNumbers(int x,int y)
{
return x+y;
}
}
I also need to make it play my walk cycle any help would be great?
jtcc34
January 3, 2013, 1:36am
2
this is the error I am getting PlayerMove.AddNumbers(int, int)': A return keyword must not be followed by any expression when method returns void and this one too Cannot implicitly convert type int’ to `void’
void AddNumbers(int x,int y) {
return x+y;
}
You have AddNumbers declared as a void function, meaning it returns nothing, but then you are trying to return a int value.
Change void to int
jtcc34
January 3, 2013, 2:09am
4
thank alot for your help,now what about my walk cycle I need it to play when my player moves?