This question was
closed Nov 26, 2016 at 10:43 PM by
Nova-1504 for the following reason:
The question is answered, right answer was accepted
Question by
Nova-1504 · Nov 22, 2016 at 10:30 PM ·
inputplayermovefixedupdate
Error CS12526, help!
I'm using this script:
using UnityEngine;
using System.Collections;
public class PlayerControl : MonoBehaviour {
public float maxSpeed = 10f;
bool facingLeft = true;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate ()
{
float move = Input.GetAxis("Horizontal");
rigidbody2d.velocity = new Vector2 (move * maxSpeed, rigidbody2d.veocity.y
if(move > 0 && !facingLeft)
Flip ();
else if(move < 0 && facingLeft)
Flip ();
}
void Flip()
{
facingLeft = !facingLeft;
Vector3 = transform.localScale;
theScale.x * = -1;
transform.localScale = theScale
}
}
And I get CS1526 at 21, 26: needs () or [] or something like that. Help!
Comment
Best Answer
Answer by Sergio7888 · Nov 22, 2016 at 10:41 PM
Line 19 you don't closed Vector2 constructor. Just put a );
on the end of the line.
It's something to do with the if/else if chunk of code.
Follow this Question
Related Questions
Should I have a player input class with events or input detection for everything that requires it? 0 Answers
Separate Input from Touch on GUI 0 Answers
How to specify forward direction for my character? 0 Answers
How to handle FixedUpdate() and Input 0 Answers
When friction on physic material 2d is at 0 my player slide 0 Answers