r/Unity3D – Telegram
r/Unity3D
264 subscribers
12.6K photos
15.6K videos
14 files
48K links
News about the Unity engine and project showcases from Reddit. Made possible with @reddit2telegram (@r_channels).
Download Telegram
First Look at Pao Pao: We're working on a game about cats who cook! Check out the visuals of the map so far and share your thoughts. Stay tuned for more updates and progress on our Discord: ArtDock! We’d love to hear your thoughts!
https://redd.it/1i0frku
@r_Unity3D
Make 2D Objects teleport

How do I make 2D Object that spawns, teleport within a Collider zone certain brief time gaps and stays within that Collider zone.

https://redd.it/1i0h1k7
@r_Unity3D
Tilemap Chunking video: free asset

This video demos and explains the new free Tilemap chunking system included in the free TilePlus Toolkit asset.

Lots more detail on the asset store page: fully supported and in active development. This system is free and will always remain so.

Asset Store link (FREE asset)

Chunking video (YT)

https://redd.it/1i0gecl
@r_Unity3D
My First Video for the 99% of Indie Games Club is Here! ❤️

Hey everyone,

Huge thanks to the mods for letting me post this, and I promise it’ll be my last one about this channel! 🙏

My first video for the 99% of Indie Games Club is finally live! 🎉 I did a review on Mighty Marbles, a physics-based puzzle game that’s both super fun and seriously rage-inducing. The dev shared some great insights into their process, and I had a blast putting the video together.

Check it out here: https://youtu.be/S7Tza4r\_CLo

I’d love to hear your thoughts—whether it’s about the video, the game, or even what I can improve. This channel’s all about showcasing the indie gems that deserve more love, and your feedback will help me make it better.

Thank you again for the support—over 100 subs before a single video was wild. You all are amazing. 💕

Hope you enjoy the video, and maybe discover a new favorite game along the way!

https://redd.it/1i0m5lv
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
We've been working on this RPG city builder for over 2 years, and today we've launched Airborne Empire into Early Access! We're so excited!

https://redd.it/1i0j6a3
@r_Unity3D
Transparency problem in background

https://preview.redd.it/elu3uo1ufvce1.png?width=1911&format=png&auto=webp&s=36b38e43c91e9bf7c5bf24ce2d11ab8cf777d905

Hi, im a noob in unity - im doing school project nad idk why the background is transparent? Can someone help me fix it? I really don't know anything about unity i was following a tutorial and the guy didn't have that problem. Any tips would be helpful :) And it's animated that's why it's sliced

https://redd.it/1i0vxbi
@r_Unity3D
Media is too big
VIEW IN TELEGRAM
2025 will be the year I release my first game! 😊

https://redd.it/1i0sh9k
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
Hey guys, I’ve been posting some of my shader work online for download. If you’re interested in this kind of shaders, you can acquire them on the link in the comments.

https://redd.it/1i105o2
@r_Unity3D
Acceleration And Deceleration Help

So I'm trying to make my controls bit smoother for my fast paced 2D platformer, so I'm trying to make it where when you start moving there is a small build up till you get to your normal move speed, and you take some time to slowdown before you come to a stop, help would be appreciated, apologies, I'm still fairly new to game development!

The Whole Player Script:

Header ("ControllerInput")
public InputActionReference move;
public InputActionReference jumpAction;
public InputActionReference crouchAction;
public InputActionReference spinAction;
public InputActionReference bombAction;
public InputActionReference brakeAction;
public InputActionReference groundPoundAction;
public InputActionReference danceAction;

Header ("Particles")
public ParticleSystem danceParticle;

Header("Floats And Bools")
public float moveSpeed = 5f;
public float jumpForce = 3f;
public float wallJumpForce = 2f;
public float shortJumpMultiplier = 0.5f;
public float decelerationFactor = 0.1f;
public float minSpeed = 0.1f;
public bool canJump;
public bool spin;
public bool dive;
public bool slam;
public bool slamCancel;
public bool canWallBounce;
public bool bumped;
public bool rolling;
public bool landAnimation;
public bool facingLeft;
public bool freeMove;
public bool walk;
public bool blasted;
public bool dance;
public bool wallWalk;
public bool ceilingAbove;
public bool canDash = true;
public bool isDashing;
public bool jumpCanceled;
public bool canDiveBomb;
public bool diveBombed;
public bool spinDive;

