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 game/project

I feel like this is the most generic question, but what should my first game/project be if I am just starting out with game development? I have watched a few CodeMonkey tutorials and have a small understanding of what Unity is. Probably a 0% chance of it happening in the next 5 years, but my end goal would be creating a small RPG (and yes, I know this is too big of a scope for a solo developer, etc.).

https://redd.it/1i6wscz
@r_Unity3D
Installing .apk

Hi guys,i have a question...i made a game in unity,but when i send it to phone it opens as archive,and then i have to use winrar to go one level back and then i can install it,how to make it install on itself?Do i have to click something when buildiing the apk?

https://redd.it/1i72jdf
@r_Unity3D
Need help making enemies explode and bones fly out that have physics. ( player touches and they move )

Hey all! I need help with a problem. So I kill enemies and I want on their death for them to explode and bones fly out. I already have the bones objects, and they already die, etc etc.



The only thing I am missing is how to make it to where on death the bones fly out of them and hit the ground. I want them to be able to be moved. So when the Player walks over them they kinda roll around and move with the player if that makes sense.



I think this might be doable with the particle system maybe? Any guidance would be awesome!

https://redd.it/1i74bx7
@r_Unity3D
We're working on the temple for our game, inspired by the ancient Indian architecture. How does it look?

Classical Bharat consisted of architectural marvels with intricate carvings. We've tried to portray it through our game, in our art style.

How is it looking?😁

https://preview.redd.it/5hft0w9pwhee1.png?width=1545&format=png&auto=webp&s=5f0829ecb3050bf7de8218bc300f43e784252fde



https://redd.it/1i75lj1
@r_Unity3D
Writing a file to an easy-to-access location.

I am writing a 2D app in Unity, and I'd like to be able to export CSV data to somewhere the user can easily access. I don't want users to have to dig through to the 'application.persistentDataPath' location. I have tried the "Downloads" folder as some have suggested but, as expected, access is denied. Is there any clever work-around to this?

https://redd.it/1i76e8f
@r_Unity3D
How do you think Habbo hotel did their modular clothing?

I heard something about Habbo hotel moving over the Unity in 2020. And I'm really curious how do you think that Habbo hotel did their modular clothing. They have an expansive character creator for a 2D pixelart game, and as somebody looking to get started on a 2D pixelart game of my own with a modular clothing / armor system, I would love to know how they did it.


My first guess is that an animater has been drawing every animation for every piece of clothing by hand. But there are so many variations?

https://redd.it/1i76xhr
@r_Unity3D
I made a plugin that display how full the International Space Station's urine tank is on your toolbar in real time
https://redd.it/1i77uqz
@r_Unity3D
Animating Walk Cycle RESIZING???? For no reason????

Hello, I am VERY new to Unity and also new to coding. I am trying to get my player to walk around with walking animations. For some reason when I go to make the animations even though the sprite sheet components for the animation are the same size as my idle character sprite and the size that I want them, whenever I put them into the animation thing they get bigger??? By a sizable amount and then it makes the idle base one the same size and I can't figure out how to change it and I just have to keep redoing it! Please help I bed /(T-T)/

https://redd.it/1i7eego
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
I made a fully procedural 3D flamethrower (shader) with realtime lights in Unity (URP).

https://redd.it/1i7c60q
@r_Unity3D
Please help cant change X velocity

I am making my first game (2D platformer) this is the code I am using for movement I am currently working on wallJumping but when I am on the wall the X velocity just wont change the Y has no problem so it is clearly executing the line but the X velocity is just not changing.
BTW there are 2 codes

using UnityEngine;

