#💻┃code-beginner

1 messages · Page 655 of 1

slender nymph
#

the error is occuring on line 70 which does not match up with what you are showing. are you certain you've saved/compiled this code

naive pawn
#

aren't the yellow boxes indicating unsaved changes

slender nymph
#

probably, yeah

plucky sage
slender nymph
#

as pointed out, the error is pointing to a different line, save your code, recompile, and see if the error still occurs

plucky sage
digital haven
#

Like it doesn’t even show it’s baking or that a blue high light is around it. From what I gathered from the tutorial it shouldn’t take less than a minute/few seconds?

slender nymph
# plucky sage

great! now you just need to realize that you are looking at the wrong object or the object you are looking at had the array filled in after that method was called

slender nymph
# digital haven

baking that should be incredibly fast. we can also see that the navmesh data was created, did you perhaps disable gizmos?

digital haven
slender nymph
digital haven
#

Oh, now I feel silly

slender nymph
#

how long it takes depends on a lot of factors. what you showed should be fairly quick

digital haven
#

Yeah I got it now.

I’m planning to use this test game as a base.

I wanna create a horror game with puzzles, clues. Trying to leave a room by finding them and opening prompts.

It’s ambitious since it’s my first game, but I just want to start with making one room for it

vocal coyote
#

Im attempting to make a Player Lobby for readying up for a local couch co-op game, but can only find good tutorials for Hosted Multiplayer and Steam multiplayer, anyone have a good tutorial?

glossy crystal
#

Since there's a nice component system here where I can just tack on features as needed (its modular), should I use long inheritance chains less?

radiant meteor
#

is there a problem if i put a bunch of #region and #endregion in my code? i'm trying to keep stuff organized and being able to toggle out of view the stuff i dont need is nice

naive pawn
#

why would it be a problem? it doesn't have any runtime effect

#

it's purely an ide QoL thing

radiant meteor
#

just wanted to make sure lol

wintry quarry
radiant meteor
#

well, it's a player character with run, jump, attack and a few other minor things, i dont think i'll be needing to just jump or run or attack so i dont need to separate them

#

its better than to make code spaghetti like i did in another project where i put every character ability in separate scripts that comunicated with each other

#

one to move, one to jump, one to wall jump, one to dash, one to ground slam, one to slide on walls...

#

you get the idea

wintry quarry
#

Sure, I only said "potentially". Not making any judgements here based on no info

barren cosmos
#

hey guys i just started learning unity could you guys help me fix this issue which is i cant make a C# script for some reason :/

wintry quarry
#

third option from the top

barren cosmos
#

is it the same ?

wintry quarry
#

yes

barren cosmos
#

oh thx then

ripe shard
#

also you don't have to make those with a menu command, you can just make the file

grand snow
#

well the line numbers don't seem to match the error. Share your !code properly

eternal falconBOT
grand snow
#

ops seems i didnt scroll down to see the newer messages

barren cosmos
#

hey there in this code the player seems to be having a really wide jump its like theres so little gravity which i dont want, i want the player to jump be in the air for a couple of seconds then fall

naive pawn
#

!code

eternal falconBOT
naive pawn
#

share code properly

barren cosmos
#

i cant send a long msg no nitro

polar acorn
# barren cosmos sorry how?

If only a large block of text had appeared mere moments ago with the title "Posting Code" that explained how

barren cosmos
#

lol wait

spiral glen
#

is there a unity library thingy that lets me get the angle between two rays?

slender nymph
spiral glen
#

When I plug rays into Vector2.angle it says it doesn't work with rays

wintry quarry
spiral glen
#

oh ok

wintry quarry
#

Angle(a.direction, b.direction)

spiral glen
#

yeah that cleared up the errors

#

thanks

fading barn
#

Should I use character controller or rigidbody for first person player movement

#

What's the difference between the two

ripe shard
fading barn
#

Why so

ripe shard
#

because 'realistic' physics are generally not what you want for the behaviour of a player controller

#

so if you go with the simulation-approach you will be "fighting" the physics to get what you want

fading barn
#

But without physics (rigidbody) I have to do a lot of manual work like adding gravity through a function in a script.

#

Rigidbody seems easier. Just put constraints and I am good to go.

fading barn
#

Like written from scratch and not using the existing character controller that comes with unity

ripe shard
#

active rigidbody character controllers are only easier for about 5 minutes

ripe shard
# fading barn Can I make a custom character controller component

in 3D projects, unless you need something non-standard (character walking on the ground), you'd use this (free) asset https://assetstore.unity.com/packages/tools/physics/kinematic-character-controller-99131

Get the Kinematic Character Controller package from Philippe St-Amand and speed up your game development process. Find this & other Physics options on the Unity Asset Store.

fading barn
#

I want to make a hooking system like of bioshock infinite where we hook on to metal stuff

#

You have played bioshock infinite? If not just look at youtube

ripe shard
#

you can get very far with that asset above

#

it includes an example controller to get you oriented/started

fading barn
#

I am on phone right now otherwise I would have tried it

#

It's free right?

ripe shard
#

the meat of that asset is the 'motor' which solves pretty much all commone issues with character controllers

stiff peak
#

