r/UnityHelp • • Dec 14 '24

First game attempt. Probably just me being stupid, I'm following the 100 second Fireship Unity tutorial, but my player movement script isn't gaining a My_Rigidbody. Is my code fucked up (I copied it from the tutorial) or have I not installed something? Thank you so much for any help. I need it

0 Upvotes

Link to tutorial: https://www.youtube.com/watch?v=iqlH4okiQqg

I'm pretty sure I messed up somewhere installing VS? Any help is fantastic.


r/UnityHelp • • Jan 16 '25

PROGRAMMING I am working on a new game that will be about space shooter. I needed to add a method of rotating every time I move my mouse, so only this method was working for me.

Thumbnail
youtu.be
0 Upvotes

r/UnityHelp • • Jan 13 '25

How do I map the uvs of a custom mesh

0 Upvotes

Hey, I have been working on a 2d game for a bit now and the basic concept is that you race your friends down a hill while skiing (kind of like in alto's odyssey). The first thing I did was create a custom mesh for the terrain, but then I also want to assign a texture to it and that requires assigning the uvs.

Doesn't work as intended.

I was just wondering how you assign uv to a custom mesh.

also the pastebin to the whole script that generates the terrain : https://pastebin.pl/view/88f392bd


r/UnityHelp • • Jul 13 '24

Seeking Advice on Creating Realistic 3D Characters in Unity with Full Rigging and OpenAI Integration

0 Upvotes

I would like to ask about the best way to create a realistic 3D character in Unity, including rigging, so I can link it to OpenAI for full-body and facial animation. I’m looking for something similar to Metahuman in Unreal Engine, but my issue with Metahuman is the rigging since it doesn’t have a complete skeleton, making it impossible to achieve what I want. Any help or advice would be greatly appreciated. Thank you!


r/UnityHelp • • Jul 26 '24

I need help fixing my weapon switching in my unity 3d project.

0 Upvotes

Whenever i switch my weapon game objects what are nested under my camera by activating/deactivating them the camera doesnt stay consistent throughout all the weapon switching. It seems like each individual gameobject has its own camera save position, how do i fix this problem?

​
Here is a video:


r/UnityHelp • • Jul 31 '24

Help with camera code.

0 Upvotes

I have been following this tutorial series on how to make a 3rd person controller. it has been going good but the camera keeps going through walls that I placed and the code wont work. Here's the code :

using System;

using UnityEngine;

using UnityEngine.InputSystem;

public class CameraManager : MonoBehaviour

{ InputManager inputManager; public Transform targetTransform;

public Transform cameraPivot; public Transform cameraTransform;

public LayerMask collisionLayers; private float defaultPosition;

private Vector3 cameraFollowVelocity = Vector3.zero;

private Vector3 cameraVectorPosition = Vector3.zero;

public float cameraCollisionOffSet = 0.2f;

public float minimumCollisionOffSet = 0.2f;

public float cameraCollisionRadius = 0.2f;

public float CameraFollowSpeed = 0.2f;

public float cameraLookSpeed = 2;

public float cameraPivotSpeed = 2;

public float lookAngle; public float pivotAngle; public float minimumPivotAngle = -35;

public float maximumPivotAngle = 35;

private void Awake() { inputManager = FindObjectOfType<InputManager>(); targetTransform = FindObjectOfType<PlayerManager>().transform;

cameraTransform = Camera.main.transform;

defaultPosition = cameraTransform.localPosition.z;

}

public void HandleAllCameraMovement()

{

FollowPlayer(); RotateCamera(); HandleCameraCollisions();

}

private void FollowPlayer()

{

// Smoothly follow the player's position

Vector3 targetPosition = Vector3.SmoothDamp(transform.position, targetTransform.position, ref cameraFollowVelocity, CameraFollowSpeed);

transform.position = targetPosition;

}

private void RotateCamera()

{

// Calculate new camera rotation angles based on input lookAngle += inputManager.cameraInputX * cameraLookSpeed;

pivotAngle -= inputManager.cameraInputY * cameraPivotSpeed; pivotAngle = Mathf.Clamp(pivotAngle, minimumPivotAngle, maximumPivotAngle);

// Apply rotations to the camera and its pivot

Quaternion targetRotation = Quaternion.Euler(pivotAngle, lookAngle, 0);

transform.rotation = targetRotation;

}

private void HandleCameraCollisions()

{

float targetPosition = defaultPosition;

RaycastHit hit;

Vector3 direction = cameraTransform.position - cameraPivot.position;

direction.Normalize();

// Check for collisions using SphereCast

if (Physics.SphereCast(cameraPivot.transform.position, cameraCollisionRadius, direction, out hit, Mathf.Abs(targetPosition), collisionLayers))

{

// Adjust target position based on collision

float distance = Vector3.Distance(cameraPivot.position, hit.point);

targetPosition = -Mathf.Abs(targetPosition - (distance - cameraCollisionOffSet));

}

// Ensure target position does not go below minimum collision offset

if (Mathf.Abs(targetPosition) < minimumCollisionOffSet) { targetPosition = -minimumCollisionOffSet;

}

// Smoothly move camera towards target position

cameraVectorPosition.z = Mathf.Lerp(cameraTransform.localPosition.z, targetPosition, CameraFollowSpeed * Time.deltaTime); cameraTransform.localPosition = cameraVectorPosition;

}

}

If you could tell me how to fix this it would really help.


r/UnityHelp • • Feb 08 '25

New, to unity, stuff keeps dissapearing when i zoom, how do i fix

Post image
0 Upvotes

r/UnityHelp • • Feb 08 '25

Is it supposed to do this?

Post image
0 Upvotes

Idk If this is supposed to happen and or how long it'll take or if i'm supposed to do something


r/UnityHelp • • Feb 20 '25

My robot game's AI problem

Post image
0 Upvotes

I dowload the game but I think IA was not working, I asked her questions but it's always says <Patreon session invalid, reconnecti> what is this means?


r/UnityHelp • • Feb 08 '25

New, to unity, stuff keeps dissapearing when i zoom, how do i fix

Post image
0 Upvotes

r/UnityHelp • • Feb 23 '25

help please im trying to make a game in unity 3d but i cant jump

0 Upvotes

my code is

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class PlayerMovement : MonoBehaviour

{

[Header("Movement")]

public float moveSpeed;

public float groundDrag;

public float jumpForce;

public float jumpCooldown;

public float airMuiltiplier;

public bool readyToJump = true;

[Header("Keybinds")]

public KeyCode jumpKey = KeyCode.Space;

[Header("Ground Check")]

public float playerHeight;

public LayerMask whatIsGround;

bool grounded;

public Transform orientation;

float horizontalInput;

float verticalInput;

Vector3 moveDirection;

Rigidbody rb;

private Vector3 airMultiplier;

private void Start()

{

rb = GetComponent<Rigidbody>();

rb.freezeRotation = true;

}

private void Update()

{

grounded = Physics.Raycast(orientation.transform.position, Vector3.down, playerHeight * 0.5f + 0.2f, whatIsGround);

MyInput();

SpeedControl();

//handle drag

if (grounded)

rb.linearDamping = groundDrag;

else

rb.linearDamping = 0;

}

private void FixedUpdate()

{

MovePlayer();

}

private void MyInput()

{

horizontalInput = Input.GetAxisRaw("Horizontal");

verticalInput = Input.GetAxisRaw("Vertical");

// when to jump

if(Input.GetKey(jumpKey) && readyToJump && grounded)

{

readyToJump = false;

jump();

Invoke(nameof(ResetJump), jumpCooldown);

}

}

private void MovePlayer()

{

// calculate move direction

moveDirection = orientation.forward * verticalInput + orientation.right * horizontalInput;

// on ground

if (grounded)

rb.AddForce(moveDirection.normalized * moveSpeed * 10f, ForceMode.Force);

//in air

else if (!grounded)

rb.AddForce(moveDirection.normalized * moveSpeed * 10f + airMultiplier, ForceMode.Force);

moveSpeed = 10;

}

private void SpeedControl()

{

Vector3 flatVel = new(rb.linearVelocity.x, 0f, rb.linearVelocity.z);

//limit velocity if needed

if(flatVel.magnitude > moveSpeed)

{

Vector3 limitVel = flatVel.normalized * moveSpeed;

rb.linearVelocity = new Vector3(limitVel.x, rb.linearVelocity.y, limitVel.z);

}

}

private void jump()

{

// reset y velocity

rb.linearVelocity = new Vector3(rb.linearVelocity.x, 0f, rb.linearVelocity.z);

rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);

jumpForce = 30;

}

private void ResetJump()

{

readyToJump = true;

}

}


