#💻┃code-beginner

1 messages · Page 673 of 1

onyx geyser
#

Somehow it worked, then it didn't, this stuffs confusing

frosty hound
#

It is absolutely impossible for myRigidBody to have worked. The only answer here is that you saw it seemingly work because it didn't compile any changes you had made prior to changing it. As you said, no point arguing these facts.

onyx geyser
#

Then maybe I pressed play too early??

frosty hound
#

But as you're configuring your IDE currently, these things shouldn't be able to happen again since it'll get auto corrected/underlined.

#

Yes, maybe you did.

#

It could be any number of reasons that aren't "that it worked with different spelling", which is absolutely impossible.

onyx geyser
#

I have a habit of breaking things the moment I even look at em, unity was having some compile errors the moment I started it up, figured that could've been related

drowsy karma
#

Hello everone! I'm a professional Roblox developer looking to try, and hopefully move forward to Unity. I'm struggling to start, and have been looking for good example games to take a look and experiment with. Could you guys recommend any? I done some research, and i'm trying to find one with dependency injection, and UI Toolkit, as these concepts were my go-to's when developing on the Roblox engine. Thanks!

frail hawk
#

check the pinned messages in this channel

drowsy karma
#

I've loooked through them, although it's not what i'm looking for. I rather learn using an existing project, rather than using guides or tutorials.

frail hawk
#

i would recommend recreating some simple famous games like flappy bird or temple runner but it seems like you are more focusing on asset development than game dev

#

since you said roblox development and ui

keen dew
#

There isn't a project that would be generally known for good practices or quality code

drowsy karma
#

also, i've seen a lot of paradigms recommended; ECS, DI, etc.. which is the most popular? As in, which one should i take a look into first?

crisp furnace
#

favorite animator tutorial for 3D sprite render?

#

im kind of lost in that unity gives me no errors but the game doesn't do anything different with my new script either.

frail hawk
#

sorry but what is 3D sprite render?

tired summit
frail hawk
#

any code to provide?

neon glade
#

hi, wondering why i cant drag my sprites into the sprites folder?

frail hawk
#

change Multiple to Single

hollow palm
sour adder
neon glade
frail hawk
#

restart unity, sounds really weird

ripe galleon
#

i want to code a enemy attacks pattern, could someone explain me when to use cooldown, timer or wait for seconds?
which one does interrupt the flow but doesn´t allow a 2nd flow to come after the first

so that the flow is only going through once

frail hawk
#

how you implement the cooldown is up to you, you can use a Coroutine(Wait for Seconds) you can use the Update method with a timer or something similar

ripe galleon
#

and is it the timer or is it the cooldown which lets multiple flows go through at once?
also i tried a little bit with wait for seconds but the flow get´s completely cutted even tho i did use the coroutine at the beginning

#

100% on me tho because i lack the understanding of flow and right conenctions and utilization

frail hawk
#

so to explain it simple, wait for second just executes code after a certain amount of time.

ripe galleon
#

when i switched the wait for seconds to timer and it worked exactly how i did think it would

#

i used wait for seonds in other comamnds and it worked well

#

but yeah, i only have the problem of the flow not getting prioritized correctly, i only have a very little experience with unity so far
if i could understand time stops better it would be quite helpful

frail hawk
#

i think the fact that as you said you have only little experience explains it

ripe galleon
#

yeah 😅 only 2 weeks ago i got the gist of how to do things more alone without guidance or tutorials

tired summit
dusk temple
#

are there any 3d boss battle tutorials? more spesifically and first person or third person like in elden ring bosses

meager raven
#

can someone help me.
ive been trying to an a oncollisionenter code thing to my script, but no matter what it wont trigger

#

this is it

clear juniper
meager raven
#

I am using unity 2d. I have a 2d box collider on all objects, and they also both have a rigidbody 2d

#

is trigger is not checked also

clear juniper
#

ah then it needs to be

void OnCollisionEnter2D (Collision2D collision)
{

}```
meager raven
#

ohhhhhhh okay thanks!

#

ill try that

clear juniper
#

no problem 😁

meager raven
#

it works.

#

my god are you awesome

clear juniper
#

🎉

#

it's an easy thing to miss when you're just getting started, but eventually all of this will come naturally!

split plover
#

Dumb question but whats the keycode for left mouse button

vital tartan
#

Mouse0

split plover
#

oh

#

i put mouse1

split plover
split plover
tired summit
#

all the keycode are there

split plover
#

for now i dont need to know any other keycodes

#

so i'll just wait till i need to know keycodes for it

carmine breach
#

Aight im like really new to unity, trying to get some basic movement set up (which I have managed to do) but I got this problem with my character just sticking to walls when I jump up against them. I know its a problem with how I'm calculating movement on a slope ect. but I just have no clue how id fix it.
I can send the code file if needed, ik it will be a really simple fix like changing a single value or something. Did also follow a tutorial for it aswell.

clear juniper
#

are you using any physics materials?

carmine breach
clear juniper
#

can you send the character controller then, please? 🙂

carmine breach
#

yeah no probelm

#

im already very sorry for the spaghetti the code is 😭

winter plover
#
    void Update()
    {
        float dist = Vector3.Distance(MainObj.transform.position, Player.transform.position);
        Debug.Log($"Dist is {dist}, rad is {rad1}, pos is {KeyObj.transform.position} ");

        if (dist < rad1 && Input.GetKeyDown(KeyCode.E))
        {
            if (KeyObj != null)
            {
                StartCoroutine(MoveKeyDown());  
            }
        }



    }

    IEnumerator MoveKeyDown()
    {
        KeyObj.transform.position = Vector3.MoveTowards(
        KeyObj.transform.position,
        TargetKeyObjPos.transform.position,
        speed * Time.deltaTime
    );
        yield return null;
}


#

so i wrote this

#

to try to move a key down until it reaches the targetkeyobjpos

#

but it only moves an inch everytime i click

#

like its at 6.00 Y level

#

and i click E and it goes to 5.99 or 5.98

#

and stops

#

(and then if i click it again it goes down more )

winged seal
#

how can i make a grenade in vr?

#

so it explodes

#

or dissapears after i threw it

supple flume
#

Quick question, what's the difference between Delta time and fixed Delta time

winter plover
# supple flume Quick question, what's the difference between Delta time and fixed Delta time

delta time:

  1. time in seconds it took to complete the last frame
  2. used for smooth frame rate movement and animations in update and other stuff
  3. reason why is frame rates can vary so multiplying by delta time effectively makes movement consistent

fixed delta time:

  1. the fixed time between calls to fixedupdate() usually i think its like a .02 seconds (50 times per second)
  2. used for physics calculations and updates in fixedupdate()
  3. physics sims run at fixed intervals for stability and other stuff
supple flume
eager elm
supple flume
winter plover
winged seal
#

anyone can tell me how i can make a grenade in vr?

winter plover
winged seal
supple flume
#

wait i did vector 3, i thought i did vector 2

#

my bad

winter plover
#

yea

#

maybe

#

im not a 2d guy

#

i think it is better to move it in fixedupdate tho

#

only if ur using rigidbody2d

#

else its okay

supple flume
#

na i am using normal transform movement

winter plover
#

then its good

#

just fix the vector2 issue

supple flume
#
        if (Input.GetKey(KeyCode.D))
        {
            gameObject.transform.position = new Vector2(speed * Time.deltaTime + gameObject.transform.position.x, transform.position.y) ;
        }
        else if (Input.GetKey(KeyCode.A))
        {
            gameObject.transform.position = new Vector2(-speed * Time.deltaTime+ gameObject.transform.position.x, transform.position.y);
        }
    }```
#