hi probably a silly question but i can't figure out how to implement a small delay inside a while loop (I'm trying to make a burst mode for a gun). I've been trying with a corroutine but it goes in a infinite loop, code snippet below: ```void Update()
{
if(!isReady || isShooting || isReloading){
return;
}

    else if(mode == fireMode.burst){
        if(Input.GetKeyDown(KeyCode.Mouse0)){
            while(burstCount>0){
                if(!isReady){
                    continue;
                }
                shoot();
                burstCount--;
                if (ammo == 0){
                    StartCoroutine(Reload());
                    break;
                }
                StartCoroutine(RecoverInBurst());//sets isReady flag
            }
            StartCoroutine(RecoverFromShot());
        }
    }```
#
        isReady = false;
        yield return new WaitForSeconds(recoveryBurstTime);
        isReady = true;
    }```
slender nymph
#

you probably want the loop inside the coroutine so you can yield return null; inside of it to wait a frame for each iteration. loops run until their condition is no longer met so it won't allow the frame to end

polar acorn
fading barn
#

How do I make a capsule grapple hook and fly like batman games

polar acorn
#

So, if burstCount is greater than 0 and isReady is false, literally nothing else will ever happen besides those two values getting checked until the universe ends

sour fulcrum
fading barn
#

All that just in first person

fading barn
sour fulcrum
#

not how it works

stiff peak
#

oh i thought the corroutine could still run , thank you i'll go implement the loop inside the IEnum

sour fulcrum
#

you have to learn how to know what to do

fading barn
polar acorn
fading barn
#

I will scroll through some tutorials

polar acorn
stiff peak
polar acorn
barren cosmos
#

can i make this texture detailed or is the texture itself too small?

polar acorn
#

and since the calling function isn't paused, and it isn't ending, the frame can never finish

barren cosmos
polar acorn
barren cosmos
#

mb jeez

rich adder
#

the blur is probably Filter mode on texture

fading barn
#

Nav mesh

barren cosmos
#

thx

high summit
#

Howdy folks, Using the starter assets fps controller and trying to make it work friendly with a pause menu, I have a public pause bool public static bool GameIsPaused = false;

inside the start assets input screen I have placed the if paused condition inside of every type of movement, and it does stop the movement in the pause screen. However, as you can see, If i am moving while i pause, when I unpause, it's still moving

#

(in the video near the end when im quickly pausing and unpausing, I am not pushing the W key)

polar acorn
#

If you're skipping over input reading when the game is paused, it's probably skipping over the release of the buttons as well

high summit
#

Ah i see what youre saying

#

Let me double check the pause logic

#

This is all that happens when the game pauses

#

Maybe stopping time means the button release isnt registered?

polar acorn
#

Well, and all the !newpauseLogic.GameIsPaused checks in your input callbacks

#

Which means that it doesn't read any inputs when the game is paused

#

which includes releasing of buttons

high summit
#

Oh rightttt

#

Trying to think of a solution

naive pawn
#

the release of a value type is provided as an InputValue with the value set to a 0 (for example Vector2.zero for a Get<Vector2>())

polar acorn
#

Probably don't eat inputs when the game is paused

high summit
#

How else could I disable them?

naive pawn
#

freeze the output, not the input

#

receive the input and update the internal state, but don't set that internal state to anything else like moving

polar acorn
high summit
#

I have the script here is that a bad thing?

#

It's not attached to anything

#

I'm obviously new to unity and kinda experimenting with what works and doesn't work

polar acorn
#

Not sure what that has to do with anything

high summit
#

Okay so that doesnt matter okay lol

polar acorn
#

Just, instead of checking for the pause before reading inputs, you want to check for the pause before doing things with the inputs

frail hawk
#

doesnt look like a script tho

polar acorn
#

Pressing W does not move your character. You have code that moves the character when you are pressing W

#

Instead of having your pause logic say "don't read W", you need it to say "Don't move when you get a W"

high summit
#

So if i put the input script in here and disable it during pause

#

that should work right?

#

Oh wait

polar acorn
#

Disabling a script means it no longer receives unity messages like Update, that might work but it depends on how you've coded it

high summit
#

I think my code works but only in these

#

My issue is I cannot drag the script thats attached to the gameobject that has the playerinput, into this 'scripttodisable' field

polar acorn
#

If that object has that script, it will work

high summit
#

okay so yeah that's given me the exact same result.

#

Surely there is code that actually makes the movement happen, in an update?

barren cosmos
#

what does this mean

high summit
wintry quarry
barren cosmos
#

how do i fix that

wintry quarry
#

add a camera I guess

old mortar
# barren cosmos what does this mean

when I added a texture render to my camera it said this, the tutorial I was following literally just said to uncheck the warning if you already have a camera.

high summit
polar acorn
wintry quarry
#

hence - there are no cameras rendering to the display

old mortar
#

ohh I see

#

Often I've moved the player around and the capsule gets disaligned with the Main Camera. And when I try to move the player it moves either one or the other. Is there a way I can connect the two and have the move and transform together?

steep rose
#

If you want to move both objects at the same time you can do CTRL + Click on them to select them both

old mortar
#

For some reason when I do that, the moving arrows appear all the way in the sky

wintry quarry
#

Press Z to toggle between Pivot and Center

#

You'll want it on Pivot

#

You definitely have it on Center right now

old mortar
#

Oh I was actually trying to find how to switch between those

#

thank you that fixes it

wintry quarry
#

Press the Tilde key in scene view to access the menu to show it again

#

Yes you're looking at your canvas

#

What has this to do with code?

barren cosmos
#

also chill dude i didnt hack the chat

#

just looking for help

odd barn
#

!code

eternal falconBOT
odd barn
#

Hi all,

https://paste.mod.gg/nrtsxcvntyth/0

I'm creating a clone of Asteroids to help me learn. This is my solution for spawning asteroids randomly around the map, but it's not instantiating the prefabs for some reason. I put debug messages throughout the code to make sure it's actually going through the entire coroutine and not getting caught somewhere, and it is! I've made sure to place the prefabs in the inspector. Is there something simple I'm overlooking?

lofty sequoia
#

If I subscribe to an Action with += do I have to call -= to avoid creating garbage/memory leaks if I set the action to null?

#

so if I did myEvent = null instead of myEvent -= myHandler, would that create garbage/memleaks?

high summit
#

So i'm looking to make some 'jumps' in my horror game, Obviously, I'm going to do alot of triggers when you hit certain trigger colliders, Whats the best way to have something happen only once, I'm assuming just use a bool variable?

brave compass
high summit
#

Yeah i get that I was just wondering the best way to make something happen once

#

Just did it with a bool

#

    private void OnTriggerEnter(Collider collision)
    {
        if (!happened1)
        audiosource.Play();
        happened1 = true;
    }
#

Also does anybody know if the starterassets first person controller has footsteps? I had footsteps working but seemingly the option has vanish so i'm kinda lost

rich adder
#

it used to afaik but I haven't touched them in a year or so

pine narwhal
#

Does anyone know why my changed states and transitions keep being deleted and reverting back to original states after I ctrl+s? I am using a free asset from itch.io

pine narwhal
#

this is the original animator that it keeps reverting back to

pine narwhal
high summit
#

Howdy! I'm trying to make a simple walking sound script. I have a long walking sound that goes on for like minutes, I want it to start whenever i'm holding W, A, S or d, and to stop when I let go. Someone suggested using a timer but I find that kinda confusing as i'm new right now.

#
    void Update()
    {
        if (Input.GetKeyDown("w"))
        {
            footstepsound.Play();
        }

        else

          if (Input.GetKeyUp("w"))
        {
            footstepsound.Pause();
        }
    }
}
#

Issue with this is, I think is keydown is going to keep going whilke I hold w

#

Actually it doesn't even play the sound at all

high summit
#

Yeah I need keycode. dont i

#

whoops

polar acorn
high summit
#

Oh wait so it should work in theory?

polar acorn
#

I would recommend using the keycodes though

wintry quarry
high summit
#

Sweet this works

odd barn
high summit
#

What site do you guys use to share code again

#

I have a slightly longest script thats abit much to paste here

#

!paste

#

/paste

spice loom
#

i have a script that detects collision with another capsule, i have tried OnCollisionEnter too & this code doesn't work, capsule has a rigid body with isKenematic on to prevent the capsule from falling:

using UnityEngine;
using UnityEngine.SceneManagement;