r/UnityHelp • • Feb 06 '25

help

0 Upvotes

can someone help me make a game


r/UnityHelp • • Jan 21 '22

Help I can’t edit or make a game

Post image
0 Upvotes

r/UnityHelp • • Oct 01 '24

PROGRAMMING How to Destroy Object on Tap in Unity 2D!

Thumbnail
youtu.be
0 Upvotes

r/UnityHelp • • Oct 09 '24

how do i get texture with just an obj file?

0 Upvotes

im pretty new to unity, and i recently 3d scanned something with a mobile app. i went to put the scan into unity, but it did not come with a texture file and was all gray. i would really like if i could somehow get the textures that are already in the file (i checked with multiple sources its just unity) because it has a lot of detail. does anyone know how to give it the original textures or do i have to do it myself?


r/UnityHelp • • Oct 15 '24

Goin through walls when moving irl vr.

0 Upvotes

I am using a character controller and a capsule collider on the VR rig. When I walk using the joystick into the wall, the collisions work fine but if I move in real life, I can just go in the wall. I tried using scripts to push the player back if they try to look in the wall but the corrections are harsh and disruptive even when i try to make it more smooth. Also if i move the headset really fast it still goes in the wall. Is there any fixes for this? How do i make it like this video?


r/UnityHelp • • Sep 24 '24