// This class handles general movement physics for 2D objects
public class MovementPhysics : MonoBehaviour
{
Header("Movement Settings")
public float speed = 5f;
public float airSpeed = 2f;

Header("Jump Settings")
public float jumpForce = 7f;
public int doublejumps = 2;
public Vector2 wallJumpStrenght;

Header("Ground Check Settings")
public Vector2 groundCheckSize;
public Vector2 groundCheckOffset;
public LayerMask groundLayer;
public bool isGrounded;

Header("wall Check Settings")
public bool canWallslide;
public Vector2 wallCheckSize;
public Vector2 wallCheckOffset;
public LayerMask wallLayer;
public bool isWalledL;
public bool isWalledR;

// Private properties
protected Rigidbody2D rb; // Reference to Rigidbody2D component
protected int jumpsLeft;
protected bool isGravityDisabled = false;

public float inputX;

protected virtual void Start()
{
// Initialize Rigidbody2D and jumps
rb = GetComponent<Rigidbody2D>();
jumpsLeft = doublejumps;
}

protected virtual void Update()
{
// Get horizontal input for movement
inputX = Input.GetAxis("Horizontal");

// Check ground contact using OverlapBox
Vector2 checkPos = (Vector2)transform.position + groundCheckOffset;
isGrounded = Physics2D.OverlapBox(checkPos, groundCheckSize, 0f, groundLayer);

// Check wall right contact using OverlapBox
Vector2 checkPos1 = (Vector2)transform.position + wallCheckOffset;
isWalledR = Physics2D.OverlapBox(checkPos1, wallCheckSize, 0f, wallLayer);

// Check wall left contact using OverlapBox
Vector2 flippedwallCheckOffset = new Vector2(-wallCheckOffset.x, wallCheckOffset.y);
Vector2 checkPos2 = (Vector2)transform.position + flippedwallCheckOffset;
isWalledL = Physics2D.OverlapBox(checkPos2, wallCheckSize, 0f, wallLayer);

// Reset jumps when on the ground
if (isGrounded) jumpsLeft = doublejumps;

// Call depended functions
FlipCharacter(inputX);

// Handels Wall Slide
if ((isWalledL || isWalledR) && canWallslide)
{
if (!isGravityDisabled) // Only set gravityScale to 0 if it's not already 0
{
rb.gravityScale = 0;
isGravityDisabled = true;
rb.linearVelocityY = 0;
}
}
else
{
if (isGravityDisabled) // Only set gravityScale to 1 if it's not already 1
{
rb.gravityScale = 1;
isGravityDisabled = false;
}
}
}

protected virtual void FixedUpdate()
{
// Apply movement physics
Move(inputX);
}

// Handles horizontal movement
protected void Move(float input)
{
if (isGrounded)
{
// Ground movement: set the velocity based on input and speed
rb.linearVelocityX =input speed;
}
else
{
// Air movement: apply force to simulate air control, with some damping on x-axis velocity
float airControl = input
airSpeed - (rb.linearVelocity.x / 2);
rb.AddForce(new Vector2(airControl, 0));
}
}

// Handles jumping logic
protected void Jump()
{
if (isWalledR || isWalledL)
{
if (isWalledL) rb.linearVelocity = new Vector2(wallJumpStrenght.x, wallJumpStrenght.y);
else rb.linearVelocity = new Vector2(-wallJumpStrenght.x, wallJumpStrenght.y);
}
else
{
if (jumpsLeft > 0)
{
rb.linearVelocity = new Vector2(rb.linearVelocity.x, jumpForce); // Apply jump force on the y-axis
jumpsLeft--; // Decrease remaining jumps
}
}
}

// Flips the character's sprite based on movement direction
protected void FlipCharacter(float input)
{
if (isWalledR) transform.localScale = new Vector3(1, 1, 1); // Flip right
else if (isWalledL) transform.localScale = new Vector3(-1, 1, 1); // Flip left
else if (input > 0 || isWalledL) transform.localScale = new Vector3(1, 1, 1); // Flip right
else if (input < 0 || isWalledL) transform.localScale = new Vector3(-1, 1, 1); // Flip left
}

// draw shit boxes
protected virtual void OnDrawGizmosSelected()
{
// Only draw gizmos if this is not the exact class (derived)
if (GetType() == typeof(MovementPhysics))
return;

// Draw Ground Check Box
Gizmos.color = Color.green; // Set color for ground check
Vector2 groundCheckPos = (Vector2)transform.position + groundCheckOffset;
Gizmos.DrawWireCube(groundCheckPos, groundCheckSize);

// Draw Wall Check Box (Right)
Gizmos.color = Color.red; // Set color for wall check (right)
Vector2 wallCheckPosRight = (Vector2)transform.position + wallCheckOffset;
Gizmos.DrawWireCube(wallCheckPosRight, wallCheckSize);

// Draw Wall Check Box (Left)
Gizmos.color = Color.blue; // Set color for wall check (left)
Vector2 wallCheckPosLeft = (Vector2)transform.position + new Vector2(-wallCheckOffset.x, wallCheckOffset.y);
Gizmos.DrawWireCube(wallCheckPosLeft, wallCheckSize);
}
}

using UnityEngine;
using System.Collections; // Add this for IEnumerator and Coroutines

