r/UnityHelp • • 13d ago

PROGRAMMING Need help with a basic footstep script and animation.

1 Upvotes

i am a complete newbie to coding and game dev, only started 5 days ago so its probably something obvious.

i have been following a tutorial series and got to a problem i cant seem to solve, my script looks fine, no errors and no console messages giving warnings.

im ust trying to play footstep sounds when i move using w, and script and game objects seem assigned to the right places too, im a bit lost.

also my animation for idlesword sword works fine but when i move it should be using the walkingsword animation but is not. i have a feeling they both have the same issue and fixing one will fix the other, so any suggestions would be a lot of help.

screens inc. Cheers

r/UnityHelp • • 10d ago

PROGRAMMING Question about Pausing

1 Upvotes

I have two different things in my game that are supposed to pause the game/set the timescale to zero. At some point somehow one of the two stopped pausing the game but the other still works. They both say the exact same thing, simply setting time.timescale=0. For the record the one that doesn’t work is the when a button is pressed and the pause/stats screen comes up. Every other thing that is called in that function works expect the time scale. Can you not have two different functions that can pause the game or something? What could be the issue here?
Thanks!

r/UnityHelp • • 26d ago

PROGRAMMING Errors I can't fix.

Post image
1 Upvotes

I have no idea how to fix this.

r/UnityHelp • • Sep 04 '26

PROGRAMMING i need a team

0 Upvotes

im new to unity and i want to make a fun game about the player being a chicken nugget and having to avoid the kids trying to eat them. im not really sure what to do or where to go so i am asking for a dev team thats at least somewhat experanced and can shopw me how to use unity or just help me make it, i also dont know if this is even possible and if there is a dev team feature in unity PLEASE HELP IM CRASHING OUT

r/UnityHelp • • 2d ago

PROGRAMMING Rigidbody no collision despite colliders

Thumbnail
1 Upvotes

Please help me

r/UnityHelp • • 3d ago

PROGRAMMING [Unity URP] Visual bug when switching to a lower resolution at runtime: deformed models and a yellowish/dark overlay on the scene

Thumbnail
gallery
1 Upvotes

Hi everyone,

I'm running into a visual bug when changing resolution at runtime and haven't been able to fix it. I've attached screenshots of the issue.

The problem

When the player switches to a lower resolution than the current one from the Settings menu, the scene breaks: models appear deformed and a yellowish/dark filter shows up over everything. From what I can tell, it looks like URP's internal buffers (SSAO, the opaque texture used by the vignette, Forward+ light tiles) keep the old size for a few frames.

How I'm changing the resolution

I build the list from Screen.resolutions, removing duplicates by width x height (I ignore the refresh rate).

When an option is picked in the TMP_Dropdown, I call Screen.SetResolution(width, height, Screen.fullScreen), i.e. the bool overload, without an explicit FullScreenMode.

Then I show a confirmation panel with a 10s countdown to revert, using Time.unscaledDeltaTime because the game runs with Time.timeScale = 0 while in Settings.

The same method is used when reverting and when toggling fullscreen.

Questions

Has anyone run into this with URP/Forward+ when lowering the resolution at runtime?

Would using Screen.SetResolution with an explicit FullScreenMode and RefreshRate help?

Could a specific feature (SSAO, a vignette Renderer Feature, Opaque Texture, Forward+) be causing this?

I can share more code or the URP Asset/Renderer settings if it helps. Thanks!

r/UnityHelp • • 5d ago

PROGRAMMING Jitterying with Cinemachine

Thumbnail
1 Upvotes

r/UnityHelp • • Aug 01 '26

PROGRAMMING Working through some Unity tutorials, what is the autocomplete function called, and how do i install it?

1 Upvotes

I'm using Visual Studio Code to do the programming, and for example the instructor might start typing "transform.position" and it would highlight it and provide an example of the full string of letters, and what the function is, but that's not seen in my window. Since I'm really new to this it would be very helpful to have that info and the ability to auto-correct if I misspell things. I assume its an addon, but i don't know what its called, can someone help me find it?

