r/UnityHelp • u/Imaginary-Cod-3746 • Sep 11 '26
r/UnityHelp • u/Affectionate_Tap5195 • Aug 17 '26
my banana aint workin :(
im trying to make a deformable banana avatar for vrchat, but for some reason no matter what i do its never seems to deform the model. all its does is just put it on one bone
r/UnityHelp • u/JungleGames77 • Jul 02 '26
UNITY Create a PS1 Shader in Unity (No Shader Graph)
r/UnityHelp • u/Toya-Aoyagay • Jan 23 '26
PROGRAMMING code not working
I followed a youtube tutorial as i'm new to using unity, and i copied the exact things the creator did, but for some reason it doesn't work. Neither the character movement or camera movement works. The tutorial is 2 years old and so i think the age might be part of the issue. I hope that any of you can identify the issue:)
edit: the code is
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(CharacterController))]
public class PlayerMovement : MonoBehaviour
{
public Camera playerCamera;
public float walkSpeed = 6f;
public float runSpeed = 12f;
public float jumpPower = 7f;
public float gravity = 10f;
public float lookSpeed = 2f;
public float lookXLimit = 45f;
public float defaultHeight = 2f;
public float crouchHeight = 1f;
public float crouchSpeed = 3f;
private Vector3 moveDirection = Vector3.zero;
private float rotationX = 0;
private CharacterController characterController;
private bool canMove = true;
void Start()
{
characterController = GetComponent<CharacterController>();
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
void Update()
{
Vector3 forward = transform.TransformDirection(Vector3.forward);
Vector3 right = transform.TransformDirection(Vector3.right);
bool isRunning = Input.GetKey(KeyCode.LeftShift);
float curSpeedX = canMove ? (isRunning ? runSpeed : walkSpeed) * Input.GetAxis("Vertical") : 0;
float curSpeedY = canMove ? (isRunning ? runSpeed : walkSpeed) * Input.GetAxis("Horizontal") : 0;
float movementDirectionY = moveDirection.y;
moveDirection = (forward * curSpeedX) + (right * curSpeedY);
if (Input.GetButton("Jump") && canMove && characterController.isGrounded)
{
moveDirection.y = jumpPower;
}
else
{
moveDirection.y = movementDirectionY;
}
if (!characterController.isGrounded)
{
moveDirection.y -= gravity * Time.deltaTime;
}
if (Input.GetKey(KeyCode.R) && canMove)
{
characterController.height = crouchHeight;
walkSpeed = crouchSpeed;
runSpeed = crouchSpeed;
}
else
{
characterController.height = defaultHeight;
walkSpeed = 6f;
runSpeed = 12f;
}
characterController.Move(moveDirection * Time.deltaTime);
if (canMove)
{
rotationX += -Input.GetAxis("Mouse Y") * lookSpeed;
rotationX = Mathf.Clamp(rotationX, -lookXLimit, lookXLimit);
playerCamera.transform.localRotation = Quaternion.Euler(rotationX, 0, 0);
transform.rotation *= Quaternion.Euler(0, Input.GetAxis("Mouse X") * lookSpeed, 0);
}
}
}
r/UnityHelp • u/tim_the_human_frog • Nov 12 '25
Arrow Shooting is bugged
Hey, I'm new to Unity and programming in general, but I'm trying to learn with this small project. It's supposed to be an old-school dungeon crawler / ego - shooter with RPG elements .
I ignored the weird shooting for a long time and worked on some UI and so on, but I can't continue with the arrow and shooting mechanic being like this.
The Problem is: When I'm too close to something , the bow shoots to the left, as you can see in the video. There is no collider on the bow or on the muzzle, and my attempts to fix it with ChatGPT have not helped so far.
Is there anyone out there who had a similar issue or can explain to me what is happening?
Explanation for the current shooting mechanic:
- The arrow shoots farther the longer you press the mouse button.
- There is a line renderer to visualize where the arrow will be flying.
I hope someone can help me fix this.
using UnityEngine;
using System.Collections.Generic;
public class BowShoot : MonoBehaviour
{
[Header("References")]
[SerializeField] private Camera playerCamera;
[SerializeField] private Transform muzzlePoint;
[SerializeField] private GameObject arrowPrefab;
[SerializeField] private LineRenderer trajectoryLinePrefab; // Prefab mit Material & Breite
[Header("Shooting Settings")]
[SerializeField] private float minSpeed = 10f;
[SerializeField] private float maxSpeed = 50f;
[SerializeField] private float chargeTime = 2f;
[SerializeField] private float fireRate = 0.5f;
[SerializeField] private float maxRayDistance = 100f;
[Header("Arrow Spread Settings")]
[SerializeField] private int arrowsPerShot = 3;
[SerializeField] private float spreadAngle = 10f;
[Header("Trajectory Settings")]
[SerializeField] private int trajectoryPoints = 30;
[SerializeField] private float trajectoryTimeStep = 0.1f;
private float currentCharge = 0f;
private float lastFireTime = 0f;
private readonly List<LineRenderer> activeTrajectories = new();
public BowAudio bowAudio;
private void Start()
{
if (playerCamera == null) playerCamera = Camera.main;
if (muzzlePoint == null) muzzlePoint = transform;
}
private void Update()
{
if (Input.GetButtonDown("Fire1"))
{
bowAudio.PlayDraw();
currentCharge = 0f;
CreateTrajectoryLines();
}
if (Input.GetButton("Fire1"))
{
currentCharge += Time.deltaTime;
currentCharge = Mathf.Clamp(currentCharge, 0f, chargeTime);
float t = currentCharge / chargeTime;
float shotSpeed = Mathf.Lerp(minSpeed, maxSpeed, t);
UpdateTrajectoryLines(shotSpeed);
}
if (Input.GetButtonUp("Fire1") && Time.time >= lastFireTime + fireRate)
{
float t = currentCharge / chargeTime;
float shotSpeed = Mathf.Lerp(minSpeed, maxSpeed, t);
bowAudio.PlayShoot();
Shoot(shotSpeed);
ClearTrajectoryLines();
lastFireTime = Time.time;
}
}
private void Shoot(float shotSpeed)
{
// Ray
Ray camRay = playerCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
// Target
Vector3 camTarget = Physics.Raycast(camRay, out RaycastHit camHit, maxRayDistance)
? camHit.point
: camRay.origin + camRay.direction * maxRayDistance;
// Direction
Vector3 finalDir = (camTarget - muzzlePoint.position).normalized;
// Arrow Spread
int halfCount = arrowsPerShot / 2;
for (int i = -halfCount; i <= halfCount; i++)
{
Vector3 dir = finalDir;
if (i != 0)
{
float angle = spreadAngle * i;
dir = Quaternion.Euler(0, angle, 0) * finalDir;
}
// Offset
Vector3 sideOffset = Vector3.Cross(Vector3.up, dir).normalized * (0.1f * i);
Vector3 spawnPos = muzzlePoint.position + dir * 0.3f + sideOffset;
// Arrow initiate
GameObject arrow = Instantiate(arrowPrefab, spawnPos, Quaternion.LookRotation(dir));
if (arrow.TryGetComponent(out Rigidbody rb))
{
rb.useGravity = true;
rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
rb.velocity = dir * shotSpeed;
// Fix position
arrow.transform.rotation = Quaternion.LookRotation(rb.velocity) * Quaternion.Euler(90f, 0f, 0f);
}
}
}
// -------------------------------------------------------------
// TRAJECTORY VISUALIZATION
// -------------------------------------------------------------
private void CreateTrajectoryLines()
{
ClearTrajectoryLines();
int halfCount = arrowsPerShot / 2;
for (int i = -halfCount; i <= halfCount; i++)
{
LineRenderer line = Instantiate(trajectoryLinePrefab, transform);
line.positionCount = trajectoryPoints;
activeTrajectories.Add(line);
}
}
private void UpdateTrajectoryLines(float shotSpeed)
{
if (activeTrajectories.Count == 0) return;
Ray camRay = playerCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
Vector3 targetPoint = Physics.Raycast(camRay, out RaycastHit hit, maxRayDistance)
? hit.point
: camRay.origin + camRay.direction * maxRayDistance;
Vector3 centerDir = (targetPoint - muzzlePoint.position).normalized;
int halfCount = arrowsPerShot / 2;
for (int i = -halfCount; i <= halfCount; i++)
{
Vector3 dir = centerDir;
if (i != 0)
{
float angle = spreadAngle * i;
dir = Quaternion.Euler(0, angle, 0) * centerDir;
}
Vector3 startPos = muzzlePoint.position;
Vector3 startVelocity = dir * shotSpeed;
Vector3[] points = new Vector3[trajectoryPoints];
for (int j = 0; j < trajectoryPoints; j++)
{
float t = j * trajectoryTimeStep;
points[j] = startPos + startVelocity * t + 0.5f * Physics.gravity * (t * t);
}
activeTrajectories[i + halfCount].SetPositions(points);
}
}
private void ClearTrajectoryLines()
{
foreach (var line in activeTrajectories)
if (line != null)
Destroy(line.gameObject);
activeTrajectories.Clear();
}
}
using UnityEngine;
[RequireComponent(typeof(Rigidbody), typeof(Collider))]
public class ArrowBasic : MonoBehaviour
{
private GameObject shooter;
[SerializeField] private float lifeTime = 10f;
[SerializeField] public int damage;
private Rigidbody rb;
private Collider arrowCollider;
private bool hasHit = false;
public Audio hitAudio;
public void SetDamage(int value)
{
damage = value;
}
private void Awake()
{
rb = GetComponent<Rigidbody>();
arrowCollider = GetComponent<Collider>();
gameObject.layer = LayerMask.NameToLayer("Projectile");
rb.useGravity = true;
rb.isKinematic = false;
rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
arrowCollider.isTrigger = false;
}
private void Start() => Destroy(gameObject, lifeTime);
public void Launch(Vector3 velocity, GameObject shooterObj = null)
{
shooter = shooterObj;
hasHit = false;
rb.isKinematic = false;
rb.velocity = velocity;
arrowCollider.enabled = true;
}
private void OnCollisionEnter(Collision other)
{
if (hasHit || other.gameObject == shooter) return;
hasHit = true;
hitAudio.PlayClip();
TryDealDamage(other.gameObject);
rb.isKinematic = true;
arrowCollider.enabled = false;
Destroy(gameObject, 0.2f);
}
private void TryDealDamage(GameObject obj)
{
if (obj.TryGetComponent(out EnemyController enemy)) { enemy.GetDamage(damage); return; }
if (obj.TryGetComponent(out PlayerController player)) { player.GetDamage(damage); return; }
}
}r/UnityHelp • u/_Nostophobia_ • Oct 02 '25
I need a little help with lighting in Unity
Okay so I'm working on this project in unity thats a full map, my issue here is the lighting, I don't get how anything works and it doesn't seem like the kind of thing I can trial and error until I get right like the rest of Unity, so I'm doing something I'll likely regret later and asking the internet for help. Attached is an example of the lighting/atmosphere I'm going for here, I know it's kind of low-res but I'm hoping someone can give me specifics on how to potentially replicate it, thank you in advance.
r/UnityHelp • u/seansean98761 • Sep 15 '25
UNITY What is causing this robot gripper to snap out objects?
What is causing this robot gripper to snap out objects?
(The snapping out is towards the end of the video).
The closing speed is 0.01m/s.
Object Physics material:
dynamic friction: .5
Static friction: .1
Bounciness: 0
Mass: 1e-05
(Unity version 2020.3.11f1)
r/UnityHelp • u/Informal-Program-929 • Sep 06 '25
UNITY Why isn't controller working
Why isn't my movement working, it works when using keyboard but when I bind any of the controller ones it doesn't work, any help will be appreciated!
r/UnityHelp • u/BlaJuji • Aug 22 '25
UNITY Shader is way too big on Tilemap
I made a pixelated dissolve Shader. I want to put that on a tilemap to dissolve it.
The image of the tent is what I want it to look like. The third picture is what it looks like when I put the material on my tilemap. And the last image is the tilemap without the material.
Whats the problem? Why is it gigantic on the tilemap but not the normal sprite?
Its a 2d Plattformer, if that helps. The tiles are 16x16 px.
r/UnityHelp • u/Corvid-Curiosity • Aug 02 '25
Object Unaffected by Animator?
The animator is set up with opening and closing animations. Clicking the button in-game activates the animator, changing the object's position and rotation - but visually, nothing happens! Been trying to trouble-shoot this for days. Any ideas?
r/UnityHelp • u/AcrobaticDream5454 • Jun 02 '25
How can I make movement more fluid with character controller?
I've been using a character controller for this prototype but the movement feels very clanky (albeit responsive) but I would like if it very quickly sped up when a movement button is pressed to allow for very small inputs. How would I go about this? I think it's something similar that's causing the player to fall very quickly (if they have not just jumped), though it's probably to do with the way I'm handling slopes (but the same thing happens if you fall off the edge).
using System;
using Unity.VisualScripting;
using UnityEngine;
public class Movement : MonoBehaviour
{
public float moveSpeed = 10f; // Movement Speed
public float jumpForce = 4f; // Jump Strength
public float gravity = 9.81f; // Gravity Strength
public float airDrag = 0.5f; // Air Drag for slowing in air
public float airAcceleration = 8f; // Speed for controlling air movement
private CharacterController cc;
private float verticalVelocity; // Vertical velocity
private Vector3 airVelocity = Vector3.zero; // Velocity while in the air
private Vector3 horizontalAirVel = Vector3.zero; // Horizontal velocity while in the air
private Vector3 dashDir = Vector3.zero; // Direction of dash
private Vector3 slideDir = Vector3.zero; // Direction of slide
public float dashSpeed = 5f; // Speed of dash
private bool isDashing = false; // Check if currently dashing
public float dashTime = 0.15f; // Duration of dash
private float dashTimer = 0f; // Timer for duration of dash
public float dashRec = 1f; // Recovery time to regain 1 dash
private float dashRecTimer = 0f; // Timer for dash recovery
public float dashNumMax = 3f; // Maximum number of dashes available
private float dashNum = 3f; // Current number of dashes
public float dashDampener = 0.4f; // Dampening effect after dash
private bool wantsJump = false; // Check if player wants to jump
public float jumpWriggle = 0.15f; // Amount of time before jump that jump input can be registered
private float jumpWriggleTimer = 0f; // Timer for jump wriggle
public float coyoteTime = 0.15f; // Time after leaving ground that player can still jump
private float coyoteTimer = 0f; // Timer for coyote time
public float jumpNumMax = 1f; // Number of jumps available
private float jumpNum = 1f; // Current number of jumps available
private bool isGrounding = false; // Check if player is ground slamming
private bool groundOver = false; // Check if ground slam has finished
public float groundCool = 0.1f; // Cooldown time after ground slam before moving again
private float groundCoolTimer = 0f; // Timer for how long you cannot move for after ground slam
private bool isSliding = false; // Check if player is sliding
Vector3 inputDir = Vector3.zero; // Input direction for movement
Vector3 move = Vector3.zero; // Movement vector
void Start()
{
cc = GetComponent<CharacterController>();
dashNum = dashNumMax;
jumpNum = jumpNumMax;
}
void Update()
{
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
inputDir = (transform.right * horizontal + transform.forward * vertical);
move = inputDir.normalized * moveSpeed;
if (Input.GetButtonDown("Jump"))
{
wantsJump = true;
}
if (wantsJump == true)
{
jumpWriggleTimer += Time.deltaTime;
if (jumpWriggleTimer > jumpWriggle)
{
jumpWriggleTimer = 0f;
wantsJump = false;
}
}
DashHandler();
GroundSlamHandler();
SlideHandler();
if (wantsJump && coyoteTimer < coyoteTime && jumpNum >= 1)
{
jumpNum -= 1;
verticalVelocity = Mathf.Sqrt(jumpForce * 2 * gravity);
airVelocity = move;
horizontalAirVel = new Vector3(airVelocity.x, 0, airVelocity.z);
}
else if (cc.isGrounded)
{
jumpNum = jumpNumMax;
coyoteTimer = 0f;
if (isGrounding)
{
isGrounding = false;
groundOver = true;
}
airVelocity = move;
if (verticalVelocity < 0)
verticalVelocity = -gravity * 1.5f;
}
else if (!isDashing && !isGrounding)
{
coyoteTimer += Time.deltaTime;
if (Physics.Raycast(Vector3.zero, Vector3.down, 0.1f))
verticalVelocity = -gravity * 5f; // If ground is close increase downward velocity to improve slope movement
else if (verticalVelocity < -2f)
verticalVelocity -= (gravity * 1.8f) * Time.deltaTime;
else
verticalVelocity -= gravity * Time.deltaTime;
if (inputDir.sqrMagnitude > 0.01f)
{
Vector3 desiredVel = inputDir.normalized * moveSpeed;
horizontalAirVel = Vector3.MoveTowards(horizontalAirVel, desiredVel, airAcceleration * Time.deltaTime);
}
else
{
horizontalAirVel = Vector3.MoveTowards(horizontalAirVel, Vector3.zero, airDrag * Time.deltaTime);
}
airVelocity.x = horizontalAirVel.x;
airVelocity.z = horizontalAirVel.z;
move = airVelocity;
}
move.y = verticalVelocity;
cc.Move(move * Time.deltaTime);
Debug.Log(jumpNum);
}
void DashHandler ()
{
int dashesRecovered = Mathf.FloorToInt((dashRec * dashNumMax - dashRecTimer) / dashRec);
dashNum = Mathf.Clamp(dashesRecovered, 0, (int)dashNumMax);
if (Input.GetKeyDown(KeyCode.LeftShift) && dashNum >= 1 && dashNum <= dashNumMax)
{
verticalVelocity = 0f;
if (inputDir.sqrMagnitude > 0.01f)
{
dashDir = inputDir.normalized * dashSpeed * 5f;
}
else
{
dashDir = transform.forward * dashSpeed * 5f;
}
isDashing = true;
dashNum -= 1;
dashRecTimer += 1f;
move = dashDir;
horizontalAirVel = new Vector3(dashDir.x, 0f, dashDir.z);
airVelocity = dashDir;
}
else if (isDashing)
{
if (dashTimer > dashTime)
{
isDashing = false;
dashTimer = 0f;
dashDir = dashDir * dashDampener;
move = dashDir;
airVelocity = dashDir;
horizontalAirVel = new Vector3(dashDir.x, 0f, dashDir.z);
}
else if (wantsJump && dashNum > 0)
{
isDashing = false;
dashTimer = 0f;
move = dashDir;
verticalVelocity = Mathf.Sqrt(jumpForce * 2 * gravity);
airVelocity = move;
horizontalAirVel = new Vector3(airVelocity.x, 0, airVelocity.z);
}
else
{
dashTimer += Time.deltaTime;
verticalVelocity = 0f;
isDashing = true;
move = dashDir;
}
}
if (dashRecTimer > 0 && !isDashing)
dashRecTimer -= Time.deltaTime;
else if (isDashing)
dashRecTimer = dashRecTimer;
else
dashRecTimer = 0f;
}
void GroundSlamHandler()
{
if (Input.GetKeyDown(KeyCode.LeftControl) && !cc.isGrounded)
{
isGrounding = true;
verticalVelocity = -gravity * 5f;
move = Vector3.zero;
}
else if (isGrounding && !cc.isGrounded)
{
isGrounding = true;
verticalVelocity = -gravity * 5f;
move = Vector3.zero;
}
if (groundOver)
{
groundCoolTimer += Time.deltaTime;
if (groundCoolTimer >= groundCool)
{
groundOver = false;
groundCoolTimer = 0f;
}
else if (!cc.isGrounded)
{
}
else
{
move.x = 0f;
move.y = 0f;
}
}
}
void SlideHandler()
{
if (cc.isGrounded && !isGrounding && !isDashing && Input.GetKeyDown(KeyCode.LeftControl))
{
if (inputDir.sqrMagnitude > 0.01f)
{
slideDir = move * 1.5f;
}
else
{
slideDir = transform.forward * moveSpeed * 1.5f;
}
isSliding = true;
move = dashDir;
horizontalAirVel = new Vector3(slideDir.x, 0f, slideDir.z);
airVelocity = slideDir;
}
else if (isSliding == true)
{
if (wantsJump)
{
isSliding = false;
verticalVelocity = Mathf.Sqrt(jumpForce * 2 * gravity);
airVelocity = move;
horizontalAirVel = new Vector3(airVelocity.x, 0, airVelocity.z);
}
else if (Input.GetKeyUp(KeyCode.LeftControl))
{
isSliding = false;
}
else
{
move = slideDir;
}
}
}
}
// To do List:
// - Fix counting jumpNum when jumpNum > 1
// - Add wall jump
// - Fix slopes
// - Make movement speed up rather than being constant
r/UnityHelp • u/NoPrinciple1242 • Apr 21 '25
TEXTURES How setup URP for mobile
Hi, I need help setting up a URP scene to make it look nicer and more cartoony, like My Talking Tom.
r/UnityHelp • u/Alarming_Ruin_7874 • Apr 07 '25
PARTICLE SYSTEMS I NEED HELP WITH MESH RENDERERS FOR PARTICLES
I'm using mesh as the render mode With cube, it's fine. You can see the material With my own blender made mesh it's not fine. You cannot see the material Why and how to fix, PLEEAAASE and ty if you do
r/UnityHelp • u/GHOST_KJB • Jan 05 '25
UNITY Unable to activate free Personal license on Unity Hub 3.10.0
I am Unable to activate free Personal license on Unity Hub 3.10.0.
Screenshots of the process added.
I try to get a free personal license, then it just goes back to the first screenshot like nothing happened. I changed my DNS to Cloudflare and Google. I reinstalled it, but same issue.
I couldn't figure out how to generate a free Personal license online. Is that an option?
Note: this is on Fedora 41
r/UnityHelp • u/alonetimedev • Nov 01 '24
Hi, guys! I'm making Alone Time, a farming/survival game where you play a laid-off programmer trying to start over. You go to the countryside to take care of a farm, rescue cats, play music and create a cozy home. It's for those who enjoy a laid-back vibe with animals and music!
r/UnityHelp • u/Dismal_Ad_7682 • Oct 13 '24
My animation after importing to unity is bouncing.
r/UnityHelp • u/Ember_Kamura • May 22 '24
SOLVED Problem when importing textures from Blender
r/UnityHelp • u/normantas • Mar 09 '24
OTHER Reaserch Survey on Rogue-Like Games
Hey Reddit. I am a University student who is developing a melee action rogue like for a university project. I'd be extremely thankful who can fill out this anonymous survey.
As a bonus this survey results will be public for anyone else who needs this data or is interested.
Thank you!
Quick Link to Survey: https://forms.gle/FMGK5MzYWBmN4cpp9
r/UnityHelp • u/Geeknificent • Nov 24 '23
UNITY unity editor ignores leftclick/rightclick inputs from quest controllers
So I have scoured the documentation for unity and even tried to find answers to this weird issue but I have gotten no results for what im having specifically.
My issue is that i am editing VR projects in unity editor while also testing those projects in VR
I am using the Quest 2 and every application on my computer, even ones not designed for VR register my quest controller trigger as a left click/right click on hold.
But for some reason unity ignores this input even though by default oculus desktop/PCVR registers this input as left click/right click on hold for all other applications like chrome, notepad, visual studio, even desktop only games on steam register this as such. But again for some reason unity editor completely ignores this input.
Im trying to get unity editor to acknowledge this input so I dont have to keep removing my headset and go to my mouse and keyboard when I want to make a quick change in a project.
anyone know how to fix this?
r/UnityHelp • u/Sunillya • Jul 21 '23
MODELS/MESHES Problem with my Character from Blender
r/UnityHelp • u/Inflatable_Bridge • Jun 30 '23