public class EnemyContact : MonoBehaviour
{
    public string scene2 = "Scene2";

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Enemy"))
        {
            Debug.Log("Enemy trigger entered! Loading scene...");
            SceneManager.LoadScene(scene2);
        }
    }
}```
spice loom
#

is there someone who can help?

#

i did try to put the name of the scene directly too

#

it didn't work

#

capsule's tag is "Enemy"

#

it doesn't print the debug.log stuff

rich adder
#

thought you said you fixed it ?

#

did you read or click the link at all....

spice loom
eternal needle
spice loom
#

OH, im so sorry ur right i did say it

high summit
#

!code

eternal falconBOT
rich adder
spice loom
#

but i meant the text i'm so sorry

spice loom
high summit
#

https://paste.mod.gg/rfekyihhcwax/0

Okay so i tried to make a basic footsteps script, Just running off the WASD keys, I have an issue though, I can see why it's happening but not sure on a fix.

If i'm walking with W. and I tap either A,S,D while still holding W, It picks up the Getkeyup from them and stops the sound. Any ideas how to resolve?

spice loom
teal viper
high summit
#

And only activate if it's not true

teal viper
high summit
#

It would yeah, My brain is staring at this knowing there is a simple fix but it's just not coming to my fingers lol.

teal viper
#

A simple fix would be to have a local variable that is set to false originally, then |= on each input.

#

You'd need to query if the key is being pressed at the moment instead of up/down

high summit
#

Pretty sure I just rewrote the same thing notlikethis

#

Seems to be giving me the same outcome.

rocky canyon
#
bool dirty = false;

if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D)) {
    dirty = true;
}

if (dirty) {
    Debug.Log("Input is dirty, char's probably moving");
} else {
    Debug.Log("Input is clean, flag was originally set to false at beginning of frame and no input ever set it dirty.");
}```
high summit
#
    void Update()
    {
        if (Input.GetKey(KeyCode.W) || (Input.GetKey(KeyCode.A) || (Input.GetKey(KeyCode.S) || (Input.GetKey(KeyCode.D)))))
        {
            iswalking = true;

            if (iswalking)
            {
                footstepsound.loop = true;
                footstepsound.Play();

            }
            else
                footstepsound.Stop();
            iswalking = false;


        }
#

Okay so like this?

#

It's making the sound when I'm not walking now (lol)

rocky canyon
#

yea i just used both these recommendations

rocky canyon
#

you just Invert the if statement

#

or invert the boolean

spice loom
high summit
#

I'm lost

#

I inverted the if statement

#

and it's doing the same

#

How is that possible

#

Actually maybe it didnt save my fauly

rocky canyon
#

why do u have the else if

spice loom
#

maybe "else if () {}"

rocky canyon
#

and why are u still using Downs and Ups?

twin pivot
high summit
#

I need the if to stop the sound no?

spice loom
twin pivot
#

-_- i ment which part of the code isnt working

rocky canyon
high summit
#

the audiosource will stop itself?

rocky canyon
#

only if the keys are being held GetKey not GetKeyDown or UP.. would it get swapped to true..

rocky canyon
high summit
#

Ah yeah that won't work

high summit
#

Also my bad i sent the wrong screenshot, I'm using getkey

twin pivot
rocky canyon
#
 void Update() {
        // Reset dirty flag at top of frame
        movementDirty = false;

        // Check if any movement key is pressed
        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D)) {
            movementDirty = true;
        }

        // Use the dirty flag to control audio
        if (movementDirty && !footstepSource.isPlaying) {
            footstepSource.Play();
        }

        if (!movementDirty && footstepSource.isPlaying) {
            footstepSource.Stop();
        }
    }```
spice loom
#

no

rocky canyon
spice loom
#

& it loads the scene

twin pivot
spice loom
high summit
rocky canyon
#

ya, to be sure it doesn't try to Play() when it already is..

#

or try to Stop() when it already is

twin pivot
rich adder
spice loom
#

breakpoints

#

etc

#

nothing works

rocky canyon
twin pivot
spice loom
#

is trigger?

twin pivot
#

(example of a trigger system being used for only certain gameobjects)

twin pivot
spice loom
#

no

#

lemme see

twin pivot
#

give the enemies an Enemy layer and exclude every other layer

spice loom
#

hope it works

#

it doesn't

#

btw its 3D

twin pivot
#

how does it not work -_-, give me more details

spice loom
#

the player just passes through the enemy

twin pivot
#

send a ss of the collider

spice loom
rocky canyon
spice loom
twin pivot
#

did you.... not tag your gameobject

spice loom
rocky canyon
#

works with capsule too

#

lol i forgot u were working with capsule

twin pivot
# spice loom

also why would you include player when you are checking for enemy collisions

twin pivot
rocky canyon
#

show both gameobjects.. and their inspectors..

#

full screenshots with components expanded

spice loom
#

ok

twin pivot
#

and also tell us if ur using ur old script or the one i sent

spice loom
rocky canyon
spice loom
rocky canyon
#

i like how u just made Everything Enemy.. lol

spice loom
#

but it is a component in the nemy

spice loom
twin pivot
rocky canyon
#

like this plz

spice loom
rocky canyon
#

minus the taskbar.. we dont care about ur taskbar

spice loom
#

player has character controller, enemy has rigid body

twin pivot
rocky canyon
#

we just want to see the rigidbody

twin pivot
#

and also more of the collider too

spice loom
#

i sent the collider

#

full collider

#

oh wait i didnt set the layers in the rigid body 🤣

rocky canyon
#

||just added rigidbody||

spice loom
spice loom
rocky canyon
#

lol.. u wasnt supposed to read that!

spice loom
#

lmao

twin pivot
spice loom
earnest sapphire
#

as a complete begginer to unity, what projects would you reccomend me doing? I'm currently working on a half decent flappy bird clone with a shop, multiple difficulties and power ups (first ever project). I'm half decent at 2D art, 3D art, Music production, sound design and some other technical and arty kinda skills.

twin pivot
spice loom
#

already done

earnest sapphire
rocky canyon
rocky canyon
#

idk those usually pretty good to get u goin enuff to want to break off on ur own

twin pivot
earnest sapphire
#

yeah, so clones of pretty basic games to begin with then

eternal falconBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

rocky canyon
#

if u really want a challenge u could make u a little Pokemon clone

rocky canyon
spice loom
twin pivot
rocky canyon
#

lol.. u could probably do the OG version

spice loom
earnest sapphire
rocky canyon
#

test with just the most basics of basics...

spice loom
rocky canyon
#

then theres something MAJORLY wrong

earnest sapphire
#

yeah, well experimenting is one way to learn

spice loom
#

collision code is harder than making an AAA game itself 😭

earnest sapphire
#

2D collisions seem to be fine (for now)

spice loom
#

3D collisions is hell

earnest sapphire
#

urmm, it isn't open in my taskbar, what am I looking for in task manager to close it?

rocky canyon
earnest sapphire
rocky canyon
earnest sapphire
#

got it

rocky canyon
#

i think it may be a HUB bug..

earnest sapphire
#

yeah

rocky canyon
#

if i open more than 2 project theres always one that seems to go missing

#

that i can't even find.. (i can hover over my taskbar and see the preview) but when i click that. nothing happens

spice loom
#

man idk it only works for u

#

chatgpt time ig?

earnest sapphire
rocky canyon
#

ur probably just overlooking something really simple..

earnest sapphire
#

I should probably add something to the buttons, like making them larger and flash a bit when they are clicked

rocky canyon
#

one of those facepalm moments.. once we realize what it actually is 😅

spice loom
#

collisions should be simple 😭

twin pivot
rocky canyon
#

hacks!

earnest sapphire
#

its a powerup

rocky canyon
#

atleast im not alone 💪 lol

spice loom
#

doesn't work for me tho :)

rocky canyon
#

you guys names are too similar lol

spice loom
twin pivot
#

ur doing sth wrong because that should work for literally everyone

rocky canyon
#

KrayTik and Kyran

earnest sapphire
#

also in the video, u might see the fish particles briefly overlap with the pipes, any idea how I can fix it? I've tried using different layers for the Game Objects and stuff but everything I have tried doesnt seem to work

spice loom
spice loom
rocky canyon
#

2nd thing i thought was his rigidbody is not on the collider or above the collider..

spice loom
#

i have a character controller on the player

rocky canyon
#

ahh, okay so its a Character Controller.. those will work with Triggers afaik

twin pivot
spice loom
#

god damn how does this shit not work

twin pivot
#

its under the sprite renderer

spice loom
#

i'm deleting this code shit

earnest sapphire
#

but that means the fish are also infront of the pipes?

twin pivot
earnest sapphire
#

yep

earnest sapphire
#

idk yet

#

I've set up a few sorting layers, no many but now this is happening

twin pivot
#

ah, u got the order wrong

earnest sapphire
#

so top should be background

twin pivot
#

yup

earnest sapphire
#

ah ok

#

alr Ima test it

#

nope, the fishes still briefly go over the pipes and then go under

twin pivot
#

hmm hold on

twin pivot
earnest sapphire
twin pivot
#

did you assign the layers to the particles?

earnest sapphire
#

wait, I'm not sure, where do I even find the sorting layer for a particle system?

#

yeah, however the order in layer was set to -1 for some reason

twin pivot
#

and the pipes are at sorting layer 3?

earnest sapphire
twin pivot
#

and the bug still happens?

earnest sapphire
#

yeah

twin pivot
#

in that case i have no idea why thats happening

earnest sapphire
#

yeah, I asked chatGPT and a few other AI's the same thing, they all said they can't help me lol

twin pivot
#

imo, asking ai for help is a bad idea

earnest sapphire
#

yeah

#

I've been trying to fix this bug for a few days now, maybe over a week, I can't figure it out lol

rocky canyon
#

can u make the pipes farther on top?

earnest sapphire
#

wdym? like add filler layers in between?

rocky canyon
#

on top of everything perhaps? just askin, i ahvent been keeping up with the convo

earnest sapphire
#

they are already

rocky canyon
#

oh ok

twin pivot
rocky canyon
#

strange

earnest sapphire
#

yeah

teal viper
rocky canyon
#

the calvary!

earnest sapphire
teal viper
earnest sapphire
teal viper
#

Ok, so the camera is orthographic.
What I'd do next is pause the game when the issue happens, and inspect the draw calls via the frame debugger.

earnest sapphire
#

what are draw calls? and where do I find the frame debugger? sorry lol

teal viper
earnest sapphire
#

alright

teal viper
#

Also, before everything else, I'd inspect the issue in the scene view.

#

paue the game, switch to scene view, switch the view to 3d, rotate the camera and see if that fish is physically in front of the pipe

earnest sapphire
#

I think I found my issue, the particles must have velocity on the z axis

#

I think its the z anyways

teal viper
#

It is. Make sure you don't apply velocity on z.

earnest sapphire
#

no? only on the x which is whats causing them to move across

teal viper
#

Take a screenshot of the whole particle system object

twin pivot
#

maybe the particles are spawning on a randomized z axis?

earnest sapphire
#

or both

teal viper
#

Or both

earnest sapphire
#

if ur wondering why the material is called clouds, its bc my original idea for the scene was for it to be in the sky like normal flappy bird and these were meant to be clouds, but I shifted from that, I should probably rename it lol

teal viper
# earnest sapphire

Several things that bother me:

  1. Renderer mode being billboard. I wonder if it makes the sprites rotate towards the camera and clipping through the pipes because of that. You don't need them to be billboards if the camera is orthographic.
  2. Shape being a box/ emit from volume and the scale of the box is 1 on the z axis. This might cause the particles to spawn at varying z positions.
earnest sapphire
#

ok so which render mode should I set it too?

teal viper
#

What are the options?

earnest sapphire
#

oh and theres the options for shape

#

should probably be sprite renderer now that I think about it, however idk?

teal viper
teal viper
earnest sapphire
#

so I should change render alignment from view to local?

teal viper
#

You should make it a habit of reading the documentation/manual about features you have never used

queen adder
earnest sapphire
#

rectancgle still has the same issue

acoustic sequoia
#

Hey Everyone! I'm trying to figure out the best way to do some kind of Queue system with Vector3's.
online it says to use: myQueue = new Queue<Vector3>();

but does this have like a Push(); Pop(); functionality that i can use?

earnest sapphire
#

although moving it behind the pipes should work, right? it wouldnt fix the fact that they are moving in the wrong dimensions but it would fix the fact that they are infront of pipes temporarily?

cosmic dagger
teal viper
teal viper
earnest sapphire
teal viper
#

Also, try disabling the noise module to see if it fixes it

earnest sapphire
#

both are no

#

I did fix my original bug of them going infront however they still move on the z axis so yk

teal viper
earnest sapphire
#

moving

teal viper
#

Take a screenshot of the main module. I just realized that it's folded.

earnest sapphire
teal viper
# earnest sapphire

Click on the arrow next to start speed. You should be able to modify each axis separately. Or set the start speed to 0.

earnest sapphire
#

oh wait... setting it to 0 works

#

maybe the direction that start speed moves in is the z

teal viper
earnest sapphire
#

yeah, will probably check it out, thanks

spiral glen
#
Vector2 playerPos = GameObject.FindGameObjectWithTag("Player").transform.position;
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

float distance = Vector2.Distance(playerPos, mousePos);

if (distance <= range)
    transform.position = mousePos;
else
    transform.position = playerPos + ((mousePos - playerPos).normalized * range);

// Rotation
Vector2 toShield = new Vector2(transform.position.x - playerPos.x, transform.position.y - playerPos.y);
Vector2 playerRight = GameObject.FindGameObjectWithTag("Player").transform.right;
float angle = Vector2.SignedAngle(playerRight, toShield);
transform.rotation = Quaternion.Euler(0, 0, angle);

// Velocity calc
velocity = rb.angularVelocity;
print(velocity);```

