“Assets/Scripts/PlayerController.cs(16,13): error CS1061: and no extension method velocity' of type UnityEngine.Component’ could be found. Are you missing an assembly reference?” is the error I’m getting. How do I give my game an extension method? I’m at about 7 minutes in this tutorial. I’m thinking that giving my game the extension method ‘velocity’ will make my game run…
Maybe I’m (also(?)) in need of an assembly reference?
I’m really shooting in the dark here…
The tutorial is using the outdated “rigidbody” shortcut keyword, which you can replace with a Rigidbody2D variable reference that you assign via the inspector, or using GetComponent().
Unity is telling me
“error CS0103: The name ‘RigidBody2d’ does not exist in the current context”.
Could you please write me an acceptable example that Unity likes?
public class Example : MonoBehaviour
{
private Rigidbody2D rigidbodyComponent;
private void Awake()
{
rigidbodyComponent = GetComponent<Rigidbody2D>();
}
private void FixedUpdate()
{
rigidbodyComponent.velocity = Vector3.zero;
}
}
Severity Code Description Project File Line Suppression State
Error CS0117 ‘Rigidbody’ does not contain a definition for ‘Velocity’ Assembly-CSharp D:\study\New folder\Pixel Move - 2\Assets\Script\Playercontroller.cs 31 Active
Assets\scripts\player.cs(26,12): error CS1061: ‘Rigidbody2D’ does not contain a definition for ‘velicity’ and no accessible extension method ‘velicity’ accepting a first argument of type ‘Rigidbody2D’ could be found (are you missing a using directive or an assembly reference?)
Please, start your own threads. Let’s not pile multiple separate things into another thread.
The answer here is that Rigidbody2D doesn’t have a “velicity” property as it clearly says. It seems you don’t know about the API reference so I’ll leave a link here and you can look it up: Rigidbody2D.
Assets\Scripts\MovePlayer.cs(18,9): error CS1061: ‘Rigidbody’ does not contain a definition for ‘velosity’ and no accessible extension method ‘velosity’ accepting a first argument of type ‘Rigidbody’ could be found (are you missing a using directive or an assembly reference?)
please help fix this error
So you didn’t read my post above then I guess. 
1 Like