UnityEngineComponent Velocity Error How do I fix it?

UnityEngineComponent Velocity Error How do I fix it?



I am very new to unity and I am getting this error.

I really have no clue what to do to fix it so I hope someone can help me.



UnityEngine.Component' does not contain a definition for velocity' and no extension methodvelocity' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?'


velocity' and no extension method


using UnityEngine;

namespace UnitySampleAssets._2D

public class PlatformerCharacter2D : MonoBehaviour

private bool facingRight = true; // For determining which way the player is currently facing.

[SerializeField] private float maxSpeed = 10f; // The fastest the player can travel in the x axis.
[SerializeField] private float jumpForce = 400f; // Amount of force added when the player jumps.

[Range(0, 1)] [SerializeField] private float crouchSpeed = .36f;
// Amount of maxSpeed applied to crouching movement. 1 = 100%

[SerializeField] private bool airControl = false; // Whether or not a player can steer while jumping;
[SerializeField] private LayerMask whatIsGround; // A mask determining what is ground to the character

private Transform groundCheck; // A position marking where to check if the player is grounded.
private float groundedRadius = .2f; // Radius of the overlap circle to determine if grounded
private bool grounded = false; // Whether or not the player is grounded.
private Transform ceilingCheck; // A position marking where to check for ceilings
private float ceilingRadius = .01f; // Radius of the overlap circle to determine if the player can stand up
private Animator anim; // Reference to the player's animator component.


private void Awake()

// Setting up references.
groundCheck = transform.Find("GroundCheck");
ceilingCheck = transform.Find("CeilingCheck");
anim = GetComponent<Animator>();



private void FixedUpdate()

// The player is grounded if a circlecast to the groundcheck position hits anything designated as ground
grounded = Physics2D.OverlapCircle(groundCheck.position, groundedRadius, whatIsGround);
anim.SetBool("Ground", grounded);

// Set the vertical animation
anim.SetFloat("vSpeed", rigidbody2D.velocity.y);



public void Move(float move, bool crouch, bool jump)



// If crouching, check to see if the character can stand up
if (!crouch && anim.GetBool("Crouch"))

// If the character has a ceiling preventing them from standing up, keep them crouching
if (Physics2D.OverlapCircle(ceilingCheck.position, ceilingRadius, whatIsGround))
crouch = true;


// Set whether or not the character is crouching in the animator
anim.SetBool("Crouch", crouch);

//only control the player if grounded or airControl is turned on
if (grounded


private void Flip()

// Switch the way the player is labelled as facing.
facingRight = !facingRight;

// Multiply the player's x local scale by -1.
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;




}






Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)