Header("Dash Speeds")
public bool dash1;
public bool dash2;
public bool dash3;
public bool dash4;

Header("Dash Timer")
public float idleThreshold = 3f;
private float idleTime = 0f;

Header("Layers And Transforms")
public Transform groundCheck;
public Transform ceilingCheck;
public LayerMask groundLayer;
public LayerMask ceilingLayer;

Header("Private")
private Rigidbody2D playerRb;
private Animator playerAnim;
private Vector2 moveDirection;
private Vector2 lastDirection;
private bool isJumping;
private bool danceAir;
private float dashingTime = 0.25f;
SerializeField bool isBraking = false;
SerializeField bool crouching;
SerializeField Collider2D standingCollider;
SerializeField Collider2D crouchingCollider;
const float aboveCheckRadius = 0.2f;

void Start()
{
playerRb = GetComponent<Rigidbody2D>();
playerAnim = GetComponent<Animator>();

jumpAction.action.performed += JumpPerformed;
jumpAction.action.canceled += JumpCanceled;

crouchAction.action.performed += CrouchPerformed;
crouchAction.action.canceled += CrouchCanceled;

spinAction.action.performed += SpinPerformed;

brakeAction.action.performed += BrakePerformed;

groundPoundAction.action.performed += GroundPoundPerformed;

bombAction.action.performed += BombPerformed;

danceAction.action.performed += DancePerformed;
danceAction.action.canceled += DanceCanceled;
}

void OnDestroy()
{
// Unsubscribe to prevent memory leaks
jumpAction.action.performed -= JumpPerformed;
jumpAction.action.canceled -= JumpCanceled;

crouchAction.action.performed -= CrouchPerformed;
crouchAction.action.canceled -= CrouchCanceled;

spinAction.action.performed -= SpinPerformed;

brakeAction.action.performed
-= BrakePerformed;

groundPoundAction.action.performed -= GroundPoundPerformed;

bombAction.action.performed -= BombPerformed;

danceAction.action.performed -= DancePerformed;
danceAction.action.canceled -= DanceCanceled;
}