Hey epic lads, why isn't my velocity ever changing?
#

I'm trying to change the color of my object when the velocity reaches a certain amount

teal viper
spiral glen
#
{

    [SerializeField] float range;

    public float velocity;

    private Rigidbody2D rb;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        // Movement around range
        Vector2 playerPos = GameObject.FindGameObjectWithTag("Player").transform.position;
        Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        float distance = Vector2.Distance(playerPos, mousePos);

        if (distance <= range)
            transform.position = mousePos;
        else
            transform.position = playerPos + ((mousePos - playerPos).normalized * range);

        // Rotation
        Vector2 toShield = new Vector2(transform.position.x - playerPos.x, transform.position.y - playerPos.y);
        Vector2 playerRight = GameObject.FindGameObjectWithTag("Player").transform.right;
        float angle = Vector2.SignedAngle(playerRight, toShield);
        transform.rotation = Quaternion.Euler(0, 0, angle);

        // Velocity calc
        velocity = rb.angularVelocity;
        print(velocity);
    }
}```
mb should of shown the full thing
#

I set it to public just so I could see the actual value

teal viper
spiral glen
#

oh

#

yeah that makes sense

teal viper
#

If you're thinking the velocity can be inferrred from modifying the transform position, then you're wrong. At least the physics system doesn't do that and shouldn't.

spiral glen
#

yeah that should of been common sense mb, thanks

tribal gazelle
#

Sup guys

#

I wanna learn unity but i am lost

teal viper
teal viper
eternal falconBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

tribal gazelle
#

I think i should learn basics first and then just learn by making stuff

#

Ty

teal viper
teal viper
ripe shard
tribal gazelle
#

I will also participate in game jams

ripe shard
#

you'll have to figure out how serious you are about making games, depending on that you should decide which people's advice to follow and what resources are suitable for your goals

tribal gazelle
#

Thank you for the tips man

wind holly
naive pawn
rocky canyon
#

do the walking tutorials and then change out to ur running shoes >8)

astral flame
#

Hi, I have a problem with this code. The NPC doesn't move. I've already used the navmeshagent, but it doesn't move. It only moves if the player pushes it. Well, it does the animation, but it doesn't move where it should go. I also put an objective on it, but still, yes=it doesn't do anything. Look, here's the code.
https://paste.myst.rs/qc0buxj4

wind holly
#

if i increase the time.timescale in unity project setting, is it normal for the object to move faster in real time right?

keen dew
#

That's what it's for, yes

wind holly
median hatch
#

also just for testing set the destination of one in the Start() method

#

see what happens

astral flame
median hatch
#

sure why not

astral flame
#

I have a sh#tty laptop that's why

median hatch
#

thought the reason was more interesting

#

anyw

#

did you try putting the destination in Start()?

#

also see if you baked it

wind holly
#

Could anyone give some feedback on the movement script? the axisspeedlimit is intended to create a elliptical speed profile. currently there is still a bug with accelerated diagonal movement that i am trying to figure out.

eternal falconBOT
fast relic
night raptor
#

@wind holly Is there a reason not to normalize when the magnitude is less than 1? if not so, you shouldn't check as cookie said. Even if you need it, you would end up calculating the square root twice (.magnitude and .normalize) which you could avoid by using Vector3.ClampMagnitude (one root)

glossy crystal
#

If I want to detect when someone is crossing a door, should I use a boxcollider? Is this a bad idea? I'm not sure how I would handle collision then between the player object and the door if I use a box collider to detect crossing the door's threshold

#

nvm im dumb

#

but is this standard? or is it a hacky solution? using box collider to see if something crosses a door in game

night raptor
glossy crystal
#

oh i was using a regular one I'll take a look at trigger collider thanks

night raptor
night raptor
shut swallow
#
        _requestedCrouch = input.Crouch switch
        {
            CrouchInput.Toggle => !_requestedCrouch,
            CrouchInput.None => _requestedCrouch,
            _ => _requestedCrouch 
        };```
