Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Ello, i'm new to unity but I keep getting this error in my script?

$
0
0
using UnityEngine; using System.Collections; public class character : MonoBehaviour { //movement variables public float maxspeed; Rigidbody2D myRB; Animator myAnim; bool facingRight // Use this for initialization void Start () { myRB = GetComponent (); myAnim = GetComponent (); facingRight = true; } // Update is called once per frame void FixedUpdate () { float move = Input.GetAxis ("Horizontal"); myAnim.SetFloat ("speed", Mathf.Abs (move)); myRB.velocity = new Vector2 (move * maxspeed, myRB.velocity.y); if (move < 0 && facingRight) { flip (); } else if (move < 0 && facingRight) { flip (); } } void flip() { facingRight = !facingRight; Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; } }

Viewing all articles
Browse latest Browse all 7934


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>