My simple move script is not working.
its a very simple movement script using force to move but im getting these error.
Assets/water/swim.cs(16,60): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
using UnityEngine;
using System.Collections;
public class swim : MonoBehaviour {
public Vector2 jump = new Vector2(0,200); public Rigidbody2D rb;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyUp("space")) { Vector2.zero; rb.AddForce(jump); }
}
}
Comment
Answer by Cynikal · Nov 03, 2016 at 02:37 PM
You have:
Vector2.zero;... That's not assigned to ANYTHING.
You'll need to: transform.position = Vector2.zero... or whatever you're trying to zero out.
Your answer
Follow this Question
Related Questions
Top Down 2D, facing direction bools 0 Answers
2D Top-Down Shooter Glitch With Camera Focus 0 Answers
I use prefabs in prefabs and when I correct the root prefab of child prefabs, items don't correct. 0 Answers
2D Mobile: How to mask a gameObject with another gameObject (with soft edges) 0 Answers
Walking around a sprite 1 Answer