#

got any ideas how to change this into a hold crouch system instead

#
{
        _requestedCrouch = input.Crouch switch //CrouchInput is a enum
        {
            CrouchInput.Toggle => !_requestedCrouch,
            CrouchInput.None => _requestedCrouch,
        if (_crouchSwitch && InputActions.Crouch.WasPressedThisFrame)
        {
            CrouchInput.Hold => _requestedCrouch
        }
        else if (_crouchSwitch && InputActions.Crouch.WasReleasedThisFrame)
        {
            CrouchInput.Hold => !_requestedCrouch
        }
            _ => _requestedCrouch 
        };
}``` tried this but doesn't seem to work as intended
wind holly
naive pawn
wind holly
shut swallow
wind holly
shut swallow
naive pawn
shut swallow
#

mb

naive pawn
#

if that's not immediately flagged in your ide, you need to configure it

fast relic
shut swallow
#

was just messing around and trying things out

#

but yea i should configure it

naive pawn
#

you have to configure it, it's a requirement to get support here

#

!ide

eternal falconBOT
naive pawn
#

anyways, in general you can't just "try things out" with random language features/syntax and expect it to work

#

when is CrouchHandling called?

shut swallow
#

nvm i have it config'd

#

called on update

naive pawn
#

every frame?

shut swallow
#

yes

#

the original code was a toggle

#

wanted to make into a hybrid system

naive pawn
#

so it'd toggle every frame...?

shut swallow
#

no

naive pawn
#

what's input from, how's it set

#

you're leaving out quite a bit of context

shut swallow
#

it'll only switch when the button is pressed

            CrouchInput.None => _requestedCrouch,``` flips the _requestedCrouch state if and only if you press crouch
shut swallow
naive pawn
#

so sounds like you'd need to either:

  1. have 2 extra states, Press and Release, which would yield a value of true and false respectively
  • then from Player.Update, choose whether to send Toggle or Press/Release depending on whether toggle or hold is set
  1. remove Toggle and use Press/Release, which are sent according to the button state
  • then from PlayerCharacter.UpdateInput, choose how to handle the input depending on whether toggle or hold is set
    though both might have issues if it's released in the same frame it was pressed. im not sure that's possible though
wind holly
shut swallow
#

lemme try implement it

naive pawn
#

pressing and releasing a button in the same frame can definitely happen, but does "was released" trigger on the same frame or the subsequent frame? that's what matters

silent vault
#

Hello, I'm a bit confused with how Unity initialize materials. I have a model with a skinned mesh renderer which has 3 material slots. 2 of those slot use the same material in the editor. But when I launch the game, those materials are replaced by instanced materials, and each slot as a different material instead of the 2 similar slot using the same instanced one. Can I only fix this using code or is there a setting in Unity to tell to optimize material initialization to keep it like it is in the editor ?

fast relic
naive pawn
shut swallow
#

so then i run a simple if statement to check if the crouch was toggled or not

#

the if(crouchSwap) should be outside then have my original code nested in one end and the hold system on the else statement

naive pawn
#

you don't need an extra enum in either case, just extra enum members

shut swallow
#

so i add the states Pressed, Released

naive pawn
#

which method you choose depends on where you want to store "should crouch be held or toggled"

shut swallow
#

in the original snippet then do i need to declare their behavior?
like CrouchInput.Pressed => _requestedCrouch?

naive pawn
#

yeah, so you can handle that kind of input (as in, between classes)

shut swallow
#

right

#

I'll try to implement this and troubleshoot it

wooden star
#

When i press LeftShift the dash doesent work. Ive tried binding it to many keys bu the only one that works is D

naive pawn
#

have you tried debugging the separate conditions?
also, what method is this code in?

wooden star
naive pawn
#

no, don't

#

!code

eternal falconBOT
wooden star
naive pawn
#

see the bot message about posting code

wooden star
#

ill just show a small bit

naive pawn
#

!screenshot

#

what's the command....

shut swallow
#
                ? CrouchInput.Toggle
                : CrouchInput.None```
From the player.cs, how should I handle the Enum's additional states?
wooden star
naive pawn
#

!screenshots

eternal falconBOT
#

mad No

Be mindful, if someone requests your code as text, don't send a screenshot!

shut swallow
wind holly
naive pawn
naive pawn
wooden star
naive pawn
wooden star
#

do i just put the is dashing above rb.linearVelocity?

naive pawn
#

sure, that'd work

wooden star
#

thanks

glossy crystal
#

Do people use the tagging system? Or just store the tag data as some sort of enum?

#

the 1 tag per object seems pretty bad unless I'm missing something that allows for more than just 1

naive pawn
#

probably depends on the person

#

i don't really use tags at all

shut swallow
# naive pawn if you're on toggle mode, use the existing logic if you're on hold mode, send `P...