void Update()
{
if (isDashing)
{
return;
}

#region MOVEMENT/JUMPING ANIMATIONS
float smoothedVelocityX = Mathf.Lerp(playerAnim.GetFloat("xVelocity"), Mathf.Abs(playerRb.velocity.x), Time.deltaTime 150f);
playerAnim.SetFloat("xVelocity", smoothedVelocityX);

if (wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", true);
spin = false;
}
else if (!wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", false);
}

if (!dance && isGrounded())
{
playerAnim.SetBool("Dance", false);
}
else if (dance && isGrounded() && !dash1)
{
playerAnim.SetBool("Dance", true);
}

if (isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", true);
danceAir = false;
}
else if (!isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", false);
danceAir = true;
}

bool isJumping = playerRb.velocity.y > 0.1f;
bool isFalling = playerRb.velocity.y < -0.1f;

if (!slam)
{
playerAnim.SetBool("Jump", isJumping);
if (!jumpCanceled)
{
playerAnim.SetBool("Fall", isFalling);
}
}
#endregion

#region WALK/DASH MOVEMENT
Flip();

if (!dive && !isBraking && !rolling && !walk && !dash4)
{
moveDirection = move.action.ReadValue<Vector2>();
}

if (isGrounded())
{
canJump = true;
canWallBounce = true;
slamCancel = false;
canDash = true;
jumpCanceled = false;
diveBombed = false;
spinDive = false;
playerAnim.SetBool("Fall", false);
playerAnim.SetBool("SlamCancel", false);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("Grounded", true);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
StartCoroutine(SlamFallAnimationEnd());
}
else
{
canJump = false;
}

if (!isGrounded())
{
playerAnim.SetBool("Grounded", false);
}

if(isGrounded() && isDashing)
{
isDashing = false;
}

if (!bumped && !dash1 && !isBraking)
{
moveSpeed = 9;
}

if (moveDirection.x == 0f && isGrounded() && !dash4)
{
idleTime += Time.deltaTime;
}
else
{
idleTime = 0f;
}

if (idleTime >= idleThreshold
4 && dash1 && isGrounded() && !dash4 && !bumped)
{
dash1 = false;
}
else if (idleTime >= idleThreshold 3 && dash2 && isGrounded() && !dash4 && !bumped)
{
dash2 = false;
}
else if (idleTime >= idleThreshold
2 && dash3 && isGrounded() && !dash4 && !bumped)
{
dash3 = false;
}
#endregion

#region DASH 4 MOVEMENT
if (!dive && !isBraking && !rolling && !bumped)
{
moveDirection = move.action.ReadValue<Vector2>();

if (dash4 && !freeMove)
{
if (moveDirection != Vector2.zero)
{
lastDirection = moveDirection;
walk = true;
}
else
{
moveDirection = lastDirection;
walk = false;
}
}
else
{
walk = false;
}
}

if (!dash4)
{
playerRb.velocity = new Vector2(moveDirection.x moveSpeed, playerRb.velocity.y);
}
else
{
playerRb.velocity = new Vector2(moveDirection.x
moveSpeed, playerRb.velocity.y);
}

if(dash4 && isGrounded())
{
freeMove = false;
}
#endregion

#region BOMB SLAM
if (isGrounded() && slam && !slamCancel && dash4 && dash3 && dash2 && dash1 && !dance)
{
slam = false;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if(isGrounded() && slam && !slamCancel && dash3 && dash2 && dash1 && !dance)
{
slam = false;
dash4 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash2 && dash1 && !dance)
{
slam = false;
dash3 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash1 && !dance)
{
slam = false;
dash2 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && !dash1 && !dance)
{
slam = false;
dash1 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
#endregion

#region BRAKING/SPEED LOGIC
if (isBraking)
{
Dash1Deceleration();
}
else if (!isBraking)
{
if (dash4 && dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 21f;
}
else if (dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 18f;
}
else if (dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 15f;
}
else if (dash1 && !dive && !dance && !bumped)
{
moveSpeed = 12f;
}
else if (!dive &&
!dance && !bumped)
{
moveSpeed = 9;
}
}
#endregion
}

private void FixedUpdate()
{
Crouch(crouching);

if (dive && isGrounded())
{
DiveDeceleration();
}
}

#region CONTROLS
void Flip()
{
if (playerRb.velocity.x < 0 && !facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = true;
transform.Rotate(0f, 180f, 0f);
}
else if (playerRb.velocity.x > 0 && facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = false;
transform.Rotate(0f, 180f, 0f);
}
}

private void JumpPerformed(InputAction.CallbackContext context)
{

if (canJump && !crouching && isGrounded() && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, jumpForce);
}
else if(crouching && canJump && isGrounded() && playerRb.velocity.x == 0 && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, 8);
}

if (slam)
{
playerRb.velocity = new Vector2(0, 14);
playerRb.gravityScale = 3;
slam = false;
slamCancel = true;
freeMove = true;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamCancel", true);
}

#region DIVING
if (crouching && dash1 && dash2 && dash3 && dash4 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && dash3 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
}
#endregion
}

private void
Acceleration And Deceleration Help

So I'm trying to make my controls bit smoother for my fast paced 2D platformer, so I'm trying to make it where when you start moving there is a small build up till you get to your normal move speed, and you take some time to slowdown before you come to a stop, help would be appreciated, apologies, I'm still fairly new to game development!

The Whole Player Script:

[Header ("ControllerInput")]
public InputActionReference move;
public InputActionReference jumpAction;
public InputActionReference crouchAction;
public InputActionReference spinAction;
public InputActionReference bombAction;
public InputActionReference brakeAction;
public InputActionReference groundPoundAction;
public InputActionReference danceAction;

[Header ("Particles")]
public ParticleSystem danceParticle;

[Header("Floats And Bools")]
public float moveSpeed = 5f;
public float jumpForce = 3f;
public float wallJumpForce = 2f;
public float shortJumpMultiplier = 0.5f;
public float decelerationFactor = 0.1f;
public float minSpeed = 0.1f;
public bool canJump;
public bool spin;
public bool dive;
public bool slam;
public bool slamCancel;
public bool canWallBounce;
public bool bumped;
public bool rolling;
public bool landAnimation;
public bool facingLeft;
public bool freeMove;
public bool walk;
public bool blasted;
public bool dance;
public bool wallWalk;
public bool ceilingAbove;
public bool canDash = true;
public bool isDashing;
public bool jumpCanceled;
public bool canDiveBomb;
public bool diveBombed;
public bool spinDive;

