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

UnityEngine.component.rigidbody2d.AddForce(UnityEngine.Vector2) is a 'method' but is used like a 'type'

$
0
0
Hi, I'm still very new to Unity and C# in general, so bear with me. I am following [this](https://unity3d.com/learn/tutorials/topics/2d-game-creation/top-down-2d-game-basics) tutorial I found on the Unity site, and I know it's a little outdated. I tried the code it told me to, but I get UnityEngine.component.rigidbody2d.AddForce(UnityEngine.Vector2) is a 'method' but is used like a 'type'. I have no idea how to fix this. Here's the code: public float speed; void FixedUpdate() { var mousePosition = Camera.main.ScreenToWorldPoint (Input.mousePosition); Quaternion rot = Quaternion.LookRotation (transform.position - mousePosition, Vector3.forward); transform.rotation = rot; transform.eulerAngles = new Vector3 (0, 0, transform.eulerAngles.z); float input = Input.GetAxis ("Vertical"); GetComponent(gameObject.transform.up * speed * input); } What am I doing wrong? Thanks in advance.

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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