- Home /
 
 
               Question by 
               Lyray · Feb 23, 2021 at 11:52 PM · 
                error messagenot working  
              
 
              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()
     {
         
     }
 }
 
 
              
               Comment
              
 
               
              Answer by nursedayuksel · Feb 24, 2021 at 12:24 AM
GetComponent<RigidBody2D>(), Not GetComponent(RigidBody2D) 
Your answer