SOLVED I'm making a game director that makes enemy waves spawn based on how much credit there is to spend. I need documentation.

0 Upvotes

I already have:

  • Credits being generated into the credit wallet

  • Enemy spawn point

  • One enemy prefab spawning on the spawn point instead of a wave being generated

What i want to do:

-Spawn random enemy prefab on the spawn point and substract his cost from the credit wallet

WHAT I'M MISSING AND LOOKING FOR:

  • How do i asign a credit cost to an enemy prefab for the director to read it?

    Like this : Enemy prefab 1 costs 1 credit, Enemy prefab 2 costs 8 credits, Enemy prefab 3 costs 20 credits...

  • Where can i put these enemy prefabs for the director to randomly select them? Knowing that there are different levels with different enemies.

I hope there is a system built in unity or a fitting C# function that can help me.


r/UnityHelp • • Jun 17 '23

UNITY Devlog and tutorials available now on https://www.youtube.com/@yorecreator/playlists Come along on my journey!

Post image
0 Upvotes

r/UnityHelp • • May 22 '23

PROGRAMMING Hi there. Dan here 🙋🏻‍♂️ I have a question in regards to Unity running on M1 Air, programming a simple final year project on the comparison of A* vs. bi-directional A* in pathfinding of an indoor navigation system. Anyone with a similar project can guide me and drop your source code?

Thumbnail
gallery
0 Upvotes

r/UnityHelp • • May 24 '23

UNITY Unity

0 Upvotes

I have written a document about Unity and a basic user guide, everyone can watch and support me

https://www.studypool.com/services/27604879

thanks, everyone


r/UnityHelp • • Jun 24 '24

PROGRAMMING It claims that the code can’t be apllied but the code I borrowed it from used it

Post image
0 Upvotes

r/UnityHelp • • Jun 11 '24

SOLVED A problem with creating an ID

Post image
0 Upvotes

This textbox won't go away no matter what I do, and I asume there is the username box under it, which I can't access... how do I get rid of it?


r/UnityHelp • • Jun 02 '24

GTA clone in unity 2

Thumbnail
youtu.be
0 Upvotes

r/UnityHelp • • May 26 '24

Please help me guys

0 Upvotes

Hey my unity is not working correctly my problem is that it is not letting me make a new C# script I have tried a lot of diffent things that i found in different threads but none of them seem to work and this is my last resalt.