All you need is to replace “Rigidbody2D.velocity.y = speed;” to GetComponent.Rigidbody2D().velocity.y = speed; (Add “>” before and after Rigidbody2D)
i dont know were to add these “>” braces. but when i don’t add these braces i get an error as “rigidbody2D is not a member of function(system.type): unityengine.component.
please give me the correct code.!