i did

#

idk what i was thinking lol

eager elm
winter plover
winter plover
eager elm
winter plover
#

so i can try removing the yield return end?

#

idk

#

im not that good at coroutines

supple flume
#
        if (Input.GetKey(KeyCode.D))
        {
            gameObject.transform.position = new Vector2(speed * Time.deltaTime + gameObject.transform.position.x, transform.position.y);
        }
        if (Input.GetKey(KeyCode.A))
        {
            gameObject.transform.position = new Vector2(-speed * Time.deltaTime + gameObject.transform.position.x, transform.position.y);
        }
         if (Input.GetKey(KeyCode.W))
        {
            gameObject.transform.position = new Vector2(transform.position.x ,speed * Time.deltaTime + gameObject.transform.position.y);
        }
         if (Input.GetKey(KeyCode.S))
        {
            gameObject.transform.position = new Vector2(transform.position.x ,-speed * Time.deltaTime + gameObject.transform.position.y);
        }
    }```

quick question, why when i move in 2 directions i get more speed
eager elm
# supple flume how to?
private float input;

void Update()
{
    if (Input.GetKey(KeyCode.D))
    { input = 1; }
    else if (Input.GetKey(KeyCode.A))
    { input = -1; }
    else input = 0;
}

void FixedUpdate()
{
    transform.position = new Vector2(input * speed * Time.FixedDeltaTime, 0);
}``` Something like that
winter plover
supple flume
eager elm
winter plover
supple flume
winter plover
supple flume
#

or if its a point and click movement, save the click vector, and keep reducing the current location of the object with the saved vector, and it wont stop until it all equals 0

eager elm
supple flume
#

bruh who took the continous play bottom from youtube

winter plover
#

and how is it gonna affect the script

eager elm
winter plover
#

ah i couldve read too lol

#

also can i ask one more thing

#

how do i add a glowing item indicator

#

or like a pointlight thats rlly bright

#

to an object

supple flume
#

as far as i know shaders

winter plover
#

so what can i do to make that

supple flume
#

ive never used shaders, they too complicated

rocky canyon
#

prebuilt ones arent

winter plover
#

in any way

supple flume
#

idk how to access shaders in a script, but it would be like if the item is hovered by the mouse, shader example activates

winter plover
#

cuz im making a psx style game

#

suprisingly they are very good

#

i can try smth with that

supple flume
#

psx? what is that lol

winter plover
#

playstation

#

playstation 1

#

the graphics in ps1 games used to be up to 256x256 and no texture filtering

#

so everything was real pixelated in said games, leading to a new genre of videogames (mostly horror) in 2024-2025 called "psx retro" or smth like that

supple flume
#

oh those streamers horror games

winter plover
#

ya

supple flume
#

where they scream hella for no reason

winter plover
#

ya

#

mine isnt gonna be the uh

#

screamer type

#

its gonna be the psychological type/puzzle type

#

where it takes about 5 hours to complete 50% of the game stuck in one room

supple flume
#

what the hell is incorrect in here

#

the moment i wrote this line every other vector2 went nuts

clear juniper
supple flume
#

surprisingly it does work now

#

what is the issue

hexed terrace
#

you've had a new using added automatically.. you need to remove it

clear juniper
#

have you got class Vector2 or struct Vector2 anywhere else in your code?

supple flume
#

got them here

winter plover
rocky canyon
#

like a spotlight

supple flume
#

when i delete fixed update, the vector2s go to normal

rocky canyon
#

ohh if u want a glow or an outline its probably gonna need to be an outline shader

#

good luck finding one that works well enough for u

winter plover
clear juniper
rocky canyon
winter plover
rocky canyon
#

ahh u have 2 namespaces w/ vectors

#

get rid of one

hexed terrace
rocky canyon
#

or specify which vector2

clear juniper
#

at the top of your script, delete using System.Numerics

#

it looks like your code editor has added that for you lol

rocky canyon
#

like UnityEngine.Vector2

supple flume
#

how the hell was it even added

rocky canyon
#

does it to me too

#

probably Random..

#

or soemthing like that

naive pawn
#

probably automatically when you hit enter on an autocomplete suggestion

hexed terrace
clear juniper
#

Visual Studio/Visual Studio Code/Jetbrains Rider all have functionality to automatically add using statements from autocomplete

rocky canyon
#

or that ^

clear juniper
#

too many cooks now 😂 I'll drop out lmao

supple flume
#

oh

winter plover
#

sorry

#

wrong ping

rocky canyon
#

u good

winter plover
#

anyway can i do smth like thast

hexed terrace
winter plover
#

add an image to it

rocky canyon
winter plover
#

nono, an image

#

legit

#

an image of some sorts

#

that shows ingame

rocky canyon
#

ya, an image can be an indicator lol

winter plover
#

yeas

#

i will add a glow image to the miage

#

and apply a shader

#

i can show u kinda what i mean

rocky canyon
#

u can simulate glow.. with a transparent image.. if u wanted.. is this 2d or 3d?

winter plover
#

3d

rocky canyon
#

this ws the first thing that came to mind

winter plover
#

i can show u a reference, one min

rocky canyon
#

ya, plz do

#

thers sooo many types we could be talkin about

hexed terrace
#

thread this non-code chat !

winter plover
#

a lighter item with a glow effect like this

hexed terrace
rocky canyon
#

ahh yes! this belongs in one of the Graphics channels

winter plover
#

shall we move?

rocky canyon
#

yes..

winter plover
#

alr where

rocky canyon
silent obsidian
#

While using Cinemachine Freelook Camera, i want to be able to also pan the camera by specific hotkeys. However if i access the cinemachinInputAxisController and modify the InputValue of the X axis the camera seems to stay the same. Any clues how could i do that? ( in the editor the value changes but the camera does not seem to move)

supple flume
#
    {
        
        
        gameObject.transform.position =  new Vector2(inputx *speed * Time.fixedDeltaTime + gameObject.transform.position.x, inputy * speed * Time.fixedDeltaTime + transform.position.y );
    }```
this feels so clanky anytips to smoothen it
polar acorn
supple flume
polar acorn
#

Rigidbodies, but you use them right

supple flume
#

Neva 🔥

polar acorn
#

Then suffer

supple flume
#

they are pain to deal with and configure

hexed terrace
#

Seems more like a lack of experience issue.

#

btw - you don't need to do gameObject.transform .. you can just do transform

supple flume
supple flume
clear juniper
#

unity treats objects with colliders as static unless they have a rigidbody - so you really do want a rigidbody if the object is gonna move 😅

supple flume
#

so i do the rigidbody.addForce or wut

clear juniper
#

nah you can just directly set rigidbody.velocity

#

or linearVelocity in unity 6+

#

so ```cs
void FixedUpdate()
{
rbody.linearVelocity = new Vector2 (inputx * speed, inputy * speed);
}

thorn stone
#

Hi, does anyone have youtube tutorial for 2d top down 4 direction sword/meele tutorial?

polar acorn
#

Or just use movePosition which is teleportation but less jank because it's the physics engine doing it

supple flume
#

Man I love the unity community lol, full of kind people

supple flume
thorn stone
#

Brackeys you say. I'll check it, thanks.

clear juniper
# thorn stone Hi, does anyone have youtube tutorial for 2d top down 4 direction sword/meele tu...

you probably don't actually need a tutorial - for any feature like this, try breaking it up. You can probably do each individual bit, or google it/ask here! e.g.

  1. when the player presses the attack button
  2. get the current input direction
  3. play the sword swing animation for that direction
  4. check collisions while the sword swing animation is playing. For this, you'd usually enable a collider during certain frames of the animation, and disable it when it's done! (You can do this in the animation clip)