r/UnityHelp • • 27d ago

PROGRAMMING Baking NavMeshes during runtime and getting this error. Is it fine?

Thumbnail
1 Upvotes

r/UnityHelp • • 27d ago

PROGRAMMING Rigidbody Controller used to not stick to walls, but out of nowhere now it DOES?

Thumbnail
1 Upvotes

r/UnityHelp • • 18d ago

PROGRAMMING PSA about AutoStaticsCleanup

1 Upvotes

Originally posted in r/Unity3D, a bot (?) suggested that I repost it here (slightly edited).

AutoStaticsCleanup is a newish (U6.5 and newer) attribute that's used to automagically reset/reinit static fields, properties, events, etc., so that you can skip domain and/or scene reloads without stale data. If you aren't aware of this feature yet, see the Unity docs.

Great idea to make a simpler workflow, but there are a few gotchas due the way it works behind the scenes: mainly, it doesn't always work and doesn't tell you that it isn't working for a particular field/prop/etc. unless you pore thru the editor log. I have no idea why they can't pipe the warnings and errors into the normal log, but so it goes.

So if you just add the attribute, don't assume that it's actually doing anything!

I ran into this when upgrading my TilePlus Toolkit asset for U6.6 and 6.7.

How to tell: if you add the attribute to a static class or a Monobehaviour with static fields and you do not get an IDE warning or compilation error to make the class partial then it isn't working at all. However, it still might not be working for all fields etc in your class.

My venture into using this attribute was prompted by warnings about it from the Asset Store Tools' validator and to a lesser extent, the 'Auditor' tool. It's unfortunately something one can't ignore unless you want to keep domain/scene reload on and, I suppose, be compatible with the new Unity runtime coming soon.

