I’m trying to create a playerController.cs file but I get errors when I paste it in (NOTE: THIS IS NOT MY CODE, I OWN NONE OF IT!)
Assets/Scripts/playerController.cs(6,14): error CS0116: A namespace can only contain types and namespace declarations
Assets/Scripts/playerController.cs(8,10): error CS0116: A namespace can only contain types and namespace declarations
Assets/Scripts/playerController.cs(10,10): error CS0116: A namespace can only contain types and namespace declarations
Assets/Scripts/playerController.cs(17,10): error CS0116: A namespace can only contain types and namespace declarations
This is my code:
using UnityEngine;
using System.Collections;
public class playerControlle : MonoBehaviour{ private Animator animator;
void Start(){
animator = this.GetComponent<Animator>();}
void Update(){
var vertical = Input.GetAxis ("Vertical");
var horizontal = Input.GetAxis ("Horizontal");
if (vertical > 0){
animator.SetInteger("Direction", 1);}
else if (vertical < 0){
animator.SetInteger("Direction", 3);}
else if (horizontal > 0){
animator.SetInteger("Direction", 2);}
else if (horizontal < 0){
animator.SetInteger("Direction", 4);
}}