supple flume
#

rigy.velocity = new Vector2(inputx *speed , 0 );

@clear juniper
so the body started falling hella slow

clear juniper
#

set the gravity scale to 0 on the rigidbody 🙂

supple flume
#

i want it to fall normally, not to stop falling

clear juniper
#

ah I see - then rigy.velocity = new Vector2(inputx *speed , rigy.velocity.y );

supple flume
#

another question, which is why i hate rigidbodies, how do i stop the clamping when i go against a wall

clear juniper
#

what do you mean by that?

#

when you hit a wall, do you want to bounce off, slide along the wall, or stop completely

#

or just go through it

eternal needle
supple flume
#

its when the object stops completely when i apply force opposing the direction

clear juniper
#

ah yeah that's probably the issue! In your project create a new physics material 2d, and set the friction to 0

clear juniper
#

okay, in that case you might want to use forces then

#

or use SmoothDamp, one sec

supple flume
eternal needle
#

you also dont have to use a rigidbody. its not the only way to have non "clanky" movement. your initial code was directly modifying the position in FixedUpdate rather than Update, so it was always updating at 50 times per second rather than once per frame.

eternal needle
#

that is friction

clear juniper
#

that's a frictionless material, do this 🙂

supple flume
#

how do i make a friction material 2d, only the 3d one is showing up

slender nymph
#

it's also called a Physics Material not a Friction Material

supple flume
#

ik its physics material lol

supple flume
clear juniper
#

which version of unity?

#

it's in here for me

#

after you've done that you might want to smooth the horizontal motion, it'll feel nicer to play 😂

[SerializeField] private float smoothTime = 0.3f; // change this to make it start moving faster/slower. Lower = reaches max speed faster
private float _smoothVelocity;

void FixedUpdate()
{
    // your other code
    rigy.velocity = new Vector2 (
        Mathf.SmoothDamp(rigy.velocity.x, inputx * speed, ref _smoothVelocity, smoothTime), 
        0
    );
}```
slender nymph
clear juniper
#

yeah screenshots are helpful though 😉

slender nymph
#

i mean, in this case not really. if someone cannot figure it out by being informed they need to look in the 2d submenu and a screenshot of the 2d submenu is required for them to figure it out, then they perhaps need to get their eyes checked or learn to read

rocky canyon
#

im guilty of screenshotting everything 😦 .. im trying to calm down lol

slender nymph
#

then why are you taking that information personally?

supple flume
#

you did

clear juniper
#

did you find it? 🙂

supple flume
#

yes thanks to you

slender nymph
# supple flume you did

actually i did not, i simply informed them how their screenshot was unnecessary. you went out of your way to specifically ping me about how "iTs nOT pErSoNAl"

supple flume
#

seems like you took it personal enough to get raged

slender nymph
#

just because someone provides information does not mean it is a personal attack on you. you can drop the nonsense now and move on

winter badge
#

Hey folks,
I am trying to make a simple endless runner and as part of that I want to Instantiate new "Ground" and destroy old "Ground" depending on the player position. The game already starts a single instance of gameobject "Ground". I have set up 2 different Trigger colliders, 1 for spawning new Ground and another for destroying old Ground.
The player starts between the destroy trigger and spawn trigger so the flow is : Player moves forward=> new ground spawns => once the player reaches new ground => destroy trigger will destroy the old Ground.

The first new Ground spawns as expected and the First old Ground destroys as expected.
Problem=> When the 2nd new Ground tries to Spawn, because the old Ground was destroyed, The spawnPoint transform which is a child object of the Ground prefab, doesnt exist EVEN THOUGH one clone of Ground ALWAYS EXIST.

Initially I was trying to get the Ground Object by name and since this issue I modified by using tag since the tag Respawn always exist in the scene, but still the issue persists
Appreciate any help on this

slender nymph
#

The spawnPoint transform which is a child object of the Ground prefab, doesnt exist EVEN THOUGH one clone of Ground ALWAYS EXIST
this is irrelevant, if you are referencing an object that is being destroyed then the reference will not automatically change to a different object when that object is destroyed, it will still point to the destroyed object. So because your spawnPoint variable points to the object that is in the scene, when that object is destroyed then spawnPoint will point to a destroyed object

#

you should instead refer to a prefab for the ground object, and on that prefab have a component that can reference its own "Spawn Point" child so that your spawner object can get that reference more easily from the instantiated objects

#

this will also eliminate the usages of the Find method and the GetChild with the magic number to clean up the code and (very very slightly) improve performance

winter badge
#

OMG I see it now after you pointed out. So basically, currently I am using the spawn point vector from the ground that would be destroyed before the new ground can spawn so it throws error. But If I were to have the spawn point value of each ground on itself, this could be avoided.
I am thinking I could keep adding the z coordinate with the length of the ground piece to get the coordinate when the new ground is created. Hopefully this will work.

Thanks a lot @slender nymph, I was cracking my head for a while on this😅 🫡

olive beacon
#

can someone assist me on this: I have ads being initialized and the banner being loaded in a different Awake method. However I see in the console that adsAreInitialized and bannerLoaded are set to true after going through this while loop but the ShowBannerAd() is never invoked. What am I doing wrong?

#

here are logs for context

cosmic dagger
frail hawk
#

i am still trying to figure out what the yield return will do in that while loop

rocky canyon
olive beacon
rocky canyon
#

u want to wait while BOTH are false correct?

olive beacon
rocky canyon
#

well the moment either of those become true.. the while loop exits

cosmic dagger
rocky canyon
#

even if the other is still false

#

or wait..

#

while (!adsAreInitialized || !bannerLoaded) i was thinking.. but my brain aint braining just yet

short hazel
#

Yeah should be a OR here I think

rich adder
rocky canyon
#

lol

short hazel
#

Wait no, brain is not working

rocky canyon
#

lmao!! same bro

short hazel
#

I hate these conditions lmao

#

"Proceed if both are loaded"

if (a && b)
  // proceed

So invert, !a || !b

#

right?

rocky canyon
#

ya an || would wait until BOTH are true

#

right?

frail hawk
#

but wouldn´t it spam the yield return unneceserally

polar acorn
# short hazel "Proceed if both are loaded" ```cs if (a && b) // proceed ``` So invert, `!a |...

In propositional logic and Boolean algebra, De Morgan's laws, also known as De Morgan's theorem, are a pair of transformation rules that are both valid rules of inference. They are named after Augustus De Morgan, a 19th-century British mathematician. The rules allow the expression of conjunctions and disjunctions purely in terms of each other vi...

zealous geode
rocky canyon
#

ohhh yea ur right

eternal needle
#

didn't see the full context above, but the IDE should have options to invert conditions already

rocky canyon
#

thats where my brain was broken

zealous geode
#

&& waits until both are true

short hazel
#

Yeah you can use the "Invert if" IDE code fix if you don't want to think too much haha

rocky canyon
#

while (!(adsAreInitialized && bannerLoaded))

short hazel
#

That also works

rocky canyon
#

conditionals like that confuse me

high summit
#

Hey so my doors are interactable, And they have a bool variable, I'm however slamming the doors shut during events by tweening them from other scripts, Now the issue is, Once I have slammed it, It's still in the 'closed' state so you have to click on it twice to open it again, Is there a way I can change this variable/bool from another script?

short hazel
rich adder
rocky canyon
#

feels like the IQ tests i had back in grade-school for the "Gifted Program"

naive pawn
rocky canyon
#

im just learning of de morgan

high summit
#

public bool isOpen = false yeah it's public

rocky canyon
#

thanks for who-ever brought it up

#

the more info the better 💪 🤯

