I have a Rectangle variable and when i click on it using
if(Gdx.input.isButtonPressed(Input.Buttons.LEFT)){"Dont know what to do here"}
I want to recognize that rectangle and do something on it. How can I do that?
You are checking if mouse button is pressed and trying to search the rectangle it hit.
Libgdx already does that for you in scene2d.
You can create a Button instead of that rectangle and use a ClickListener on it in stead.
Reference:
How to create a button in Libgdx?
Hope this helps.
Good luck.