i get that but it's more like I'm not too sure how to actually code the scenario

        {
            Rotation    = playerCamera.transform.rotation,
            Move        = input.Move.ReadValue<Vector2>(),
            Jump        = input.Jump.WasPressedThisFrame(),
            JumpSustain = input.Jump.IsPressed(),
            if (!crouchStateToggle)
            {
                Crouch  = input.Crouch.WasPressedThisFrame()
                    ? CrouchInput.Toggle
                    : CrouchInput.None
            }
            else
            {
                if (input.Crouch.WasPressedThisFrame)
                {
                    ? CrouchInput.Pressed
                    : CrouchInput.None
                }
                else if (input.Crouch.WasReleasedThisFrame)
                {
                    ? CrouchInput.Released
                    : CrouchInput.None
                }
            }
        };```
something like this?
woven scaffold
#

ok vscode question. the c# devkit has broken once again, or it just doesnt correctly find the scripts for whatever unknown reason. what should i do? just revert back to an older version? just before it broke i think i somehow didnt have the devkit enabled or something and it was working flawlessly. but now with it on nothing is working twitchOP

#

onmisharp is like the most unstable thing i've ever seen in an IDE. its actually crazy

naive pawn
#

could you be more specific about what the issue is?

#

what versions of stuff are you using?

woven scaffold
#

intelisesne is just not working at all

#

and every file i have it says this:

[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
        Analyzer work cancelled.
[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
        No symbol found. File: [my file here]
woven scaffold
#

for vscode:
C# language support extension: v2.72.34
C# Devkit Extension: v1.18.25

for unity:
Visual Studio Code Editor: 1.2.5
Visual Studio Editor: 2.0.23

naive pawn
#

what's your vscode version?

woven scaffold
#

and yes the selected IDE in unity is vscode

#

where do i see that?

naive pawn
#

uhh, wherever you check the version for most apps for your os?

#

like here for mac for example, but idk for windows, haven't touched it in a hot while

woven scaffold
#

Version: 1.99.3 (user setup)
Commit: 17baf841131aa23349f217ca7c570c76ee87b957
Date: 2025-04-15T23:18:46.076Z
Electron: 34.3.2
ElectronBuildId: 11161073
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26100

naive pawn
#

and everything's up-to-date?

woven scaffold
#

i havent checked if vscode is, ill run the update real quick but everything else should be

#

ah yeah ,vscode is fully updated too

#

so as far as i know yes

naive pawn
#

do you have any logs beyond what you got in output?

woven scaffold
#

holdon, it says something about file paths "exceeds the OS max path limit. The fully qualified file name must be less than 260 characters."
which i assume is resulting in this error:

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: c:\Users\Documents\GitHub\Unity-Package-Development-Space\PackageDev\LUTTextureGenerator.csproj
#

could it be thats whats causing the issue here? just too long paths??

#

but how then did it work before and not now?

naive pawn
#

seems odd that that issue would pop up just now yeah

woven scaffold
#

i dont really know what i can do about too long path names anyway. like i dont really want my files to be less descriptive of what they are lol

#

what, thats crazy

#

i disabled omnisharp and its back to working

#

who knew using omnisharp was a bad idea

hexed nymph
#

Yooooo guys

#

I have an issue

#

how do I call a function of the object that collided with another one??

#
    {
        if (isP1 == true)
        {
            if (other.transform.CompareTag("P2"))
            {
                var genThing : GeneralThing = other.gameObject.GetComponent(GeneralThing);
                genThing.RemoveVida(damage);
            }
        }
    }```
#

I tried this but it didn't work

#

"GeneralThing" is the script I want to call when it collides

#

this is the error I get

eternal needle
eternal falconBOT
hexed nymph
#

Idk what does it means

verbal dome
#

You got some weird syntax going on there. Look online for examples how to actually use GetComponent

naive pawn
#

did you do typescript guides or something

#

that's not c# syntax

hexed nymph
#

and I paste it

#

but it didn't work

naive pawn
#

yeah that's ts, not cs

verbal dome
#

That is ancient isnt it

hexed nymph
#

ohhhh

wintry quarry
naive pawn
#

unity doesn't support ts anymore afaik

wintry quarry
#

What's the date there lol

hexed nymph
#

its 2014 😭

naive pawn
#

not even const 🤮

wintry quarry
#

Yeah unity used to support a JavaScript derivative

naive pawn
#

oh derivative, huh

brave compass
#

It was a custom language Unity made that intentionally resembled JavaScript, but actually had nothing to do with it. It compiled to .NET, same as the Boo language.

eternal needle
hexed nymph
#

okok thanks

hexed nymph
#

sup guys

hexed nymph
#

but for some reason the trigger does not work

rich adder
glossy crystal
#

In what order is OnCollisionEnter executed ?

hexed nymph
slender nymph
#

congrats, go through the entire troubleshooting steps

rich adder
#

the guide has several steps mate..

#

do people just click 1 thing and go "oh well it aint it.."

glossy crystal
#

sadok i will look

#

Ok sorry I see the flowchart for the execution order, but maybe I'm missing something but when 2 objects collide, is it random for which one is executed first?

#

maybe its on the bottom of the page il keep reading

naive pawn
#

it's deterministic/consistent, but don't rely on the specific order

polar acorn
eternal needle
glossy crystal
#

yes I was following a tutorial and they have Player colliding into an object, the object changes its tag when collided into and the player checks the object's tag, to execute something in its own oncollisionenter function

#

this sounds like a victim to the execution order

slender nymph
#

that also just sounds like bad design. why can't one of the two objects just call a method on the other instead

glossy crystal
#

i know ahahah i want to change stuff but I just want to learn unity basics rn and dont want to end up with a codebase diverging from the tutorial

rich adder
#

well it might be better if the tutorial is bad lol

eternal needle
glossy crystal
#

ya for sure, I just am missing the basics of unity lol I don't know the tools available to me yet

#

like i didn't know cinemachine was a thing, I had to manually do camera stuff in monogame and thought i would have to do it in unity too

rich adder
#

well you had to before cinemachine was basically bought off from unity. It used to be a paid asset

eternal needle
glossy crystal
#

must have been the dark ages

eternal needle
#

lots of tutorials just have plain wrong information, or whatever they're doing only works specifically for the video. everything gets bad once you try expanding on it

topaz steeple
#

hey

rich adder
#

most solutions are specific to a project anyway, you're meant to takeaway the approach someone used then you can better it yourself but you do need to know more

slender nymph
#

yeah learn the concepts, not the specific implementation

rich adder
topaz steeple
#

sorry my bad

sonic jetty
#

Hello guys! I do have a problem. Currently im trying to make something lock in place, and then start moving again. My problem is that im trying to make something like:

 ball.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezePositionY;

And then to free it i do

        ball.constraints = RigidbodyConstraints2D.None;

But atfer i unlock it, my ball stays mid air. Someone can give me a hint on this?

rocky canyon
#

and is it simulated?

sonic jetty
#

Yes. Id does.

wintry quarry
#

And is it awake?

polar acorn
#

And is it non-kinematic?

rocky canyon
#

lol

#

✅ list

polar acorn
#

Turns out there's a whole buttload of reasons a rigidbody might not move

rocky canyon
#

if its not working in code i usually replicate the logic on my own in the inspector.. at runtime..

#

can u check constraints in the inspector and then disable them and have it work as desired?

#

if that works i turn my attention back to code

sonic jetty
#

Hmm...it is checked, but i dont know what non-kinematic is. An easy fix that i found was to give it a very very small force on it, or in the inspector i have to check the use auto mass, but it doesnt change the gravity in any value.

naive pawn
#

non-kinematic means the rigidbody is set to dynamic

slender nymph
#

if giving it a very small amount of force makes it start moving again then it sounds like it was asleep

sonic jetty
#

What does it mean that is asleep?

wintry quarry
#

The physics engine puts non moving rbs to sleep

#

as an optimization

#

so it doesn't have to do any computation for them

sonic jetty
#

This worked. Thank you very much!

odd quail
odd quail
#

also unsure where the output is if any.