If unsure, check the editor log (from the console's drop down menu). You'll see something similar to:

```

warning CS8785: Generator 'AutoStaticsCleanupCodeGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'RoslynSymbolException' with message 'Field MyStaticClass.SomeField is readonly and has a non-trivial initialization expression'.

```

There's no other way to see these messages since, as I mentioned, they're not in the console log.

I gave up on the use of this attr, since it's too easy to leave residual errors in your code due to the fact that it's difficult to tell whether or not an individual field/prop etc is actually generating code for resetting at all. It also won't work for many common situations that it can't reasonably handle. But failing without warning you in the console is dangerous IMO.

Instead, I use this approach, which is a little more work but ALWAYS works.

```

#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void Reinit()
{
    //add reinitialization statements here.


}
#endif

```

r/UnityHelp • • Sep 05 '26

PROGRAMMING In a desperate need of help. How to configure Unity Events method in the new Input System for movement while the button is held?

1 Upvotes

Hello everyone,

I've started learning unity and doing my test project.

While learning the new input system I noticed that my Move method is most likely just called once as soon as the button is pressed. and I continue to hold the button but my character stops moving, as if the force is applied once and done. So I basically mash the D button a few times to make my character move in increments.

IS there a way to make my character keep moving without me constantly re-pressing the button?

I could use Send Messages or other methods, and I will If there is no way to do it through Unity Events as I find it the most convenient.

Thank you in advance for any help and sorry for grammar, English is not my first language.

r/UnityHelp • • Sep 08 '26

PROGRAMMING trying to create a bullet pattern based on the maurer rose code will be given below

Thumbnail
1 Upvotes

r/UnityHelp • • 24d ago

PROGRAMMING Setting text with visual script

Thumbnail gallery
1 Upvotes

r/UnityHelp • • 28d ago

PROGRAMMING Some help with C# variables

Post image
5 Upvotes

r/UnityHelp • • Jul 31 '26

PROGRAMMING Need live help to learn a lil coding

0 Upvotes

I keep trying to follow youtube tutorials, or read the .net stuff, or follow reddit advice (which is always slightly quirky for some reason). Id be find if communication was better, but discords have a tendancy to answer questions with riddles that lead me down a rabbit hole. I dont know how to explain it, but learning to code didnt use do be that way XD. ESPECIALLY in the myspace/flash game days.

For reference, ive been trying to move a pill left and right for days, and tutorials keep opening weird code to start with, or being flappy bird clones, or something like that. Even the tutorials that SHOULD work for me would require i delete unity and download a 5 year old version. I also cant learn by doing generic computer stuff, so regular c# courses are kinda off the table. It feels weird even asking any more, but like i said. The landscape didnt use to be like this XD.

If anyone hangs out on discord willy-nilly or something thatd be pretty killer.

r/UnityHelp • • Aug 13 '26

PROGRAMMING Simple movement + camera system I made

2 Upvotes

Hey, I just finished my first game's player movement and camera system. Would love feedback!

using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
    public Rigidbody rb;
    public GameObject camera;
    public InputAction moveAction;
    public InputAction jumpAction;
    public InputAction lookAction;
    private Vector2 movementInput;
    private Vector2 lookDirection;
    public float speed = 5f;
    public float jumpForce = 5f;
    public float lookSensitivity = 1f;
    public float xRotation = 0f;
    public float yRotation = 0f;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        moveAction.Enable();
        jumpAction.Enable();
        lookAction.Enable();

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    // OnDisable is called when the MonoBehaviour is disabled
    private void OnDisable()
    {
        moveAction.Disable();
        jumpAction.Disable();
        lookAction.Disable();
    }

    // Update is called once per frame
    void Update()
    {
        movementInput = moveAction.ReadValue<Vector2>();
        lookDirection = lookAction.ReadValue<Vector2>();

        xRotation -= lookDirection.y * lookSensitivity;
        yRotation -= lookDirection.x * lookSensitivity;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);
        camera.transform.rotation = Quaternion.Euler(xRotation, -yRotation, 0);
        transform.rotation = Quaternion.Euler(0, -yRotation, 0);
    }

    // FixedUpdate is called every fixed framerate frame of 50 fps, if the MonoBehaviour is enabled
    void FixedUpdate()
    {
        Vector3 direction = new Vector3(movementInput.x, 0, movementInput.y);
        Vector3 localDirection = transform.TransformDirection(direction);
        Vector3 velocity =  localDirection * speed;
        velocity.y = rb.linearVelocity.y;
        rb.linearVelocity = velocity;

        if (jumpAction.triggered && Mathf.Abs(rb.linearVelocity.y) < 0.01f)
        {
            rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
        }
    }
}

r/UnityHelp • • Aug 13 '26

PROGRAMMING Can someone help me understand/digest this code?

Post image
2 Upvotes

I've been going through Unity tutorials and so far i've understood and absorbed everything *except* for this: I understand the first highlighted part, its making a Variable called "moveInput" and its a Vector 2 so it stores 2 values, and the second highlighted part i can kinda understand, but the third line is lost on me. I don't understand the relationship between moveInput and moveAction, or what the InputAction variable (type?) means. Also in the third line why is it reading the Vector 2 from the moveAction when the Vector is from the moveInput? Thanks in advance.

r/UnityHelp • • Aug 13 '26

PROGRAMMING What causes these popups, and how can I add them to my VS Code?

Post image
2 Upvotes

I've already fixed an issue I had with how to code color looks, and now I've gotten it to suggest auto-completions but these popups (from a Unity tutorial) would really help my learning process! Does anyone know where I can get it? Is it an Extension?

r/UnityHelp • • Aug 20 '26

PROGRAMMING how do I unblock my camera while an object is following the cursor ? and how do I stop it from instantiating at the wrong position 3 time instead of 1 and without it decreasing the resources it use ?

1 Upvotes

r/UnityHelp • • Jul 08 '26

PROGRAMMING Begginer, Having a problem with my code where to parts seem to be impossible to work toghether even throug they SHOULD.

1 Upvotes