short hazel
#

But yeah what I do is just write the condition "normally" and use the "invert conditional" feature of the code editor lmao

naive pawn
#

demorgan also works for sets, (A & B)' = A' | B'

frail hawk
#

[SerializeField] Storagedoor sg; // assign the script via inspector then you can acces it

#

@high summit

rich adder
rocky canyon
#

whats A'

naive pawn
#

the negation/complement of A (A prime)

rocky canyon
#

ohh

#

gotcha

#

he sorta looks like me right now 😅

short hazel
#

Spawn is De Morgan Jr

#

"you disappoint me son"

rocky canyon
#

lmfao!

eternal needle
# rocky canyon im just learning of `de morgan`

this all falls under "discrete mathematics" if you wanted to look further. honestly a lot of it might just fly over your head if you're not looking at a structured course. you also might not use any of it.

rocky canyon
#

ResetDoorState();

high summit
#

Yeah just done that works great

#

thanks folks!

rocky canyon
#

will do bawsi!

naive pawn
#

the way i think of it is "AND" is the opposite of "OR", and de morgan is just distributing the negation to the operator as well (not just the operands)
AND being the opposite of OR does kinda make sense, if you've ever touched making logic gates from scratch
negating the output of OR gives NOR
negating the inputs of OR gives NAND
negating both gives AND

and these are abstract definitions of AND/OR, they apply to

  • logic gates AND/OR
  • boolean algebra AND/OR
  • set intersection/union
    unfortunately does not apply to mult/add in the reals - you'd be surprised how many things map from mult/add to and/or
rocky canyon
#

coding is all just data w/ (yes and notrue and false, on and off) in the simplest of senses

short hazel
#

It's like on equations when you have inequality a < b and at some point (I don't remember when) it can flip to a > instead

#

When you make an operation on it

naive pawn
#

if you negate both sides (by multiplying/dividing a negative number in)

short hazel
#

Yeah that

rocky canyon
#

🧮
2 < 5
-2 > -5

eternal needle
#

out of all the laws, there are probably 3 that aren't completely obvious

rocky canyon
naive pawn
# naive pawn if you negate both sides (by multiplying/dividing a negative number in)

addition and subtraction move the number line around, that doesn't change the relative position of the 2 values you check
multiplication and division are scaling the number line - when you multiply or divide by a positive number, that keeps the relative position the same, just the distance changes
but if you multiply or divide by a negative number, that flips the number line, so the relative positions swap

rocky canyon
#

i try to draw game-ideas and mechanics from everything .. soo possibly something unique in there that might get my brain spinning

frail hawk
#

every code beginner: "damn i joined the wrong unity channel"

naive pawn
#

advanced maths is beginner code obviously

polar acorn
rocky canyon
#

i mean if theres anything a beginner should really hone their skills about its conditionals imo

#

esp since beginner code is 50% conditionals

#

lol

eternal needle
#

I guess the graph theory part of discrete maths could be useful too in unity. anything else im not sure you'd be able to use

rocky canyon
#

ive already fallen into a boolean algebra rabbit hole

#

discrete maths will have to wait a sec

naive pawn
rocky canyon
#

ngl.. i feel i know alot more about maths than ur average person... but i still find myself asking myself things like this for example.. i had this thought:

someone was talking about Interest.. and how much u would accumulate after X amount of years. with it compounding..

well i had an interesting thought.. (i can totally do that math in a forloop in unity in just a couple of seconds)
but if i were want to do that using mathmatics.. and a simple equation.. im completely lost..

#

so i went searching and found the equation.. and compared it to teh for loop i had written.. and it just didn't seem to sync up in my mind..

#

things like that ^ are always rattling off in the back of my brain

rocky canyon
#

ngl.

naive pawn
#

the power rule in calculus is kinda a specific thing, separate from rules of exponentiation in general

rocky canyon
#

ohhh.. see TIL 🫠

rocky canyon
naive pawn
#

the power rule in calculus is d/dx x^n = nx^(n-1)

naive pawn
eternal needle
# rocky canyon ngl.. i feel i know *alot more* about maths than ur average person... but i stil...

its probably because you learned it for school/uni and then didnt have to apply it anywhere else. I did a math minor also so like calc 3, 3rd/4th year linear algebra, and some other course. This is more than most cs students because you're supposed to only do basic calc 1 and 2, then early lin alg. I was good too getting A or A+ except in one lin alg class.
Today, i couldnt tell you shit about how to do basic calculus

#

I do still think if you're going to look into these kind of things, you aren't going to use most of it. my suggestion for anything unity related still would just be boolean logic and graph theory. Calculus/pure math doesn't fall into discrete maths

rocky canyon
#

ya ur right.. soo many times im like "that sounds sooo familiar" and realize ive learned it before..

#

but just lost it

#

ya, boolean logic will be my topic of choice for a bit 👍
making a notesheet of what I think i know first.. and then we'll do a deeper dive and see where it takes me 💪

#

appreciate ur cautions

supple flume
#
        {
            rigy.AddForce(new Vector2(0,jumpforce));
        }

is this an ideal way to jump?

supple flume
#

why

rich adder
#

in one frame that ain't gonna do much

supple flume
#

with 200 force it does

rich adder
#

probably want Impulse mode

slender nymph
rich adder
supple flume
#

ik how to use keycodes and vectors lol, just not force mode, thanks for ur help tho

#

the forcemode script is unreadable for a rookie

#

i was trying to read it before uve sent it

frail hawk
#

use Impulse, it should be what you are looking for

#

it´s literally one line of code, what is so unreadable

supple flume
#

? the forcemode script is almost 200 lines

rich adder
#

the example code just shows the different forcemodes, you don't have to copy them all

frail hawk
#

actually i agree on that. the documentation for the ForceMode is kind of messy and not beginner friendly

#

reminds me of the microsoft docs

polar acorn
supple flume
#

i kept screwing around with it till i found out how

supple flume
polar acorn
#

It's literally the first result for "Unity ForceMode"

#

I just googled it

rich adder
supple flume
#

i use bing and bing is annoying as hell

supple flume
frail hawk
#

close

#

do you work without intellisense?

#

your IDE should have told you that there are a few code errors

rich adder
supple flume
#

Debug.DrawRay(transform.position, Vector2.down * lenght, Color.red);
why isnt this drawing a debugray

slender nymph
#

do you have gizmos enabled

supple flume
#

yes

slender nymph
#

then it is, assuming that line of code is running

frail hawk
fresh iron
#

sorry lemme do it

slender nymph
#

also large blocks of code should be shared via a paste site, not just dumped directly into discord 👇 !code

eternal falconBOT
fresh iron
#

alr

#

thanks!

supple flume
rich adder
supple flume
#

its in update

slender nymph
#

show the full code

supple flume
#
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.UIElements;

public class Movement : MonoBehaviour
{
    public int speed;
    public int usage;
    public int inputx;
    public int inputy;
    public int jumpforce;
    public int lenght;
    Rigidbody2D rigy;
    // Start is called before the first frame update
    void Start()
    {
        rigy = gameObject.GetComponent<Rigidbody2D>();


    }

    // Update is called once per frame
    void Update()
    {
        
        Debug.DrawRay(transform.position, Vector2.down * lenght, Color.red);
        if (Input.GetKey(KeyCode.D))
        {
            inputx = 1;
        }
        else if (Input.GetKey(KeyCode.A))
        {
            inputx = -1;
        }
        else
        {
            inputx = 0;
        }

        rigy.velocity = new Vector2(inputx * speed, rigy.velocity.y);

        if (Input.GetKeyDown("space"))
        {
            rigy.AddForce(Vector2.up * jumpforce, ForceMode2D.Impulse);
        }

        RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.down * lenght);
        if (hit)
        {
           
            Debug.Log(hit.transform.name);
        }
    
    }
    
   
      
}
#

