make a cube jump between platforms? C#

hi guys,

on a very basic level, how can I make a cube object jump between two floating platforms using the left, right and space key for jump?

I’m using C#

Are there any good tutorials that are not overly complicated?

thanks all :slight_smile:

public float JumpHeight;

void Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
rigidbody.AddForce(transform.up * JumpHeight);
}
}

make sure that your cube has a rigidbody component

Thank you so much guys! You are both so wonderful! I used the above code Rezki at it works a treat! I was going about it all wrong :confused:

This is not the place to learn C# Programming or Unity. This is for technical issues and complications. There are a lot of tutorials out there. Start here:Unity C# Beginner Tutorial - The User Interface (Part 01) - YouTube