rocky canyon
rocky canyon
#

always best to take a peek and see what the code ur importing does. lol

#

test scene probably has all the info u need

#

im robbing that SanitizeFilename() method

odd quail
#

mayeb this isnt doing what I want then, I just want to convert the rendertexture of my rendercamera to a static image seperate of the render camera

rocky canyon
#

ahh tahts simple then eh?

#

just create a Texture2D variable.. and then in ur code u could set it to the rendertexture

odd quail
#

but when I leave the scene the rendertexture becomes blank

rocky canyon
#

ud still need to save it somehow

edgy prism
#

Hello could anyone be so kind as to explain to me why I get the compiler error

CS0120 An object reference is required for the non-static field, method, or property

On my CharacterAnimator reference?

private CharacterAnimator playerChar;

private void Awake()
    {
        i = this;
        character = GetComponent<Character>();
        playerChar = PlayerController.i.GetComponent<CharacterAnimator>();
        PlayerController.OnPlayerStep += HandlePlayerStep;
    }
naive pawn
#

where, exactly?

wintry quarry
rocky canyon
#

@odd quail ☝️

wintry quarry
naive pawn
#

i sounds like it's for a singleton

edgy prism
wintry quarry
edgy prism
# wintry quarry So which line is throwing the error exactly? Share all of the relevant informati...

Yes sir,

So I get the error on any line I try and reference my playerChar variable, atm only here

public static Vector2 GetSnappedPosition(Vector2 moveVec)
    {

        Vector3 moveOffset = Vector3.zero;

        if (playerChar.MoveY == 1) 
            moveOffset = new Vector3(0, 0, -0.5f); // Player moving Up
        else if (playerChar.MoveY == -1)
            moveOffset = new Vector3(0, 0, 1.5f); // Player moving Down
        else if (playerChar.MoveX == 1)
            moveOffset = new Vector3(-1, 0, 0.75f); // Player moving Left
        else if (playerChar.MoveX == -1)
            moveOffset = new Vector3(1, 0, 0.75f); // Player moving Right

        return moveOffset;
    }

The full error is: CS0120: An object reference is required for the non-static field, method, or property 'PetController.playerChar'

wintry quarry
#

Cna you please just share the full error merssage

#

and the full script

#

that will make this a lot easier

#

you are overcomplicating things

naive pawn
#

you can't access an instance field directly from a static context, you need an instance, and a static context doesn't have an instance

wintry quarry
#

Right so the code you shared earlier wasn't relevant to the error at all 🥹

naive pawn
#

well, the first line with the declaration was

edgy prism
#

What im completely confused, I get the error on the variable itself? so how can that not be relevant

#

!code

eternal falconBOT
wintry quarry
#

wdym by you get the error on the variable itself? That particular error is not going to be present on the declaration of the variable.

naive pawn
shut sapphire
#

im having a problem with my code, and i have no errors nor warning, so i dont really know why. Could anyone help please

shut sapphire
#

i am trying to make a flappy bird type game just to get use to the coding, i just cant make it flap

naive pawn
#

describe the issue - what you want to happen, what isn't happening as expected, and relevant code shared according to #💻┃code-beginner message

odd quail
#

why is it so hard to save a png

edgy prism
wintry quarry
#

trying to access a non-static variable

edgy prism
#

Yeah that was dumb of me thanks for pointing that out

wintry quarry
naive pawn
shut sapphire
#

i want to sprite to go up when i click space and i got the code down for that i think "if (input.GetKeyDown(KeyCode.Space) == true"

edgy prism
#

Thankyou both

wintry quarry
#

Make sure you have your console window open when you are running the game so you can see any runtime errors.

naive pawn
#

also, have you added the component to your bird

shut sapphire
#

when i press the space key it simply wont do anything

wintry quarry
shut sapphire
#

the console is apamming this error what does it mean

slender nymph
#

did you read it?

shut sapphire
#

yea i dont understand it

naive pawn
#

unity has 2 input systems. you're trying to use the old one, but you told unity you would use the new one

wintry quarry
#

your code is trying to use the old system

#

but your project is set up to use the new one

#

To fix it, go to Edit -> Project Settings -> search for "Active Input Handling" and set it to the old one.

#

basically you're using a tutorial for an older version of Unity. New versions of Unity have the new input system set by default

polar acorn
slender nymph
rocky canyon
#

"give em a little nudge" - Unity Input Handling Team

slender nymph
#

well that just seems silly. they should have left it as Both for 6.1 and probably for 6.2 as well and not change it to Input System by default until 6.3 (the next LTS) to give more time for people to transition since a good majority of tutorials for the engine use the input manager

rocky canyon
wintry quarry
#

They should really just give a better experience than that error message. Like some prompt should come up with a button that switches it for you.

rocky canyon
#

ya, or make the playersettings popup

#

imma look real quick at BiRP

shut sapphire
#

i set it to both it fixed the problem, just making sure that setting it to both wont make anything worse with the way i code later on

slender nymph
#

tbh using the old input manager just makes the code worse 🤷‍♂️

slender nymph
shut sapphire
keen cargo
#

You just did

wintry quarry
shut sapphire
#

oh ok thanks for the help

slender nymph
shut sapphire
#

thanks

slender nymph
#

and just fyi, it's usually better to stick to the same unity version (at least the major version, newer patches are fine) as the course you are following to avoid issues like this where some setting or feature has changed and you don't understand enough about the engine to even know what changed

rocky canyon
#

swapped it over to Both.. cant remmeber if i recall seeing this legacy message.. but there it is

#

now we know 🙂

summer gyro
royal gust
summer gyro
mystic glacier
#

👋

#

I have a little platform like this

#

When my character controller tries to get off this platform, it's grounded state becomes false until it lands in the terrain

#

It acts like it's a staircase with air

wintry quarry
#

Sounds correct, no?

#

If it's not touching the ground, it's not grounded

brave robin
#

Also depends where the check is being made to determine grounded or not. If it's dead center of the object, then when you step off you'll count as not grounded because the center is not on anything

#

If this is an issue, you may need multiple points of contact to check for

mystic glacier
#

Yeah I get the point but when I'm trying to walk off it acts like a stair case

#

So I can stand in the air if I try to walk off but don't do it fully

#

I want to make it so that if I'm walking off at the edge it fully drops me

steep rose
#

Spherecast techniques may work

#

I've also seen people use Checksphere as well

mystic glacier
#

But that still wouldn't change the fact that the character controller stays in air as you walk off the edge

rich adder
#

CC ground check is not very reliable, always make your own when you want more control

mystic glacier
#

I'm aware but I'm just looking for a simple one, can't I fix it in another way?

rich adder
#

there are many solutions to a single problem

mystic glacier
#

Is there a possible solution that doesn't involve doing your own grounded checks?

#

Because I've tried doing it myself once and it didn't go well

rich adder
#

probably not because the CC groundcheck is limited to the collider / capsule touching stuff

mystic glacier
#

Eh, fair enough

rich adder
#

in real life we don't ground check in our center lol we have two feet to "probe" the ground for solid check

#

but also in game you're limited to how the capsule collide reacts to just hanging off the ledge, you have to either at some point shrink the collider a bit when standing on edge or push/nudge it in code..

rocky canyon
#

i just realized not too long ago how complex my CC's ground check is...
it seems like it casts towards the most outter edge/solid ground

#

no clue how its working as of yet lol

#