for the hit, it prints the original name

slender nymph
#

how to share large code blocks was still visible yet you decided to dump the whole thing here anyway

supple flume
#

i literally did the cs thing

slender nymph
#

yes, which is not how you share a large block of code

rich adder
supple flume
#

and the links doesnt work

#

it gives me bad gateway

rich adder
supple flume
supple flume
slender nymph
#

if only there were 3 others you could choose from

rich adder
#

** tries one **
"well i guess the others are broken too"

supple flume
frail hawk
supple flume
#

yes

slender nymph
#

anyway, if you are absolutely certain you have gizmos enabled and you have looked in the scene view and still don't see the line, then you need to check the variables you are using for the drawray call

supple flume
#

i gave variaty of small/large numbers

slender nymph
#

screenshot what you see then

rich adder
supple flume
slender nymph
#

including the inspector with the value of the lenght variable

supple flume
rich adder
slender nymph
#

gizmos is not enabled in your game view window

supple flume
#

brh

polar acorn
slender nymph
rich adder
supple flume
#

weeeeeeeelllllllll, thats on me

rich adder
#

if your PC is powerful enough you can also put scene view and game view side by side if you don't need to tab back n forth

supple flume
#

It can handle it, but my laptop screen is not that big

#

Everything gets squished

rich adder
#

then yeah gizmos in Game View, dont forget to turn it off when not needed cause that could also effect your performance in editor

olive beacon
#

Why is is that when i run, it will show the first debug log, but not the second debug log? In addition, it will not display the Ad so it seems that nothing after that yield is being invoked.

slender nymph
#

presumably whatever is starting this coroutine is being deactivated or destroyed

olive beacon
#

I have it set up that the method goes when the BanneIsLoaded Event is triggered.

wintry quarry
keen dew
#

or it hasn't been started with StartCoroutine

frail hawk
#

they said they can see the first debug tho

keen dew
#

If you just call the function it'll run until the first yield

slender nymph
#

it shouldn't. it shouldn't actually run any of that code until MoveNext is called on the returned IEnumerator

#

running to the first yield was a common misconception

keen dew
#

That's interesting, I guess I was thinking about the lines running before the execution continues in the calling method

safe vale
#

hi there, i'm making a game and i want to make the spear bounce of the walls, but only works on the wall at the top, does anyone have a hint on why it's doing this, here's the code as well

public class SpearTrajectory : MonoBehaviour
{
    private Vector2 _surfaceNormal;
    
    private Rigidbody2D _rb;
    private Vector2 _direction;
    private float _speed;
    [SerializeField]
    LayerMask _layerMask;
    void Start()
    {
        _rb = GetComponent<Rigidbody2D>();
        _direction = _rb.totalForce.normalized;
        _speed = _rb.totalForce.magnitude;
        
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        //Debug.Log(_direction);
        RaycastHit2D hit = Physics2D.Raycast(transform.position, _direction, 1f, _layerMask);
        if (hit)
        {
            _direction =Vector2.Reflect(_direction, hit.normal);
            _rb.AddRelativeForce(_direction * _speed);
            //transform.up = _direction;
            
        }


    }

    void OnDrawGizmosSelected()
        {
            Gizmos.color = Color.red;
            Gizmos.DrawRay(transform.position, _direction);
        }
    
} 
olive beacon
slender nymph
#

show where you start the coroutine

#

or, better yet, show all of the code related to that object

supple flume
olive beacon
#

Thats basically it.

safe vale
supple flume
frail hawk
#

looks like your collider only covers the tip of the spear, make sure to cover it completely., you can view the collider in the inspector.@safe vale

slender nymph
#

or rather, the origin of the raycast being at the tip of the spear and the spear not rotating

safe vale
#

okay im seeing, so right now im using a line, maybe a sphere?

frail hawk
#

yep a circle should

slender nymph
#

that's not quite going to do what you think it does

polar acorn
olive beacon
polar acorn
slender nymph
#

but yes, check what digi is suggesting. also consider putting a log in OnDisable to make sure it isn't being disabled

safe vale
supple flume
#

try shooting the spear towrads the top box then instantly move the rotation of ur player away

#

wait doesnt work

#

just try drawing gizmos and see

olive beacon
wintry quarry
polar acorn
#

See if the timescale is 0 or if this object is being disabled/destroyed

olive beacon
#

OOOOOH thats was it. but now i have to figure out where i pause it

#

the time scale was indeed 0

olive beacon
rocky canyon
#

i use it to log playtime.. same concept

lofty sequoia
#

WHY does my interface return "null"???
I do a null check if(IMyInstanceType != null)
and it enters the if statement when the instance is NULL!!!!!!

#

when I ask Visual Studio what the value of the instance is, it says it is "null" <- literally as if in a string

#

so it's not null

polar acorn
lofty sequoia
#

it's "null"

#

so HOW do I account for this case?

polar acorn
#

Is the object that implements the interface a UnityObject such as a MonoBehaviour or is it an ordinary C# class?

lofty sequoia
#

yes it's a monobehavior

#

would this work?
if(object.ReferenceEquals(myObj, null))

keen dew
#

Normal equality check works

polar acorn
keen dew
#

Usually in that case the code runs twice, once with a destroyed object and once with a non-destroyed object so it looks like it skips the check

lofty sequoia
#

it's not skipping the check, it's ENTERING the statement when it IS null

#

sorry I'm not yelling I'm talking as I type haha

keen dew
#

That's what skipping the check means

naive pawn
lofty sequoia
#

ah ok, skipping the check for me usually means it doesn't enter a statement block

keen dew
#

Do this and show what it prints:

Debug.Log("Checking " + IMyInstanceType);
if(IMyInstanceType != null) {
    Debug.Log(IMyInstanceType + " is not null");
}
else {
    Debug.Log(IMyInstanceType + " is null");
}
naive pawn
meager raven
#

anybody know why the text legacy wont display what i write?

naive pawn
#

not without more info, no. we aren't psychic

meager raven
#

i really dont understand whats wrong, no matter what i type in the textbox it wont apear

#

im using unity 2d btw

naive pawn
#

oh, not a code issue

keen dew
#

That isn't a code question but the box is probably too small

naive pawn
#

well, shouldve seen that coming

meager raven
#

then where should i ask this question?

meager raven
#

okay thanks

lofty sequoia
lofty sequoia
keen dew
#

Wait is it literally a type and not an instance?

naive pawn
#

if you hover over the ==/!= where you compare the object, does it show UnityEngine.Object.operator == or something else

lofty sequoia
#

when I hover over the comparison, it shows the instance as literally "null" in strings <<<<<<<

#

the object in question _myObject is an instance of an interface IMyInterface that is implemented by MyClass : MonoBehaviour, IMyInterface

#

it's the same problem the guy in the forums was having

naive pawn
#

so probably not null, probably unity's fake null, given that you can apparently access props of the object

#