[Header("Dash Speeds")]
public bool dash1;
public bool dash2;
public bool dash3;
public bool dash4;

[Header("Dash Timer")]
public float idleThreshold = 3f;
private float idleTime = 0f;

[Header("Layers And Transforms")]
public Transform groundCheck;
public Transform ceilingCheck;
public LayerMask groundLayer;
public LayerMask ceilingLayer;

[Header("Private")]
private Rigidbody2D playerRb;
private Animator playerAnim;
private Vector2 moveDirection;
private Vector2 lastDirection;
private bool isJumping;
private bool danceAir;
private float dashingTime = 0.25f;
[SerializeField] bool isBraking = false;
[SerializeField] bool crouching;
[SerializeField] Collider2D standingCollider;
[SerializeField] Collider2D crouchingCollider;
const float aboveCheckRadius = 0.2f;

void Start()
{
playerRb = GetComponent<Rigidbody2D>();
playerAnim = GetComponent<Animator>();

jumpAction.action.performed += JumpPerformed;
jumpAction.action.canceled += JumpCanceled;

crouchAction.action.performed += CrouchPerformed;
crouchAction.action.canceled += CrouchCanceled;

spinAction.action.performed += SpinPerformed;

brakeAction.action.performed += BrakePerformed;

groundPoundAction.action.performed += GroundPoundPerformed;

bombAction.action.performed += BombPerformed;

danceAction.action.performed += DancePerformed;
danceAction.action.canceled += DanceCanceled;
}

void OnDestroy()
{
// Unsubscribe to prevent memory leaks
jumpAction.action.performed -= JumpPerformed;
jumpAction.action.canceled -= JumpCanceled;

crouchAction.action.performed -= CrouchPerformed;
crouchAction.action.canceled -= CrouchCanceled;

spinAction.action.performed -= SpinPerformed;

brakeAction.action.performed
-= BrakePerformed;

groundPoundAction.action.performed -= GroundPoundPerformed;

bombAction.action.performed -= BombPerformed;

danceAction.action.performed -= DancePerformed;
danceAction.action.canceled -= DanceCanceled;
}

