Quantcast
Viewing all articles
Browse latest Browse all 2891

Rigidbody2D just doesnt work :|

I was trying to make a atari breakout style game for fun but I got this while doing the script for the ball I encountered and error that confused me so much the exact error is: "error CS0119: 'Rigidbody2D' is a type, which is not valid in the given context" I am really new to unity and c# so I dont know what to do. I tried searching it up but didnt find a answer. using System.Collections; using System.Collections.Generic; using UnityEngine; public class BallScript : MonoBehaviour { public float speed, multipler, constatspeed; public Transform startPoint; private Rigidbody2D myBody; private bool canMove; void Awake() { myBody = GetComponent(Rigidbody2D); print("Awake Function"); } void Start() { print("Start Function"); } void Update() { } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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