(that's not what i asked you to hover over though btw)

lofty sequoia
#

So my fix is literally just casting the instance as a UnityEngine.Object and that seems to do a correct comparison

naive pawn
#

probably yeah

#

i guess you could make your interface an abstract class that extends MonoBehaviour

#

not sure if that's a common fix

wintry quarry
timid salmon
#

why is my text not adding 250 when ScoreAdd = true

wintry quarry
timid salmon
wintry quarry
#

and once you fix that you will need to grapple with the fact that your code doesn't add anything, it overwrites a string with another string.

rotund crown
#

can anybody link me a simple movement script?
i just need to move around a capsule primitive and have it feel decent
my existing movement script feels teerible, accelerates too slow, deceleration feels jank

wintry quarry
rotund crown
#

what does getAxisRaw do?

wintry quarry
#

It gives you the raw input data

#

GetAxis has some smoothing built in

rotund crown
#

ah i see

#

mm still feels like it accelerates too slowly, maximum speed is too high, deceleration logic is just bad (it also decreases fall speed)

wintry quarry
#

as for too slow accel and too high max speed you would increase the force even more and then make your deceleration proportional to the velocity or add a hard cap

rotund crown
#

mhm but i figured i'td be simpler to just borrow a movement script from the internet, i have little knowledge on how to make 3d movement feel good
plus my friends wanted to have the ability to jump despite the fact the final product will likely not have jumping

wintry quarry
#

sort of like how real drag works

wintry quarry
#

expect it to take time

rotund crown
#

not surprising at all, so many games struggle with it

#

it's for a minigame so having some simple configurable properties is ideal

wintry quarry
rotund crown
#

mhm but realistic movement isnt necessarily what i want

wintry quarry
#

A strictly realistic movement script would take that into account - applying a high force when you kick off the start and tapering off if you're triyng to continue to move in the same direction, while also allowing a very high "braking" force, since that's easy

#

Yeah i understand

#

I'm just talkjing about the forces that need to be applied if you want somewhat reasonable feeling movement

#

you need high forces to feel "responsive"

#

but then limitations on infinite acceleration in one direction

rotund crown
#

mhm, maybe even something like an impulse from the get go

rotund crown
#

hm, why cant i invoke an action with multiple variables?

#

ah duh i forgot you have to declare actions

slender nymph
#

what does the error say

rotund crown
#

i corrected it already, it was expecting <int>, had to add bool in there

deep moss
#

How do i do somekind of checklist where I complete a task and a display in front ticks the task I've done. Also what is it called exactly?

slender nymph
#

that's basically just a quest system. create some data structure that defines the quest: what needs to be completed in code, a property for the description, and an event. possibly even some id to save/load it's state
then when you add the quest to the task list your UI just gets the description and subscribes to some completed event. when the conditions for the quest are met you fire off that completed event and the UI puts a tick to indicate it is complete

lyric cloak
#

guys i need help with coding something

#

i want to make it so when you shoot you bounce backwards

#

would like it if you can make the knockback easily editable

#

if you can help please send me a dm or reply

frosty hound
#

Nobody is making anything for you, here.

lyric cloak
frosty hound
#

Yes absolutely

lyric cloak
#

needed help so though this sever would help

frosty hound
#

If your definition of help is a free handout, then this server is not for you.

lyric cloak
#

welp sorry then

rotund crown
#

hm, can i not set a variable's value on declaration?

#

it always seems to be false, and i commented out the logic that tried to change it

slender nymph
#

the variable is serialized which means whatever value is set in the inspector will be the one applied when this object is created at runtime

rotund crown
#

ah weird

slender nymph
#

that's kind of the entire point of serializing it

wintry quarry
# rotund crown ah weird

think how weird it would be if the value you set in the inspector was arbitrarily ignored 😵‍💫

twin pivot
#

and also setting a variable's value on declaration is not really the best thing to do

rotund crown
#

i want to create a serializefield variable that lets you select one of three options from a dropdown
how would i do that? an enum?

rotund crown
#

mmkay research time

rotund crown
#

hmm, how do i make it visible in editor?

#

adding serialize field here just made nothing show up in the editor, but no errors

stuck field
# rotund crown adding serialize field here just made nothing show up in the editor, but no erro...

Well adding serialize field to a public isn't going to do anything extra, it should show up in the inspector as enums are serializable so it's strange it doesn't, if you plan on using SerializeField though, make the variable private (It's a better practice too as public means any script can access it, and this usually isn't what is wanted, look into access modifiers for more information about this)

#

(Not related to your question btw, just a tip)

#

For your question, could you show the full !code?

eternal falconBOT
rotund crown
#

hmm odd, but yeah making it private did work

#

not sure why it didnt show when it was public

rotund crown
stuck field
#

No clue, as far as I know should still serialize

#

I would assume you just didn't reload

#

And changing that reloaded it

wintry quarry
rotund crown
#

prehaps

#

uh what do i put in line 98 to end the method without returning a variable?

#

also if i have the method call itself again, will it still return the selectedInt to the method that called it?

sour fulcrum
#

you have to return an int

rotund crown
#

mhm but i want this logic to repeat until it selects an int that isnt the lastselectedvalue

sour fulcrum
#

you might want more than one function involved here

rotund crown
#

for what purpose?

slender nymph
#

but i agree with batby, you probably want to split that logic up a bit

sour fulcrum
# rotund crown for what purpose?

this kinda thing has two goals

pick a random value until you get one that isn't the last one

pick a random value
validate that value

might be cleaner to have one function that just picks randomly and returns the result regardless and another in charge of using that function to find a new "valid" one

rotund crown
#

ohh i see

#

the range of values is small enough that i dont need another method in this case

#

anyway, problem solved

onyx geyser
#

doing a tutorial from only 3 years ago, has the whole thing really changed that much? the velocity changed to linear velocity (albeit basically making the process easier) and things like getkey have also changed it seems

#

the whole tutorial has been more or less me troubleshooting the problems because it seems like the terms changed

merry arch
onyx geyser
#

i'd like to use both

#

it'd be nice to have access to both at the same time without much error so i can follow different tutorials from different times while i learn how to use this thing

merry arch
#

It should just work by default? do you get an error when you try to?

onyx geyser
#

yeah, if (Input.GetKey(KeyCode.Space) == true) get's an error that says i have switched to active input handling

merry arch
#

ok hold on

onyx geyser
#

so it won't let me press spacebar

#

i figured i could just switch but that would mean writing down the whole velocity thing underneath it differently, and i quite like how it looks now

#

unless there's an easier way to press spacebar

merry arch
#

yeah so what you can do is: ProjectSettings->Player->OtherSettings->Configuration->ActiveInputHandling and set it to both

#

takes a second to find it once you've gone to other settings lol

onyx geyser
#

i found it rather quickly

#

it's restarting now

#

theorhetically the first game i make takes less than an hour to make, unfortuntely for the tutorial i'm a bit of a cloud head so it's going to take at minimum, 3 hours

#

hey it works, thanks!

merry arch
onyx geyser
#

learning about variables, this is one of the biggest reasons i picked up unity in the first place, this isn't productive text, i just love the idea of being able to make my own controls for the games

#

i'm like- fangirling out because i love this idea so much

onyx geyser
#

being able to make a slider to adjust the variable of something is such a cool idea to me, especially since you can do it in game and adjust to how you see fit

#

maybe i'm just being a nerd

merry arch
#

nah I get what you mean lol

onyx geyser
#

i'd absolutely love to use this when making scripts for items, their values being interchangable, can use this to make all sorts of things right off the bat

merry arch
#

when I was first starting out the idea that I could make my own variable that could be accessed by MY CLASSES was so cool to me

#

so I kinda get it

onyx geyser
#

example, if i wanted to make an item that applies statis effects, like bleed or critical chance, i can adjust the variable in which that happens with that specific weapon, can create a sort of 'base script' that i can copy and paste for each item so i don't have to make them individually

#

i haven't programmed before this, but for some reason there's a familiar feeling of having to make each thing individually, and i don't know where it comes from

#

maybe it's just that i like the idea of creating my own scripts and reusing them because i made them myself

merry arch
onyx geyser
#

ooh

#

that's cute

#

does the range come with the slider? is that what makes it a slider?

merry arch
#

yeah, the Range adds the slider in the inspector, but it can't be seen in game view, it's like changing a variable normally in the inspector, just now you have a slider to go with it!

onyx geyser
#

WOAG

#

slider ehehe

merry arch
#

lmaoo

onyx geyser
#

i hope you know what you've done

burnt vapor
onyx geyser
#

i love sliders

merry arch
#

lmao, that's not all, you can even add graphs, too

onyx geyser
#

huh

merry arch
#

I can't remember how to do that tbh

#

but you can

onyx geyser
#

i'm sure i'll find it in a tutorial somewhere

merry arch
#

maybee

#

there's always google though lol

onyx geyser
#

that's less fun, i like discovering things from tutorials or other people

merry arch
#

fair enough

onyx geyser
#

but now this has me wondering what the final product of the first project will look

#

because i totally expect it to be a linear one weapon game, but i also get carried away

#

and this seems like something i'll get carried away doing

merry arch
#

whatcha working on?

onyx geyser
#

ever heard of kingsfield?

merry arch
#

no 😭

onyx geyser
#

it's a first person dungeon crawler for the ps1 and ps2, made by fromsoftware, WAYYY before dark souls

burnt vapor
#

Could you guys take this to DMs?

merry arch
#

oh my bad

burnt vapor
#

No problem!

onyx geyser
#

my b!

burnt vapor
#

If the main goal is to get unique tiles then you could also shuffle the collection and drop them in a queue which you pick from. If the queue is empty then shuffle it again

rotund crown
#

this logic is to make sure the last value doesnt match the first value of the next set

rotund crown
#

but this is just a prototype, and it doesnt run often enough for a noticable (or any?) lag spike so its fine for this

#

but ill make a mental note

burnt vapor
#

If you want true randomization then just make a Queue of an initial capacity of 4 (assuming it's always 4) and then Shuffle and fill the queue when its length is 0 (which means on initial check and every 4th check since it would be empty again)

simple hawk
#

I've got this code for a spawner that spawns enemies, but the enemies seem to be spawning on top of each other (or somewhere in some kind of invisible radius) and that destroys the previous spawned enemies, kinda annoying since it can stop them from getting to the player in time

#

is there a way to fix it or get around this issue?

sour fulcrum
#

there's dozens on dozens of ways to solve this

#

what do you want to happen

simple hawk
#

I'm not exactly sure, I'm trying to make a top down game with an infinite wave of zombies, so anything but this, I guess

sour fulcrum
#

well this is a code channel

#

you don't really have a code problem here

#

you want to change the way the game works

simple hawk
#

oh, I thought it was a code problem

sour fulcrum
#

code does what its told

#

you have more of a game design problem here

#

perhaps look at similar games and figure out what they are doing for that kinda spawning system and what your game isn't

#

and think about how you want to change the code in order to make that happen

simple hawk
#

alright, thanks for the help, appreciate it

sour fulcrum
#

if you figure out what is "wrong" and what you want to change but aren't sure how to actually implement that via code thats when you are more than welcome to come here

naive pawn
brazen crescent
prime tartan
#

InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
UnityEngine.Internal.InputUnsafeUtility.GetAxis (System.String axisName) (at <8464a637132d4cf7b07958f4016932b9>:0)
UnityEngine.Input.GetAxis (System.String axisName) (at <8464a637132d4cf7b07958f4016932b9>:0)
CarMovement.Update () (at Assets/Scripts/CarMovement.cs:22)

anyone know how to fix this i just downloaded new unity am usng old input system commands i think it probably added new input system automatically
what do i do
how do i find player settngs

drowsy tiger
prime tartan
#

Thanks bro

drowsy tiger
#

scroll in that, you'll find input handling

prime tartan
#

leme try

#

btw can u reccomend me if vs is better or vs code

#

for unity

drowsy tiger
#

both should be fine. I use Rider

prime tartan
#

💀

#

never heard of rider

#

guess i will stick to vs comunity

hexed terrace
#

VS > VSC

sonic hull
#

hi, is there anyway to change which scene is opened at unity editor startup?

hexed terrace
#

Yes, close the editor with the scene you want open

wintry quarry
sonic hull
#

ye i know it, but i want a way to change it

hexed terrace
sonic hull
#

okk i'll move then

#

ty guys

wintry quarry
polar acorn
sonic hull
#

i see, actually, i was caught into a very strange scenario, my unity stuck at start up in Entites's runtimeContentSystem update literally forever, and i cant think about anything peculiar i did other than opening a specific scene before last quit, so i would like to find some help about it

marble orbit
#

what is the difference of vector 2 and Vector 3?

burnt vapor
sonic hull
#

as it says, vector2 has 2 float, 3 has 3

polar dust
#

well, theres some other differences like the methods being different in each

#

Vector2 has no cross product

marble orbit
sour fulcrum
#

its numbers

polar dust
#

its really about how you use them that matters, a Vector2 lets you create a 2D vector, a Vector3 lets you create a 3D vector

sonic hull
#

well... mostly we use vector refer to a position or a direction in 2/3D space, but for themselves they are just grouped floats, you could use them for whatever you want

thorn stone
#

Could any1 help me, where do I make so I see this, because I have script for attack and it says and I think its something from like refference he made

sour fulcrum
#

post your code, not the youtubers

gray blaze
#

I want a good resource that help teach me C# for Unity and game design/programming in general. If anyone has good resources i'd much appreciate it if you can send them

thorn stone
sour fulcrum
#

well either you have code, so we need to see that, or you don't have code, and you don't need this channel

#

i assume that error didnt come from the youtube video?

thorn stone
sour fulcrum
#

ok

eternal falconBOT
thorn stone
#

cool

sonic hull
#

text editor < ide, change my mind

polar acorn
#

But also

"I did it exactly like the tutorial so why does theirs work and mine doesn't" counter:
Number of times it wasn't exactly like the tutorial: 188
Number of times it was exactly like the tutorial: 5
Number of times the code literally did not exist: 1
2022-07-19 to 2025-06-10
polar acorn
sonic hull
#

😭

thorn stone
#

@sour fulcrum

polar acorn
#

but it's also very wrong

thorn stone
#

Wdym

#

😭

polar acorn
#

You should probably actually follow the tutorial

sonic hull
#

😭

polar acorn
#

That's just now how you write a function

#

You have a tutorial to follow, follow it

sour fulcrum
#

it is just one line that is wrong in this specific case though

thorn stone
#

Yeah ik

polar acorn
#

Or just look at the way you've defined other functions in this very file and do that

gray blaze
#

I want a good resource that help teach me C# for Unity and game design/programming in general. If anyone has good resources i'd much appreciate it if you can send any resources I can use

polar acorn
eternal falconBOT
#

:teacher: Unity Learn ↗

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

thorn stone
#

This is what it looks like in yt tutorial

#

And when I do the same

polar acorn
thorn stone
#

Its not working

polar acorn
thorn stone
#

Like I dont have Collider2d nowhere and he doesnt either

#

He has boxcollider2d and so do I

sour fulcrum
#

but you didnt write what he wrote

thorn stone
#

He didnt write it

polar acorn
#

Which is why I added you to the counter

sour fulcrum
#

ohhh

thorn stone
#

He wrote Ontrigger and then selected from options

sour fulcrum
#

@polar acorn its the autocomplete

thorn stone
#

Exactly

#

And I dont have that options

sour fulcrum
#

just write it out manually

thorn stone
sour fulcrum
#

yup you did post that

#

write out what he wrote

#

or didnt write

#

theres no magic embedded in his words he just did the shortcut to write it out faster

gray blaze
#

When I use Microsoft Learn and do C# which one do I press? If so do I need to know all of it for Unity. If not then which ones are the most needed sections? (Sorry if i'm asking a lot of questions)

thorn stone
#

This is what it says

sour fulcrum
thorn stone
sour fulcrum
#

what does the youtube video have

cosmic dagger
polar acorn
# thorn stone

You had red underlines below your errors what happened

#

Did you un-configure your IDE

thorn stone
thorn stone
#

I didnt change any settings

sour fulcrum
#

follow what the youtuber writes

brave robin
# thorn stone

float indeed does not have that method, you want Time instead

copper wind
thorn stone
#

I dont speak C#

#

😭

copper wind
#

And you should initialize time until Meele

polar acorn
median hatch
polar acorn
#

Your errors should be underlined

median hatch
#

but both work

sour fulcrum
gray blaze
naive pawn
gray blaze
#

Well I am a beginner, I have some Java experience. I just don't know what to do on official sources. Like do I do the "C# Learning plans"?

#

Again i'm sorry if i'm asking too many questions

thorn stone
#

So is this bad or what

#

WHAT THE HELL

wintry quarry
polar acorn
# thorn stone WHAT THE HELL

It looks like you are trying to read Input using the UnityEngine.Input class, but you have switched Active Input Handling to Input System in Player Settings.

eternal falconBOT
#

:teacher: Unity Learn ↗

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

thorn stone
#

Where

placid elm
#

Is there a way to cancel reloading domain or at least to save my project while it is reloading? If there is no way to save it then I will have to crash my project I assume

thorn stone
#

@wintry quarry

wintry quarry
#

yep, you found it

thorn stone
#

Which one

gray blaze
wintry quarry
thorn stone
#

alr

#

So old one?

#

😭

cosmic quail
mortal thicket
#

Is there a way to disable filtering on grass on Terrain?

mortal thicket
#

oh, I am sorry 😅

naive pawn
polar acorn
jaunty trellis
wintry quarry
#

it's preferred

jaunty trellis
#

Oh, scrolled up, saw the errors

wintry quarry
#

it's just harder to use for beginners

wintry quarry
jaunty trellis
#

I'm very new but I think I've pretty mch learned it, and its very useful

rich adder
jaunty trellis
#

is that not old?

rich adder
#

top is new, bottom is old

#

just showing how easy it could be

#

but the main benefits is event based so you don't have to poll, action maps, rebinds etc..

jaunty trellis
#

ye ive wrote this so far

#

although the JumpEventListner is just setting acceleartion that allows player to move vertically

rich adder
#

If you use the Generate C# class option you can use Type-Safe actions skipping this string search bs

jaunty trellis
#

im sure there are better ways but im just trying stuff out

naive pawn
#

you could also use serialized references on the actions

jaunty trellis
#

and drag them all into the player? is that preferable?

naive pawn
#

idk about preferable, i'm just saying it's possible

rich adder
#

prefer whatever makes it easier for you

#

just know there are options that you could not do in old Input class

terse sage
#

does anyone know how to fix an issue if i turned on mesh collider on the player, but the player still falls through the ground?

rich adder
wintry quarry
terse sage
#

sorry, still a newbie, don't know where to ask 😄

rich adder
pseudo frigate
#

is there a way to change this setting of a particle system in code? not seeing anything obvious. i need it to use unscaled in certain situations and scaled in others

naive pawn
#

oh wait i was looking at the wrong thing

naive pawn
#

oh i was looking at the right thing? 🫠

rich adder
#

maybe.not sure why it shows up as an enum dropdown maybe there is another ? or justa custom inspector ? dunno

rich adder
#

GUIBoolAsPopup 👀

timid salmon
#

chat i need ur help

#

2wa

slender nymph
#

!ask 👇

eternal falconBOT
nimble apex
#

if someone know they can help

#

btw no collab/job posting

#

its not allowed

obtuse chasm
#

hello got a bit of probuilder 6 issues is this channel alright to ask?

rich adder
obtuse chasm
#

ah saw the probuilder channel now lol

#

mb

timid salmon
# nimble apex its not allowed

kk well i need help adding the int number of a variable in a script into another script so i can use the variable and convert the int into text

wintry quarry
timid salmon
#

one problem is that a bool from the other script also needs to be met to add the set number to the text

#

This is what ive done but yeah..

slender nymph
#

"but yeah.." is not descriptive. what isn't working

rich adder
timid salmon
slender nymph
#

how about instead of being a smart ass, you actually say what isn't working

timid salmon
slender nymph
#

again, what is not working with what you've shown.

wintry quarry
timid salmon
#

The Int Alien Value Isnt being set as the text

wintry quarry
#

You'll want two numbers to add together

#

Not strings

slender nymph
wintry quarry
#

You ignored me

#

And have made no progress

timid salmon
#

i asked too late and im still in school

white girder
#

Man I should really learn how the new input system works atwhatcost

wintry quarry
#

I pointed out that ScoreAdd is clearly false

#

So of course your code will not do anything

timid salmon
#

it gets set to true in this IEnumerator

wintry quarry
#

Clearly that has not run

#

Or not run yet

timid salmon
#

it will run if the "Alien" Gets Hit And Thats In The DamageTaken() Trigger

wintry quarry
#

Are we supposed to be mind readers

#

You didn't show any of that

timid salmon
#

thats my bad

wintry quarry
#

If you want help, show all of your code

white girder
#

Alien just dies after taking any damage? thats crazy

wintry quarry
#

And do some basic debugging

timid salmon
wintry quarry
eternal falconBOT
timid salmon
#

Thats The Alien Take Damage Script

rich adder
#

!screenshots

eternal falconBOT
#

mad No

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

rich adder
#

they even said, no screenshots..

timid salmon
#

ik but it wont let me do text

rich adder
#

read the bot message

#

especially Large Code Part..

timid salmon
#

using System.Collections;
using UnityEngine;
using UnityEngine.Rendering;

public class AlienHeath : MonoBehaviour
{
Animator animator;
public int Health;
public bool ScoreAdd;
public int AlienValue;

void Start()
{
    animator = GetComponent<Animator>();
    ScoreAdd = false;
}

void Update()
{

    if (Health == 0)
    {
        animator.SetBool("IsDamaged", true);
        StartCoroutine(DamageTaken());
    }

    if (Health > 0)
    {
        animator.SetBool("IsDamaged", false);
    }

}

private void OnTriggerEnter(Collider other)
{
    Health = Health - 1;
}

private IEnumerator DamageTaken()
{
    ScoreAdd = true;
    yield return new WaitForSeconds(1);
    Destroy(gameObject);
}

}

rich adder
#

lord

timid salmon
#

is that better?

slender nymph
#

reading must be hard

naive pawn
# eternal falcon

read this bot embed, specifically the part about large code blocks

timid salmon
#

yh im dyslexic

#

😄

naive pawn
#

take your time, don't just ignore it

timid salmon
#

Thanks

#

im trying.

rich adder
#

send the generated link on discord

timid salmon
naive pawn
#

ok so having all your logic in Update is gonna be an issue
you can't really link it with anything else and you'll be starting the coroutine every frame you're dead - which doesn't happen to be an issue in this specific case, but it's not great

rich adder
#

what is even the point of that delay anyway?

#

Destroy(gameObject); already has a float parameter for Time until destroy

timid salmon
rich adder
#

though should make a isDead bool so you dont keep calling

timid salmon
#

oh

#

i diddnt now you kould do that

rich adder
#
if (Health == 0 && !isDead)
        {
            isDead = true;
            animator.SetBool("IsDamaged", true);
            Destroy(gameObject, 1);
            ScoreAdd = true;
        }```