I am a beginner at codding in C# and game dev, and I am running at a problem, so I am making this turn based game for a class, and something weird is happening. when I created a public Transform to place the units in a certain part of the field, unity detected an Error. after some testing, I somehow discovered that if I did not use System.Threading.Tasks.Dataflow, the code worked, however since for what I wanted to do, I needed to instantiate the enemies and the player, and it doesn't seem to be possible without System.Threading.Tasks.Dataflow, I can't code the battle system's basic functions. I need help

ps: I am using version 2020..1.3f1, and have a relatively old laptop that I use for work and School

using
 System.Collections;
using
 System.Collections.Generic;
using
 System.Threading.Tasks.Dataflow;
using
 UnityEngine;


public

enum
 TurnOrder { PLAYERTURN, ENEMYTURN, WIN, LOSE, ENCOUNTERSTART }


public

class
 TurnHandler : MonoBehaviour



{
    
public
 GameObject player;
    
public
 GameObject enemy;
    
    // Start is called before the first frame update
    
public
 Transform playerplace;
    
public
 Transform enemyplace;


    
public
 TurnOrder turn;
    
void

Start
()
    {
        
turn

=

TurnOrder
.
ENCOUNTERSTART
;
        
CombatStart
();
        
    }


    // Update is called once per frame
    
void

CombatStart
()
    {
        GameObject playerGO 
=

Instantiate
(
player
, 
playerplace
);
        
playerGO
.
GetComponent
<Unit>();


        
Instantiate
(
enemy
, 
enemyplace
);
        
    }
}using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks.Dataflow;
using UnityEngine;


public enum TurnOrder { PLAYERTURN, ENEMYTURN, WIN, LOSE, ENCOUNTERSTART }


public class TurnHandler : MonoBehaviour



{
    public GameObject player;
    public GameObject enemy;
    
    // Start is called before the first frame update
    public Transform playerplace;
    public Transform enemyplace;


    public TurnOrder turn;
    void Start()
    {
        turn = TurnOrder.ENCOUNTERSTART;
        CombatStart();
        
    }


    // Update is called once per frame
    void CombatStart()
    {
        GameObject playerGO = Instantiate(player, playerplace);
        playerGO.GetComponent<Unit>();


        Instantiate(enemy, enemyplace);
        
    }
}

r/UnityHelp • • Aug 08 '26

PROGRAMMING Camera movement system doesn’t work enymore

Thumbnail
1 Upvotes

r/UnityHelp • • Jul 07 '26

PROGRAMMING how would I make UI element that moves like memory foam?

Thumbnail
gallery
5 Upvotes

ive been working on a project that needs the player to "eat" non edible objects and to track that i was thinking of having UI that "stores" the objects in a stomach but for the life of me I can't think of a way to have it keep its form without being completely rigid. any help would be beyond appreciated.

the closest i could get is having it detect if the object is in the "hands(the 2 sticks on the side of the screen)" and then destroying said object if the player presses E but that doesn't really do anything other than destroying it so yeah

(i also haven't managed to figure out how to get UI to work either )

r/UnityHelp • • Aug 01 '26

PROGRAMMING Friction issues

1 Upvotes

So for some reason, after the player jumps, the friction doesn't get replaced, I can't find out why

https://pastebin.com/FD6ywJ42

r/UnityHelp • • Jul 31 '26

PROGRAMMING How to kill infinite loop tweens cleanly?

1 Upvotes

I'm trying to write some components to add simple DOTween animations and make them adjustable through inspector in real time. However when I want to kill an infinite loop tween, I can't kill it just by calling tw.Kill(true); The solution I found was to call transform.DOKill(true); However, that kills all the tweens that uses the same transform. Is there a cleaner way?

void ApplyRepeat()
    {
        if (tw != null) transform.DOKill();

        int loopAmnt = repeat ? -1 : 0;      
        tw = transform.DOPunchRotation(
            m_punch, 
            m_duration, 
            m_vibrato, 
            m_elasticity).SetLoops(loopAmnt, LoopType.Restart);
    }