void Update()
{
if (isDashing)
{
return;
}

#region MOVEMENT/JUMPING ANIMATIONS
float smoothedVelocityX = Mathf.Lerp(playerAnim.GetFloat("xVelocity"), Mathf.Abs(playerRb.velocity.x), Time.deltaTime * 150f);
playerAnim.SetFloat("xVelocity", smoothedVelocityX);

if (wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", true);
spin = false;
}
else if (!wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", false);
}

if (!dance && isGrounded())
{
playerAnim.SetBool("Dance", false);
}
else if (dance && isGrounded() && !dash1)
{
playerAnim.SetBool("Dance", true);
}

if (isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", true);
danceAir = false;
}
else if (!isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", false);
danceAir = true;
}

bool isJumping = playerRb.velocity.y > 0.1f;
bool isFalling = playerRb.velocity.y < -0.1f;

if (!slam)
{
playerAnim.SetBool("Jump", isJumping);
if (!jumpCanceled)
{
playerAnim.SetBool("Fall", isFalling);
}
}
#endregion

#region WALK/DASH MOVEMENT
Flip();

if (!dive && !isBraking && !rolling && !walk && !dash4)
{
moveDirection = move.action.ReadValue<Vector2>();
}

if (isGrounded())
{
canJump = true;
canWallBounce = true;
slamCancel = false;
canDash = true;
jumpCanceled = false;
diveBombed = false;
spinDive = false;
playerAnim.SetBool("Fall", false);
playerAnim.SetBool("SlamCancel", false);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("Grounded", true);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
StartCoroutine(SlamFallAnimationEnd());
}
else
{
canJump = false;
}

if (!isGrounded())
{
playerAnim.SetBool("Grounded", false);
}

if(isGrounded() && isDashing)
{
isDashing = false;
}

if (!bumped && !dash1 && !isBraking)
{
moveSpeed = 9;
}

if (moveDirection.x == 0f && isGrounded() && !dash4)
{
idleTime += Time.deltaTime;
}
else
{
idleTime = 0f;
}

if (idleTime >= idleThreshold * 4 && dash1 && isGrounded() && !dash4 && !bumped)
{
dash1 = false;
}
else if (idleTime >= idleThreshold * 3 && dash2 && isGrounded() && !dash4 && !bumped)
{
dash2 = false;
}
else if (idleTime >= idleThreshold * 2 && dash3 && isGrounded() && !dash4 && !bumped)
{
dash3 = false;
}
#endregion

#region DASH 4 MOVEMENT
if (!dive && !isBraking && !rolling && !bumped)
{
moveDirection = move.action.ReadValue<Vector2>();

if (dash4 && !freeMove)
{
if (moveDirection != Vector2.zero)
{
lastDirection = moveDirection;
walk = true;
}
else
{
moveDirection = lastDirection;
walk = false;
}
}
else
{
walk = false;
}
}

if (!dash4)
{
playerRb.velocity = new Vector2(moveDirection.x * moveSpeed, playerRb.velocity.y);
}
else
{
playerRb.velocity = new Vector2(moveDirection.x * moveSpeed, playerRb.velocity.y);
}

if(dash4 && isGrounded())
{
freeMove = false;
}
#endregion

#region BOMB SLAM
if (isGrounded() && slam && !slamCancel && dash4 && dash3 && dash2 && dash1 && !dance)
{
slam = false;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if(isGrounded() && slam && !slamCancel && dash3 && dash2 && dash1 && !dance)
{
slam = false;
dash4 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash2 && dash1 && !dance)
{
slam = false;
dash3 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash1 && !dance)
{
slam = false;
dash2 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && !dash1 && !dance)
{
slam = false;
dash1 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
#endregion

#region BRAKING/SPEED LOGIC
if (isBraking)
{
Dash1Deceleration();
}
else if (!isBraking)
{
if (dash4 && dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 21f;
}
else if (dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 18f;
}
else if (dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 15f;
}
else if (dash1 && !dive && !dance && !bumped)
{
moveSpeed = 12f;
}
else if (!dive &&
!dance && !bumped)
{
moveSpeed = 9;
}
}
#endregion
}

private void FixedUpdate()
{
Crouch(crouching);

if (dive && isGrounded())
{
DiveDeceleration();
}
}

#region CONTROLS
void Flip()
{
if (playerRb.velocity.x < 0 && !facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = true;
transform.Rotate(0f, 180f, 0f);
}
else if (playerRb.velocity.x > 0 && facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = false;
transform.Rotate(0f, 180f, 0f);
}
}

private void JumpPerformed(InputAction.CallbackContext context)
{

if (canJump && !crouching && isGrounded() && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, jumpForce);
}
else if(crouching && canJump && isGrounded() && playerRb.velocity.x == 0 && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, 8);
}

if (slam)
{
playerRb.velocity = new Vector2(0, 14);
playerRb.gravityScale = 3;
slam = false;
slamCancel = true;
freeMove = true;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamCancel", true);
}

#region DIVING
if (crouching && dash1 && dash2 && dash3 && dash4 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && dash3 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
}
#endregion
}

private void
JumpCanceled(InputAction.CallbackContext context)
{
jumpCanceled = true;
if (isJumping && canWallBounce && !bumped && !blasted)
{
if (playerRb.velocity.y > 0)
{
playerRb.velocity = new Vector2(playerRb.velocity.x, playerRb.velocity.y * shortJumpMultiplier);
}
isJumping = false;
}
}

private bool isGrounded()
{
return Physics2D.OverlapCapsule(groundCheck.position, new Vector2(0.5f, 0.1f), CapsuleDirection2D.Horizontal, 0, groundLayer);
}

private void BombPerformed(InputAction.CallbackContext context)
{
#region DIVEBOOST
if (canJump && dive && dash4 && dash3 && dash2 && dash1)
{
dive = false;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash3 && dash2 && dash1)
{
dive = false;
dash4 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash2 && dash1)
{
dive = false;
dash3 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash1)
{
dive = false;
dash2 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
#endregion

if (canDiveBomb && dash1 && dash2 && dash3 && dash4)
{
isDashing = false;
diveBombed = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && dash2 && dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash4 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash3 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && !dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash2 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && !dash1 && !dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash1 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}

if (!isGrounded() && !slam && !slamCancel && !blasted && !dance && spinDive)
{
slam = true;
freeMove = true;
isDashing = false;
spinDive = false;
playerAnim.SetBool("Slam", true);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
playerRb.gravityScale = 2.5f;
playerRb.velocity = new Vector2(0, 9.5f);