uses either Raycast/Raycast Array/Spherecast but it seems like after the initial ground flag. it does more magic

rocky canyon
rocky canyon
mystic glacier
#

But I'll try it once again and see if I can do it

rocky canyon
#

i use the default CC groundcheck against Nav's advice, and for all intents and purposes ... it works fine for me

rocky canyon
rich adder
#

the CC grounded does the job, when you need more control and needing things like Normal of surface then rayhits are a must

unique quartz
#

what does this mean?

#

i would like to know how to fix it

wintry quarry
unique quartz
#

i understand that but i dont know how to fix it

#

and i don't know why it wouldn't make sense

#

because it is code from a tutorial

wintry quarry
#

I'm not a mind reader. Presumably you copied something from the tutorial incorrectly.

#

!code

eternal falconBOT
acoustic sequoia
#

Hey Everyone, Why is it when i ReloadScene i noticed my boolean variables don't change even though the whole scene restarts? how can i get all the variables to reset also?

wintry quarry
#

the only things that will "reset" are things that are actually part of the scene and are getting destroyed and recreated

acoustic sequoia
wintry quarry
#

quite the oopposite

#

static variables will NOT reset

#

and variables on DDOL objects will NOT reset

acoustic sequoia
#

i have zero static variables in my project currently

wintry quarry
#

YOu will need to share more context if you want to know why certain specific variables you are concerned with are not resetting

#

show your code

#

and explain which variables are not resetting as you expect

acoustic sequoia
wintry quarry
#

Yes, Time.timeScale is a project-wide thing that is outside of any scene.

#

and it's definitely not a boolean

acoustic sequoia
#

ok that makes sense. thank you

acoustic sequoia
# wintry quarry and it's definitely not a boolean

i mean't that i had a boolean that checks to see if the game is paused. when i restarted the scene, the game was paused... so i thought my boolean was == true.. therfore triggering the timescale.. but it's just the timescale because it's static. very good to know. thank you!

wintry quarry
#

if you copied it and it has that error, then you either copied it wrong, or the thing you copied was wrong in the first place

unique quartz
#

i am diong it now

#
{
    public CharacterController controller;

    public float speed = 12f;
    public float gravity = -9.81f * 2;
    public float jumpHeight = 3f;

    public Transform groundCheck;
    public float groundDistance = 0.4f;
    public LayerMask groundMask;

    Vector3 velocity;

    bool isGrounded;

    // Update is called once per frame
    void Update()
    {
        //checking if we hit the ground to reset our falling velocity, otherwise we will fall faster the next time
        isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

        if (isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }

        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");

        //right is the red Axis, foward is the blue axis
        Vector3 move = transform.right * x + transform.forward * z;

        controller.Move(move * speed * Time.deltaTime);

        //check if the player is on the ground so he can jump
        if (Input.GetButtonDown("Jump") && isGrounded)
        {
            //the equation for jumping
            velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
        }

        velocity.y += gravity * Time.deltaTime;

        controller.Move(velocity * Time.deltaTime);
    }
}```
wintry quarry
unique quartz
#

what does that mean

wintry quarry
#

It means you didn't copy and paste like you said

#

compare this part of your code

#

with the tutorial

unique quartz
#

i did copy paste

wintry quarry
#

Compare that part of your code

#

with that of the tutorial

#

and you will see

unique quartz
#

i copy pasted it

wintry quarry
#

You cut off the part on the right

unique quartz
#

i dont know why it didnt do that

wintry quarry
#

This thing

#

And the rest of the line

unique quartz
#

yeah but i copy pasted it

#

i dont know why it did that

#

well thanks anyway!

glossy crystal
#

Hello, I was wondering if there are significant differences for basic projects between unity 2022.2 and unity 6000 (current one), I want to follow a rough tutorial but am unsure if I can do so on the most recent version, or if I should stick to the guide's version

teal viper
lean cipher
#

Is there any way to code like a starup and count down sequence then this slop I cooked up?

    private void Update(){
        remainingTime -= Time.deltaTime;
        if(isPreMatch){
            PreMatch();
        }
    }

    private void PreMatch(){
        if(remainingTime > 4f){
            preMatchText.fontSize = 80;
            preMatchText.text = "First to 5 points wins";
        }
        else if(remainingTime <= 4f && remainingTime > 3f){
            preMatchText.fontSize = 300;
            preMatchText.text = "3";
        }
        else if(remainingTime <= 3f && remainingTime > 2f){
            preMatchText.text = "2";
        }
        else if(remainingTime <= 2f && remainingTime > 1f){
            preMatchText.text = "1";
        }
        else if(remainingTime <= 1 && remainingTime > 0f){
            preMatchText.text = "GO!";
        }
        else if(remainingTime < 0){
            preMatchText.text = "";
            isPreMatch = false;
            ball.StartMatch();
        }
#

remainingTime gets set at start

timber tide
#

I mean if it works, but otherwise if you want to eliminate some of the logic here, start low and compare high

#

if remainingTime < 0
else if ....

lean cipher
#

is there like a premade unity method to do something like this? or do i gotta do it manually

wintry quarry
#

or wait you're just trying to make a countdown timer here?

frosty hound
#

Round down the timer to the nearest int, that's your number. If that number is zero, show GO.

wintry quarry
#

yeah just round it

#

or use number formatting

lean cipher
#

well its a countdown timer but i also wanted to show the earlier text for a certain amount of time before the countdown

timber tide
#

Hashset ;)

lean cipher
wintry quarry
# lean cipher will do that
int remainingSeconds = Mathf.FloorToInt(remainingTime);
if (remainingSeconds > 4) {
  preMatchText.fontSize = 80;
  preMatchText.text = "First to 5 points wins";|
  return;
}

preMatchText.fontSize = 300;
preMatchText.text = remainingSeconds.ToString();```
timber tide
#

Really just some struct/tuple

wintry quarry
#

something like this

lean cipher
#

how does FloorToInt work?

#

does it just cut off the decimal place?

wintry quarry
#

it floors the float and gives you back an int

#

e.g. 3.1415 becomes 3

#

but also -2.452 becomes -3

#

basically rounding *down * to the nearest integer

lean cipher
#

Thank you 🙏

sour fulcrum
#

This doesn't have the prefered comparison logic but a little switch expression like this could clean it up abit aswell right?

        (float,string) displayText = remainingTime switch
        {
            float i when i > 4f => (80, "First to 5 points wins"),
            float i when i <= 4f && i > 3f => (300, "3"),
            float i when i <= 3f && i > 2f => (300, "2"),
            float i when i <= 2f && i > 1f => (300, "1"),
            float i when i <= 1f && i > 0f => (300, "GO!"),
            _ => (0f, string.Empty)
        };
wintry quarry
#

yep

queen adder
#

nvm i fixed it

glossy crystal
#

When I'm handling input actions, should I set it up directly through the project settings or create a separate inputactions object and work from there? Is there a functional difference

queen adder
glossy crystal
#

oh right yea ty

queen adder
#

Learn how to create your own classic First Person Shooter in Unity!

Get the assets for this series here: https://www.dropbox.com/s/juihs7yq93x1aon/GPJ_FPS_Assets.zip?dl=0

Don't forget to hit that like button and if you'd like to see more gaming goodness then subscribe for more!

Support the show by pledging at http://www.patreon.com/gamesplu...

▶ Play video
wintry quarry
#

so it's not surprising OnCOllisionEnter is not running