// This class handles player-specific input and extends MovementPhysics
public class PlayerController : MovementPhysics
{
Header("Input Settings")
public string horizontalAxis = "Horizontal"; // Input axis for horizontal movement
public string jumpButton = "Jump"; // Input button for jumping

Header("snap Settings")
public float snapDuration; // Duration for snapping
public float snapThreshold; // Threshold for triggering the snap
private Coroutine snapCoroutine; // Reference to the snapping coroutine
private bool isSnapping = false; // Flag to check if snapping is currently active

protected override void Update()
{
//debug
Debug.Log($"Horizontal Velocity: {rb.linearVelocity.x}, Vertical Velocity: {rb.linearVelocity.y}");

// Capture player input for movement
inputX = Input.GetAxis(horizontalAxis);

// Trigger jump when jump button is pressed
if (Input.GetButtonDown(jumpButton))
{
if (isSnapping)
{
StopCoroutine(snapCoroutine);
isSnapping = false;
}
Jump();
}

// Call base class to handle physics logic
base.Update();

// Start snapping when jump button is released and player is still moving upwards
if (rb.linearVelocity.y > snapThreshold && !Input.GetButton("Jump") && !isSnapping)
{
// Start
Please help cant change X velocity

I am making my first game (2D platformer) this is the code I am using for movement I am currently working on wallJumping but when I am on the wall the X velocity just wont change the Y has no problem so it is clearly executing the line but the X velocity is just not changing.
BTW there are 2 codes

using UnityEngine;

// This class handles general movement physics for 2D objects
public class MovementPhysics : MonoBehaviour
{
[Header("Movement Settings")]
public float speed = 5f;
public float airSpeed = 2f;

[Header("Jump Settings")]
public float jumpForce = 7f;
public int doublejumps = 2;
public Vector2 wallJumpStrenght;

[Header("Ground Check Settings")]
public Vector2 groundCheckSize;
public Vector2 groundCheckOffset;
public LayerMask groundLayer;
public bool isGrounded;

[Header("wall Check Settings")]
public bool canWallslide;
public Vector2 wallCheckSize;
public Vector2 wallCheckOffset;
public LayerMask wallLayer;
public bool isWalledL;
public bool isWalledR;

// Private properties
protected Rigidbody2D rb; // Reference to Rigidbody2D component
protected int jumpsLeft;
protected bool isGravityDisabled = false;

public float inputX;

protected virtual void Start()
{
// Initialize Rigidbody2D and jumps
rb = GetComponent<Rigidbody2D>();
jumpsLeft = doublejumps;
}

protected virtual void Update()
{
// Get horizontal input for movement
inputX = Input.GetAxis("Horizontal");

// Check ground contact using OverlapBox
Vector2 checkPos = (Vector2)transform.position + groundCheckOffset;
isGrounded = Physics2D.OverlapBox(checkPos, groundCheckSize, 0f, groundLayer);

// Check wall right contact using OverlapBox
Vector2 checkPos1 = (Vector2)transform.position + wallCheckOffset;
isWalledR = Physics2D.OverlapBox(checkPos1, wallCheckSize, 0f, wallLayer);

// Check wall left contact using OverlapBox
Vector2 flippedwallCheckOffset = new Vector2(-wallCheckOffset.x, wallCheckOffset.y);
Vector2 checkPos2 = (Vector2)transform.position + flippedwallCheckOffset;
isWalledL = Physics2D.OverlapBox(checkPos2, wallCheckSize, 0f, wallLayer);

// Reset jumps when on the ground
if (isGrounded) jumpsLeft = doublejumps;

// Call depended functions
FlipCharacter(inputX);

// Handels Wall Slide
if ((isWalledL || isWalledR) && canWallslide)
{
if (!isGravityDisabled) // Only set gravityScale to 0 if it's not already 0
{
rb.gravityScale = 0;
isGravityDisabled = true;
rb.linearVelocityY = 0;
}
}
else
{
if (isGravityDisabled) // Only set gravityScale to 1 if it's not already 1
{
rb.gravityScale = 1;
isGravityDisabled = false;
}
}
}

protected virtual void FixedUpdate()
{
// Apply movement physics
Move(inputX);
}

// Handles horizontal movement
protected void Move(float input)
{
if (isGrounded)
{
// Ground movement: set the velocity based on input and speed
rb.linearVelocityX =input * speed;
}
else
{
// Air movement: apply force to simulate air control, with some damping on x-axis velocity
float airControl = input * airSpeed - (rb.linearVelocity.x / 2);
rb.AddForce(new Vector2(airControl, 0));
}
}

// Handles jumping logic
protected void Jump()
{
if (isWalledR || isWalledL)
{
if (isWalledL) rb.linearVelocity = new Vector2(wallJumpStrenght.x, wallJumpStrenght.y);
else rb.linearVelocity = new Vector2(-wallJumpStrenght.x, wallJumpStrenght.y);
}
else
{
if (jumpsLeft > 0)
{
rb.linearVelocity = new Vector2(rb.linearVelocity.x, jumpForce); // Apply jump force on the y-axis
jumpsLeft--; // Decrease remaining jumps
}
}
}

// Flips the character's sprite based on movement direction
protected void FlipCharacter(float input)
{
if (isWalledR) transform.localScale = new Vector3(1, 1, 1); // Flip right
else if (isWalledL) transform.localScale = new Vector3(-1, 1, 1); // Flip left
else if (input > 0 || isWalledL) transform.localScale = new Vector3(1, 1, 1); // Flip right
else if (input < 0 || isWalledL) transform.localScale = new Vector3(-1, 1, 1); // Flip left
}

// draw shit boxes
protected virtual void OnDrawGizmosSelected()
{
// Only draw gizmos if this is not the exact class (derived)
if (GetType() == typeof(MovementPhysics))
return;

// Draw Ground Check Box
Gizmos.color = Color.green; // Set color for ground check
Vector2 groundCheckPos = (Vector2)transform.position + groundCheckOffset;
Gizmos.DrawWireCube(groundCheckPos, groundCheckSize);

// Draw Wall Check Box (Right)
Gizmos.color = Color.red; // Set color for wall check (right)
Vector2 wallCheckPosRight = (Vector2)transform.position + wallCheckOffset;
Gizmos.DrawWireCube(wallCheckPosRight, wallCheckSize);

// Draw Wall Check Box (Left)
Gizmos.color = Color.blue; // Set color for wall check (left)
Vector2 wallCheckPosLeft = (Vector2)transform.position + new Vector2(-wallCheckOffset.x, wallCheckOffset.y);
Gizmos.DrawWireCube(wallCheckPosLeft, wallCheckSize);
}
}

using UnityEngine;
using System.Collections; // Add this for IEnumerator and Coroutines

// This class handles player-specific input and extends MovementPhysics
public class PlayerController : MovementPhysics
{
[Header("Input Settings")]
public string horizontalAxis = "Horizontal"; // Input axis for horizontal movement
public string jumpButton = "Jump"; // Input button for jumping

[Header("snap Settings")]
public float snapDuration; // Duration for snapping
public float snapThreshold; // Threshold for triggering the snap
private Coroutine snapCoroutine; // Reference to the snapping coroutine
private bool isSnapping = false; // Flag to check if snapping is currently active

protected override void Update()
{
//debug
Debug.Log($"Horizontal Velocity: {rb.linearVelocity.x}, Vertical Velocity: {rb.linearVelocity.y}");

// Capture player input for movement
inputX = Input.GetAxis(horizontalAxis);

// Trigger jump when jump button is pressed
if (Input.GetButtonDown(jumpButton))
{
if (isSnapping)
{
StopCoroutine(snapCoroutine);
isSnapping = false;
}
Jump();
}

// Call base class to handle physics logic
base.Update();

// Start snapping when jump button is released and player is still moving upwards
if (rb.linearVelocity.y > snapThreshold && !Input.GetButton("Jump") && !isSnapping)
{
// Start
the snapping coroutine
snapCoroutine = StartCoroutine(SmoothSnap());
}
}

// Coroutine to smooth out the upward velocity when the jump button is released
private IEnumerator SmoothSnap()
{
isSnapping = true;

// Store the initial vertical velocity
float initialVelocityY = rb.linearVelocity.y;
float elapsedTime = 0f;

// Gradually reduce the vertical velocity
while (elapsedTime < snapDuration && rb.linearVelocity.y > 0)
{
elapsedTime += Time.deltaTime;
float dampFactor = Mathf.Lerp(1, 0, elapsedTime / snapDuration); // Damp the upward velocity
rb.linearVelocity = new Vector2(rb.linearVelocity.x, initialVelocityY * dampFactor);
yield return null;
}

// Ensure the velocity doesn't stay positive once snapping is done
if (rb.linearVelocity.y > 0.1f)
{
rb.linearVelocity = new Vector2(rb.linearVelocity.x, 0);
}

isSnapping = false;
}
}



https://redd.it/1i7g70k
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
Such simple mechanic like object breaking can add so much to the game.

https://redd.it/1i7gk4x
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
Basic mechanics for a cute soft-body physics game – what do you think? 🙂

https://redd.it/1i7kejc
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
Have you ever spent way too much time on a little thing for your game only to then scrap it and forget about it? Just found and finished this chemical flask shader for our escape room game. Last time I worked on it was probably a year ago...

https://redd.it/1i7m7r2
@r_Unity3D