#💻┃code-beginner

1 messages · Page 825 of 1

wintry quarry
#

Just an image. And when it's selected handle the input outside of the event system

fleet ivy
#

Yeah I'm doing that for mouse clicks. I have onpointerdown/up working nicely with it. But I can't find equivalents for a controller

wintry quarry
#

You need to handle this from the input system side not the UI event system side

#

started / canceled phases for the input action

fleet ivy
#

Started/cancelled?

wintry quarry
#

It really depends how you're doing input handling in general

#

Depending on if you're polling or using events, it's a bit different

fleet ivy
#

Events

#

Currently using IPointerDownHandler and IPointerUpHandler in the script to grab those events for mouse and touch

grand snow
#

Event system pointer events work the same on both input systems (as long as the event system is updated if showing a warning)

#

This stuff does not apply to reading device input directly

fleet ivy
#

I'm so confused 😅

grand snow
# fleet ivy I'm so confused 😅

Want to know when a game pad key is pressed? input system action/direct device events
Want to know when the pointer clicks a collider/ui element? Event system pointer events.

#

event system pointer events exist at a higher level as they just inform you when a pointer does stuff to a collider/ui element.

fleet ivy
#

Doesn't the input system actions have to be done on the gameobject of the input action part?

#

Unlike IPointerDownHandler

grand snow
#

I do not understand your question

#

input system actions can be "listened" to and have their state read in many ways in code

fleet ivy
#

The input system messages are only sent to that game object and its children (if it's broadcast)?

grand snow
fleet ivy
#

And I can specify an action through that and then listen for it with On<action>?

grand snow
ancient nimbus
#

hello, does anyone know why my player doesn't wanna stop sprinting?

    public void Sprint(InputAction.CallbackContext context)
    {
        if(context.started)
        {
            IsSprinting = true;
        }
        if (context.canceled)
        {
            IsSprinting = false;
        }


        if (IsSprinting)
        {
            Speed = SprintSpeed;
        }
        else
        {
            Speed = WalkSpeed;
        }```
wintry quarry
ancient nimbus
naive pawn
wintry quarry
ancient nimbus
#

events

wintry quarry
ancient nimbus
wintry quarry
#

ok then yeah please show the action configuration

naive pawn
#

how is the input action set up

wintry quarry
#

And show us what prints when you press and release the key

tired python
#

@naive pawn dunno whether i had this convo with you or not, but remember how my projectiles were meant to track an enemy and destroy on collision? and the problem was what would happen if the enemy object got destroyed before the collision even took place...i came up with the following possible solutions:

  • On making bullet, get a reference to the tower. When target object is destroyed, reference the tower's enemy list to get a reference to get the next enemy in line
  • On making bullet, tower stores a reference to the bullet. If a target gets destroyed when in range, it iterates through the list of bullets and finds the bullets which have a null ref (due to the target getting destroyed) to the target. Change the target to the foremost target in range
wintry quarry
# ancient nimbus

looks like the input handling is fine. I think the problem is probably in your movement script then

naive pawn
naive pawn
wintry quarry
# ancient nimbus

Also make sure the speed values (WalkingSpeed, SprintSpeed) are set up correctly in the inspector

ancient nimbus
#

it is

naive pawn
#

and uh yeah no i don't really remember

wintry quarry
ancient nimbus
#

in the if (context........) function?

wintry quarry
#

yes it's fine to do it here

naive pawn
#

couldn't you just get the speed based on IsSprinting in the actual movement function

#

that seems like it'd be simpler/less spaghetti

wintry quarry
#

you could do that too

#

They should both work but we need to see the rest of the code

#

!code

radiant voidBOT
ancient nimbus
wintry quarry
wintry quarry
#

Also in the inspector is the IsSprinting checkbox working as expected when the game runs?

wintry quarry
#

What about the Speed variable?

ancient nimbus
#

good but i think i found the reason why it isn't working

#

my acceleration code is changing my speed

tired python
#

Currently I have this setup:
A Tower, Bullet and Enemy

  1. When enemy in range of tower, bullet is made.
  2. Tower gives a ref to bullet of enemy on making the bullet.
  3. Bullet moves towards the tower until it either collides or gets destroyed beforehand.

Issue:

  1. Currently, when the target is destroyed before the bullet hits it, the bullet ends up getting stuck at the same place. I have a timer set on it which destroys the bullet once its lifetime reaches a certain threshold

What I want to do:

  1. Make bullet redirect to the next enemy in range when it's target enemy is destroyed.

Possible ways to achieve this:

  • On making bullet, get a reference to the tower. When target object is destroyed, reference the tower's enemy list to get a reference to get the next enemy in line
  • On making bullet, tower stores a reference to the bullet. If a target gets destroyed when in range, it iterates through the list of bullets and finds the bullets which have a null ref (due to the target getting destroyed) to the target. Change the target to the foremost target in range

Question: Which one should I commit to?

wintry quarry
ancient nimbus
#

and it's so dumb

#

it was that my speed variables were too high

#

and with the acceleration, i couldn't notice much change

wintry quarry
#

so it was working fine

ancient nimbus
#

sorry for wasting ur time

naive pawn
#

odd, i'd expect it to take 2 seconds to go from sprint speed back to walk speed (and vice versa) with those parameters

ancient nimbus
#

and set it to 20

gilded badge
#

How do I manually make unity reload environment or something like that?

#

I changed a file and normally it should say “reloading envirmontment” or something but now it doesn’t

#

so i can’t test my changes

wintry quarry
#

ctrl r

gilded badge
#

thank you very very much h

wintry dew
tired python
#

I want the bullets to change target when their current Target is destroyed by another bullet.

wintry dew
tired python
#

i already have the target setting mechanism working, only problem now is that i need to make it somehow change its target, i guess just use a queue then

#
//don't check for null, instead check whether target is active or not since pooling is implemented
        if (_target.gameObject.activeInHierarchy != false)
        {
            Vector3 direction = (_target.position - this.transform.position).normalized;

            this.transform.position += _bulletSpeed * direction * Time.deltaTime;

            if (Vector3.Distance(this.transform.position, _target.position) < _blastRadius)
            {
                _dropletBulletpool.Release(gameObject);
                _duckPoolContainer._duckpool.Release(_target.gameObject);

                //set target gameobject's elapsed time to 0, so that it doesn't spawn at the same spot
                _target.gameObject.GetComponent<SplineAnimate>().ElapsedTime = 0;
                //Destroy(_target.gameObject);
            }
        }
        else //redirect projectile to next enemy
        {

        }

wintry dew
#

do you want the last bullet that kills an enemy to not be destroyed and hit another enemy?

tired python
#

the bullet that hit the enemy is destroyed

wintry dew
#

oh okay so you want all bullets already fired including the tower's new bullets to change target

tired python
#

Exactly

#

the method i mentioned was a bit like a queue tbh

wintry dew
#

well if your problem is redirecting each bullet, dont you have a list of all active bullets somewhere? you could set these from the tower. I recommend not having each individual bullet calculate its next target as that can get costlly and perhaps complicated

tired python
wintry dew
#

yeah, treat the tower's target as a single source of truth for all the bullets

tired python
#

i will also need some form of a query in scenarios where if the target does go out of the tower's range, then the bullet sends a signal to the tower to change its target to the next one in range

wintry dew
#

I dont think you would need a queue, because the enemies are constantly moving so you cant simply use a snapshot and store it in a queue

wintry dew
tired python
#

i think i can actually, everytime an enemy trigger onctriggerenter, i can push it into queue and then if ontriggerexit gets triggered i dequeue it out

#

i don't need to check every frame as that would be costlier

#

i can just use collision triggers to find out

wintry dew
#

I still think a boolean check of position is less costly than what you're suggesting

tired python
#

checking whether enemy is in range every frame is less costly than updating the queue only when collisionexit is triggered?

wintry dew
#

I also recommend not relying on oncollison enter and exit i've found those to have some inconsistencies depending on speed of collision

tired python
#

sorry, not collision, trigger

wintry dew
#

if you're willing to have that compromise I guess it's probably more optimal, but I still would say it's not worth it if you have one enemy as a target

tired python
tired python
#

it's a tower defense game lol

wintry dew
#

So you mean the bullet goes through an enemy completely and exits the collider?

#

because that's the only way on trigger exit is running, it doesn't run if an object is destroyed within

tired python
#

wait lemme draw it out, that would help you understand it better

wintry dew
#

you could also just have the boolean check right before you spawn each bullet, and that would be just as optimal and much less complicated

tired python
#

truth be told, i think it does O_O i recently faced a problem with this exact scenario where if the object was in a collider and then got destroyed or disabled, it triggered oncollisionexit

silk night
#

how did you find a month old comment? 😄

tired python
wintry dew
#

Oh, well i honestly thought it didnt work, but it's still not a territory i'd suggest relying on

silk night
#

oh that conversation was with you, ok makes sense then 😄

tired python
#

then i would also need to worry about enemies which do get destroyed when in range and alter the list

wintry dew
wintry dew
tired python
#

you said to recalculate target when another bullet gets shot, what if there's only one bullet

wintry dew
#

you could allow the bullet to finish, which i've seen some games do, or destroy all bullets at the boundary of the tower's range

tired python
#

i am currently doing that, and trust me when i say this, it genuinely looks wack xD

#

it keeps following the duckies when out of range lol

#

hilarious

wintry dew
#

yeah then you should probably destroy bullets at the boundary

#

are these homing bullets?

tired python
#

yes

wintry dew
#

I see, well still destroying them at the boundary works for that as well

tired python
#

i guess its a matter of what i want and not of implementation at this point, still thanks. i will try to see what i can use. the info you gave me will help me decide stuff!

wintry dew
#

No worries good luck on the project!

cosmic dagger
#

unless it's a homing projectile, you only need to provide the bullet with a direction (to shoot) . . .

real thunder
#

is there like an attribute so some variable is seen in non-debug inspector even if private?

real thunder
#

I am honestly hesitatnt to get plugins for Unity

rich adder
#

gotta make your own then..
NaughtyAttributes is a well used asset though its been around for a while

undone moss
#

can someone help me my audio player doesnt work for some reason and idk why

slender nymph
#

!ask 👇
pay particular attention to the last few lines

radiant voidBOT
# slender nymph !ask 👇 pay particular attention to the last few lines

:thinking: Asking Questions

:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.

-# For more posting guidelines, go to #🌱┃start-here

naive pawn
#

gonna need more info than "doesn't work"

undone moss
#

when i do sound.Source.Play() is gives me a ArgumentNullException

naive pawn
#

how exactly doesn't it work? errors, wrong behavior, no feedback?

#

ah there we go

slender nymph
#

the variable you are calling Play on is probably null

undone moss
#

its not

naive pawn
#

you have not assigned an audioclip

#

you haven't told it what to play

undone moss
#

i have if its null theres a line above it that checks and tells me if its null

naive pawn
#

show code please

#

!code

radiant voidBOT
undone moss
#

this is the code in the player

#

and this is what im calling from a different script

slender nymph
#

that does not prove that s.Source is not null

undone moss
#

if i leave it null it works it tells me te sound isnt found

naive pawn
naive pawn
slender nymph
#

it actually wouldn't

naive pawn
#

it would be an NRE

slender nymph
#

you would think it would be a NRE but it's somehow not

naive pawn
#

hm, how come?

#

oh

#

it's an extension method?

undone moss
#

so what do i do..

rich adder
#

make it no be null

slender nymph
#

find out what is null and make it not null

naive pawn
#

it would be an NRE, then, no?

undone moss
#

guys its not null//

slender nymph
naive pawn
undone moss
#

pretty sure

slender nymph
naive pawn
undone moss
#

this is the same audiomanager ive always used and its always worked

slender nymph
undone moss
#

how do i proce that

solar hill
#

how do you prove its not

slender nymph
#

null check both the audio source and the clip assigned to it

#

so far you're only null checking the thing that has a reference to the audio source

undone moss
#

wdym check the clip

rich adder
#

Debug.Log or breakpoints

naive pawn
#

you've only checked that s isn't null
we're saying to check if s.Source and s.Source.clip are null

rich adder
#

did they change it ?
not sure it should matter if you do Play without a clip assigned gives that error

undone moss
#

and how do i do that

slender nymph
#

how are you checking that s isn't null? it's the same concept

slender nymph
#

just add this before the Play line:

Debug.Log($"Is the Source Null? {s.Source == null}");
Debug.Log($"Is the clip on {s.Source} null? {s.Source.clip == null}");

and show what it prints

undone moss
#

it gave another error

slender nymph
#

what error

naive pawn
#

what was the error

undone moss
#

when it was trying to check s.Source.clip it spat a nullexception

slender nymph
#

and what was the result for just s.Source?

undone moss
#

it didnt get to it

#

its after

slender nymph
#

do it first

#

your current error indicates that s.Source is null

slender nymph
# naive pawn it's an NRE, just tested.

must be a recent change, i found a few stackoverflow and gamedevstackexchange questions about this that indicate that it at least used to throw ANE for a null source

undone moss
#

source is null

slender nymph
#

mic drop

undone moss
#

so what do i do now

slender nymph
#

make it not null

undone moss
#

what even is source

slender nymph
#

presumably the AudioSource assigned to s.Source

rich adder
naive pawn
undone moss
#

ohhh yea its a variable

naive pawn
#

i tested on 2022

undone moss
#

wait so

#

its saying there is no audiosource component

#

question mark?

slender nymph
#

there is not one assigned to the Source variable, correct

undone moss
#

so the situation now is

#

it does create the component with the right clip and settings

#

i dont even know what to check

undone moss
# undone moss

the img is red bc its running and i made it go dark red during runtime

slender nymph
#

are you certain that the line that is throwing the error isn't being called before this object's Awake method is run?

undone moss
#

no its after i click smth with my mouse

#

i didnt try it yet i js clicked play to get this screesshot

slender nymph
#

you're going to need to show more context then

undone moss
#

what do u need to see

slender nymph
#

all of the relevant code and anything that may be relevant in the scene

undone moss
#

thats pretty much it

#

when i start the audiomanager creates audiosources of all the sounds it has

#

and whenvever i click mouse button 1 it plays one of them

#

is doing s.Source = gameObject.Creatcomponent valid?

rich adder
#

depends how Sound object is managed and all that

undone moss
#

this is sound

#

so dd anyone figure it out?

slender nymph
#

not without more context

rich adder
#

also why does each sound have their own AudioSource why not just a few and swap audioclips

undone moss
#

its js how the manager works

#

its kinda old so maybe its a little trash

#

i think i found the issue tho

rich adder
#

unhide the AudioSource field, does any items in array have Null one ?

undone moss
#

i added the debug line and its giving a null exception here

#

its not updating s.Source at all

#

how do i fix that..

slender nymph
#

that's throwing a NRE because you haven't assigned to it's clip yet

#

s.Source is getting assigned here

#

of course, that doesn't prove that the s.Source you are accessing elsewhere is the same which is why we need all of the relevant context

undone moss
slender nymph
#

yes because the clip is null like i just said

undone moss
#

ok gotcha

#

so i put the debug as the last line?

slender nymph
#

how is that going to help? we can literally see it being assigned here, and it still isn't the clip that is the issue in the other code

undone moss
#

bc then itll check AFTER the clip has been assign

#

if u noticed the s.Source.clip = s.Clip line

#

was after the debug

#

wasnt that what u were saying?

slender nymph
#

you're focusing on the wrong thing

#

just give us all of the relevant context so we can actually help pinpoint the underlying issue here

undone moss
#

i dont get what else u need

slender nymph
#

show the full class and relevant inspectors for these objects if you are unsure because i have no idea what other context there even is

undone moss
slender nymph
#

!code

radiant voidBOT
undone moss
#

this is the Sound class, the audio manager, where the Audiomanager.Play is being called from and the AudioManager from the editor

rich adder
#

where do you assign AudioManager btw

undone moss
#

u mean to the other script?

rich adder
#

are you sure there isn't like a duplicate thing going on here

undone moss
#

both audiomanager and the planterboxscriupt game object are both prefabs

#

if that matters

#

wait

#

i found the issue

#

the fact theyre prefabs does matter aparently

solar hill
#

because yes that does matter

undone moss
#

yea

#

do i need to assign it in the code

#

like Findobject().Getcomponent()?

solar hill
#

you need to assign it at runtime

undone moss
#

ok

#

it was my fault it took this long to figure out but thanks yall anyways

slender nymph
#

this is why context matters

slender nymph
# naive pawn i tested on 2022

i did some testing on 6.4, 2022, and 2021. it looks like this doesn't happen at all in 6.4, but in the other two versions i tested (both latest publicly available minor and patch) it happens with serialized AudioSource variables, non-serialized variables throw NRE as expected

try { _serialized.Play(); } catch(System.Exception e) { Debug.LogError(e); }
try { _nonSerialized.Play(); } catch(System.Exception e) { Debug.LogError(e); }
#

6.4 gave the expected "you probably need to assign in the inspector" error for the first line

naive pawn
#

so yeah that's... weird i guess

real thunder
#

I can't yet figure out why my method allows the ray to be 0 while I think I did all needed checks, I am probably missing something but staring at the code haven't helped so far, any ideas?

private Vector3 GetAssumedCollisionPoint(Collider other, out Vector3 assumed_hit_normal)
    {
        Vector3 assumed_collision_point;
        Vector3 previous_pos_for_checking;
        if (previous_pos == Vector3.negativeInfinity)
        {
            Debug.Log("failed to simulate collision point");

            assumed_hit_normal = -body.linearVelocity.normalized;
            return other.ClosestPoint(my_collider.bounds.center);
        }
        assumed_collision_point = other.ClosestPoint(previous_pos);
        if ((assumed_collision_point - previous_pos) != Vector3.zero)
        {
            previous_pos_for_checking = previous_pos;
        }
        else
        {
            if (previous_previous_pos == Vector3.negativeInfinity)
            {
                Debug.Log("failed to simulate collision point");

                assumed_hit_normal = -body.linearVelocity.normalized;
                return assumed_collision_point;
            }
            assumed_collision_point = other.ClosestPoint(previous_previous_pos);
            if ((assumed_collision_point - previous_previous_pos) != Vector3.zero)
            {
                previous_pos_for_checking = previous_previous_pos;
            }
            else
            {
                Debug.Log("failed to simulate collision point");

                assumed_hit_normal = -body.linearVelocity.normalized;
                return assumed_collision_point;
            }
        }
        Ray ray = new Ray(previous_pos_for_checking, assumed_collision_point - previous_pos_for_checking);
        //more unrelated stuff later
}

somehow sometimes ray have Vector3.zero as direction

#

bit of context which is probably not important

    private Vector3 previous_pos = Vector3.negativeInfinity;
    private Vector3 previous_previous_pos = Vector3.negativeInfinity;
void FixedUpdate()
    {
        previous_previous_pos = previous_pos;
        previous_pos = my_collider.bounds.center;
    }
slender nymph
naive pawn
real thunder
#

😑
or right, what have I done

#

should ve be another variable

#

... is someVector == Vector3.negativeInfinity even reliable?

#

seems like the idea to use it as null was not very bright

frail hollow
#

I am doing unity 3d essential tutorial, I placed frefab kid's room on the environment>cube, and unity placed kid's room nicely on top of cube. but when I see in inspector it's position, according to it's y position ( it was neg 5.5) kid's room is supposed to be half-buried inside cube. why does unity do this? (ignoring it's y position and force kid's room to be not buried into cube. but not putting it's proper y postion - suposed to be y = 0 but putting y = -5.5)

naive pawn
#

== has an epsilon applied

sour fulcrum
real thunder
sour fulcrum
#

unity doesn't ignore y's

verbal dome
#

Probably because the comparison produces NaNs

real thunder
#

yeah that's what I was afraid of

naive pawn
#

-Infinity - -Infinity = -Infinity + Infinity = NaN

#

you could use Equals instead

#

Equals uses == on the floats

frail hollow
#

the stuff is the kid's room.

sour fulcrum
#

as in

#

is the stuff in the prefab at a lower y

#

unity does not ignore y's so you just gotta look in your hierarchy to figure out why it's lower

real thunder
#

what's the technical difference between == and Equals ans why one is not a strict upgrade over the other?

#

I guess == have some wiggle room?

#

alright, judging by google it's not that simple question to answer

#

so as I am getting it == allows custom implementation while equals is plain robust reference/bits for value types comparsion?

alpine quarry
#

I have done some Java BlueJ programming Im not great but learing I have decent blender experience and Im looking forward to learning Unity what is the best way to approach this

slender nymph
alpine quarry
#

I prevoiusly did the car tutorial it was at a too slow pace any suggestions

real thunder
frail hollow
# sour fulcrum unity does not ignore y's so you just gotta look in your hierarchy to figure out...

when I asked AI it answers that there are occasions unity ignores Y position (If the prefab has a Collider component and you are spawning it onto another collider, etc) I just can't figure out what causes this. and Yes, it does seem that unity is ignoring Y position of the prefab when I drag it from project window to scene window. when I drag the prefab to scene initial position (12,-10,12) and it is actually at (12,0,12) -> then I change it's actual position to (12,0,12) and it's physical position does not move. -> when I change actual number to (12,-10,12) then the prefab actually movoes to physical (12,-10,12) position. so I can see that Unity ignores Y position of prefab only when I first drag it from project window to scene window on top of other object, which is the cube in this case.

sour fulcrum
#

i do not care what ai said

#

i am not reading that

alpine quarry
slender nymph
#

!learn

radiant voidBOT
verbal dome
sour fulcrum
#

Unity does not ignore y's

real thunder
#

I just watched guides on different mechanics I wanted to implement

#

including low views indian guy talking

frail hollow
sour fulcrum
#

no

#

it fundementally cannot ignore y's

frail hollow
#

go do it yourself, cus I am see it while I am doing it. lol

sour fulcrum
#

thats like saying sometimes numbers skip 2

frail hollow
#

I am here only to ask why it does it not here to argue it.

verbal dome
solar hill
naive pawn
sour fulcrum
naive pawn
#

gotta check yourself a bit there mate

sour fulcrum
#

That there are occasions unity ignores Y position (If the prefab has a Collider component and you are spawning it onto another collider, etc)
this is directly just not true btw and a great example of why AI is awful for learning, atp we need to keep track of bullshit like this

real thunder
# alpine quarry any recommandations on specific ones u did that worked good

only thing I would tell, it might be my personal preference but
just screw the animator transitions, state scripts, and variables (unless self-repeat transition and values connected to animations)
you can do anything by code and it won't break or it would and it will be easy to find by inserting sanity checks
I ve wasted stupid amount of time trying to connect animator FSM with my own FSMs to avoid edgecases, now I just execute transtions from code

naive pawn
#

definitely personal pref, that one. i haven't had any issues with the animator using its transitions/substates/blendtrees

verbal dome
#

You guys try it yourselves. Drag a cube prefab from the project window onto another cube in the scene.
In Pivot mode: the cube clips into the other object.
In Center mode: the cube is placed on top of the other cube.

#

Is that what @frail hollow is talking about

frail hollow
#

I know I am noob that's why I am here lol thanks guys I am reading your answers now

sour fulcrum
#

But the y's reflect that, no?

naive pawn
#

it gives pretty nice separation of concerns - the code tells the animator what's going on, the animator decides what animations to play based on params

naive pawn
frail hollow
#

sec guys first I will show you screenshot of what I am seeing.

solar hill
verbal dome
frail hollow
#

when I first dragged prefab to the scene on top of cube.

solar hill
#

If you tell ai "It has to be this" then it will pull answers out of its ass

frail hollow
#

changed Y positon to 0 and physical positon not moving

naive pawn
frail hollow
#

changed Y positon to initial value, and prefab actually moved, it is floating.

#

Unity ignored Y positon proved.

naive pawn
#

lmao

#

no

#

you didn't change it to the initial value

#

you changed it to 3.8

#

what was the initial value

slender nymph
#

yeah the initial value is 100% scientific notation

naive pawn
#

was it perhaps, 3.8e-10

frail hollow
#

so why does it do this?

naive pawn
#

why does it do what?

frail hollow
#

ignoring y positon.

naive pawn
#

it most likely does not

#

to be blunt, you have an incorrect assumption

#

you are refusing to challenge that assumption

frail hollow
#

what assumption?

naive pawn
#

the root assumption i'm seeing is that, the initial Y value is close to 3.8. it probably isn't

#

go check what the initial Y value is, in full

frail hollow
#

teach me. cus I am in code beginner channel. I am only asking.

solar hill
#

how is this even a code question

naive pawn
#

not trying to be insulting here, but just trying to get to the point

the overall assumption you've brought was that unity ignores Y position
you came here refusing the possibility that that assumption was wrong. you gotta be able to verify or challenge your assumptions

frail hollow
naive pawn
#

it doesn't, yeah

sour fulcrum
naive pawn
#

undo until you see the 3.8320... in the inspector, and check the full value

frail hollow
#

why is it so?

slender nymph
#

what is the actual full value

frail hollow
#

I used other prefab this time and value is 4.232814e-08

solar hill
#

thats pretty much 0

naive pawn
#

yeah so that's 0.0000000423

frail hollow
#

ahhh lol

naive pawn
#

the position does change, it's just a tiny amount so you don't see it

naive pawn
frail hollow
#

so position window size is too small I couldnt read full value of y position lol

#

it's hard to drag right answer from you guys as usual but thanks ^^

naive pawn
sour fulcrum
slender nymph
frail hollow
naive pawn
sour fulcrum
#

free support btw

frail hollow
naive pawn
sour fulcrum
#

yeah because of the students

naive pawn
#

you made a wrong assumption, it's time to learn now, not time to deflect or blame other stuff

solar hill
#

you should apologize

frail hollow
solar hill
#

ok atp its trolling

naive pawn
#

the only thing to blame is your inexperience - with time, you can get rid of the inexperience, but you first have to know that you have inexperience

frail hollow
solar hill
#

yeah... just trolling

sour fulcrum
#

ok have a nice day

naive pawn
#

i regret helping now

sour fulcrum
#

hopefully ai lies to you plenty more

naive pawn
#

"your assumption is wrong" (deflected)
gives help (ignores instructions/questions)

yall are bad at teaching

frail hollow
#

I just find when question asked to coders they can't imagine from other person's perspective it happens very often.

naive pawn
#

this isn't even a code question

#

stop deflecting man

frail hollow
#

and get mad when argued even insulted lol

naive pawn
#

if you only deflect and blame others you'll never improve

sour fulcrum
#

insults people
why are you insulted

naive pawn
#

so... your funeral

#

this isn't even about "code help"

#

take this as a life lesson

frail hollow
#

I wonder, if they remember when they were asking questions, noob questions in programming classes, how teachers answered their noob questions.

naive pawn
#

we remember

#

we were noobs once

#

we respected the answers and the effort that our teachers put into teaching

real thunder
# naive pawn it gives pretty nice separation of concerns - the code tells the animator what's...

what would happen if a game have a huge frame drop while animator chain is set in a chain animation A > B > C while your code executes FSM which checks animation A and then sets trigger A > D and put FSM at a state assuming that, am I meant to validate next frame or something?
I dunno, maybe I suck, but I found it unbearably annoying to keep track of basically 2 FSMs at the same time, while also as I am getting it they are in different "update" frames, and while the animator transitions have the ability to skip through each other on lag spikes

naive pawn
#

even more so, now that we teach ourselves

frail hollow
#

start with insult or blaming? or try to see what your noob persepective mind is missing and try to guide you. probably didnt' even notice when you were guided by teachers lol

naive pawn
sour fulcrum
#

its not worth your time man

frail hollow
#

I find that most coders miss this especially in cyber chat room, and jump into noob's question with agrresive assult, mostly you don't or cant behave in real life. cus you probably get punched in face lol

naive pawn
naive pawn
#

many people here do, afaik.

frail hollow
#

if you don't know where you start what, you are as noob in social skill as me in coding

slender nymph
frail hollow
#

or you can try to protect your friend your freedom

sour fulcrum
#

we can just ignore the weirdo

naive pawn
#

heh, "friend"

sour fulcrum
#

no stress

frail hollow
#

weirdo lol

#

who says whos weirdo ^^?

solar hill
#

can you stop, conversation is over, now you are just spamming

frail hollow
#

you know what, when people drive car, they sometimes think they are the car, think they got bigger like car and behave suddenly like a monster, old women becomes a bear when drive car. what people miss in aggresive driving is that you are still a person in real life. you gotta behave when driving car same as you are walking street. but some people can't do that and do rage driving.

real thunder
frail hollow
#

I find chat channel behavior same as driving. you wouldn't behave like this in acutal life.

#

when question is asked.

#

just remember, you are weirdoes. -_-

slender nymph
#

can a <@&502884371011731486> shut this clown down

frail hollow
#

anyway, I am gonna come back when I have other question, if you had bad experience on my questioning, you don't have to aswer my question next time.

frosty hound
#

Sure let's move on

naive pawn
#

could use animation events, i guess? i don't think i have any cases of that

frosty hound
#

Please keep these comments off the server, and everything will be fine, thanks.

solar hill
#

bro kept himself off the server

naive pawn
#

using animation events

#

ive found that it's really confusing to come back to though. i'll probably find other ways in the future

real thunder
#

I just tried to make something 100% reliable, that was like beating my head against a wall with animator transitions and stuff

naive pawn
#

doesn't the animator do like, max 1 transition per frame or something? i might be misremembering

real thunder
#

I have not been extensively checking for that tbh

#

I sucked much more than now back then but I remember that I had edgecases constantly till I remvoed their possibility by always manually forcing all transitions and if I needed checks to check what is playing and normalized time if I needed that

#

I was pretty surprised why it's not mainstream to not to use animator transitions and parameters

#

like the visual/regular programming situation

naive pawn
#

if i had to guess, the difference there would be because each system of animation and each api for said system would be quite different from each other, whereas with programming languages, a lot of languages are quite similar to each other

real thunder
#

I mean in Unity specifically, like, techincally we got visual programming?

naive pawn
#

and visual programming is super different from, eg, blueprints or scratch or code.org

#

but c# is pretty similar to java, or c++, or js

#

it's a more transferrable skill set

grand snow
#

Unity having c# has made it not a priority to add visual scripting. Unreal perhaps needed BP a lot more due to c++

#

And I guess long ago we also had JS and boo in unity too

real thunder
#

btw, my code checking animations looks like

else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Stun") && !animator.GetNextAnimatorStateInfo(0).IsName("Stun") //checking next because you can interrupt stun by stun
        && animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1)
        {
            StunEvaluateExit();
        }

I could use cached hashes but... it's probbaly fine

naive pawn
#

damn

#

i wouldve assumed you had it all in code and only just synced the state to the animator

prisma shard
#

I genuinely want to know how people find AI useful for coding. 90% of the shit it makes is inefficient like not using events and subscribers etc. Like what kind of spaghetti code simple website projects are vibe coders making to brag about this garbage

#

I cant imagine building a game like this

real thunder
slender nymph
#

60% of the time it works every time

grand snow
slender nymph
#

for real though, it's not super useful unless you already know what you're doing and in that case it's really just a tool to help you do the stuff you already know faster

muted sand
#

can i safely delete these?

slender nymph
#

the readme and tutorialinfo folder definitely, the rest is actually useful stuff
also not a code question

grave yew
#

How to actually learn c# in unity. Like is there some official documentary or something, tutorials dont really give me anything, i cant remember what im doing and why, or what the code does

slender nymph
#

!learn and there are beginner c# courses pinned in this channel

radiant voidBOT
real thunder
#

and it was apparently enough

grave yew
#

Should i start with 2d or 3d?

grave yew
slender nymph
real thunder
#

...no, it looked pretty basic tho

prisma shard
real thunder
#

like it was introducing concepts and having excersises for those concepts

slender nymph
real thunder
#

but that was just enough to start being able to understand code from tutorials

grand snow
real thunder
#

learning to make my own code and understand unity took me months following tutorials and using what they describe in other contexts

#

I am surprised, I can't find online learning site with a built in compiler or something for C# learning, are they still there?

prisma shard
#

im telling u man the C# resources are garbo

#

and the youtube tutorials arent much better

real thunder
#

one I followed through was nice, but I suspect it was Russian

slender nymph
prisma shard
#

i quickly stopped using the official docs because 2 C# experts told me that they are not good as they are full of tons of irrelevant information that just wastes time

slender nymph
#

are these c# experts in the room with us

prisma shard
#

nope they are in the C# discord, and its hard to disagree with them because even a tutorial guy (Code monkey) also restated what they did

grim hazel
#

why not learn fundamentals through c++ ?

slender nymph
#

it's pointless to learn one language with the express purpose of not using that language and only taking the knowledge to another one. just learn the one you intend to use

sour fulcrum
frail hawk
#

i hope that was a joke with c++

sour fulcrum
#

Biggest beginner trap is getting stuck min maxxing their educational sources and never actually committing to any

shell sorrel
#

just start making things

#

hit problem

#

do research

#

solve problem

naive pawn
real thunder
grim hazel
#

i mean i learned my fundamentals through c++ and was able to pick up c# relatively smoothly, its just a suggestion since learning fundamentals is important deosnt nessarily need to be c++

naive pawn
grand snow
real thunder
naive pawn
grim hazel
naive pawn
#

knowing other languages helps to learn the new language, if you already know that other language

#

the first language is always the hardest to learn

real thunder
#

me personally I would use it to learn and it would work

#

can't tell if it's efficeint but that site would like make the job done for me

frail hawk
#

it is a good website i remember using it a long time ago

real thunder
#

of introducing C# enough so I could use that knowledge to get into using Unity tutorials zone

frail hawk
#

really nicely structured and well organized

prisma shard
#

C# seems like a great 1st language to me. And it gives so much java readability

grand snow
#

C# is top class i love it

real thunder
#

...according to Microsoft

#

(this is a joke video I kinda love)

#

-don't tell me it's only for gamedev, you can do other things in Unity too

grand snow
#

you could easily learn c# and go get a backend dev job

#

(with lots of time and effort in the middle)

grim hazel
#

do yall have any good suggestion on where to look for researching data persistence and save/load like a youtube video or article?

real thunder
#

is there a method to check if I can call that before calling that?

#

I can check box - sphere - capsule collider explicitly I guess

#

convex... seems to be able to check that too...

#

would be nice to know if there is something less awkward tho

grand snow
wintry quarry
slender nymph
#

property pattern would probably look better

real thunder
#

wait there are no other opetions other than box/capsule/sphere/mesh convex/mesh non convex?

slender nymph
#

yeah non-convex mesh collider is really the only one excluded from that

real thunder
#

great, thanks

zenith cypress
#
if (myCollider is not MeshCollider mc || mc.convex)

LennyThink

swift sedge
#

C# syntax is truly a work of art

slender nymph
#

if(myCollider is not MeshCollider { convex: false })

real thunder
#

so plane collider is... apprently... a non convex mesh collider?

#

does that mean it's bad for optimization? 🤔

wintry quarry
#

it's a very simple collider

verbal dome
wintry quarry
#

the problem with the concave collider algorithm is it scales poorly with the number of triangles

verbal dome
#

not true threw me off

wintry quarry
#

but the plane collider has... two triangles

shell sorrel
zenith cypress
shell sorrel
#

since it skips the overriden equality

wintry quarry
#

until it is 😛

shell sorrel
#

i just fully avoid that for anything derived from UnityEngnine.Object

#

thankfully large parts of the game are just regular C# code and not untiy objects

grand snow
#

as casts act differently to () casts

shell sorrel
#

well is and as will not throw a excpetion if it cant cast

grand snow
#

ops i meant as, is should be safe but doesnt account for fake null

real thunder
wintry quarry
real thunder
#

no wait right

wintry quarry
#

unless that function needs a MeshCollider specifically

grand snow
# real thunder 🤔

It gets defined outside of the if statement scope so has a chance to be unassigned in your example

#

Similar things happen when you do out var blah

real thunder
naive pawn
verbal dome
real thunder
#

my brain is too scrambled now

naive pawn
#

if (other is MeshCollider mc && !mc.convex)

#

reads much more easily

wintry quarry
#

because that's not the right condition

naive pawn
#

i don't know what the original question was

slender nymph
#

or the property pattern which was already suggested other is not MeshCollider { convex: false}

naive pawn
#

yeah i probably shouldve asked

wintry quarry
#

we allow: MeshColliders that are convex and any other collider

#

we don't allow: concave MeshColliders

naive pawn
#

gotcha

real thunder
wintry quarry
# real thunder 🤔

The problem here could have just been fixed by plugging other into the function

#

instead of mc

real thunder
#

yeah it could but I just don't understand why won't mc fit

naive pawn
wintry quarry
#

becasue if it's a BoxCollider mc isn't assigned

real thunder
#

yes it wasn't existing

slender nymph
real thunder
#

I mixed up things but like this it's fine

        if (other is MeshCollider mc && !mc.convex)
        {
            return GetAssumedCollisionPointNonConvex(mc, out assumed_hit_normal);
        }
naive pawn
#

so this is the opposite of what you want, isn't it

wintry quarry
real thunder
wintry quarry
#

Well the thing is what you're trying to fix isn't an issue 😛

#

Remember if you're trying to pass a MeshCollider variable into the function you can only ever put MeshColliders in, never BoxColliders etc

naive pawn
real thunder
#

it works like that right?

naive pawn
#

mm so that other function is specifically for concave meshes?

real thunder
#

yeah

#

I had one for non concave but I thought it would work for everything...

naive pawn
real thunder
#

honestly neither functions are very useful / clean

#

the idea of using raycasts to get normal of a hit from a TriggerEnter...

#

not super robust

#

I am thinking of somehow making a duplicate of a projectile to follow a trigger-collider main one

#

to detect physics collisions

#

out of spite

#

regenerating it after each hit

#

or something like that

#

also I wonder why don't we have Physics.ConvexMeshCast or Collider.SphereCast APIs

#

are they techincally possible within PhysX even?

naive pawn
#

collider.spherecast would be "possible" within the system of physx, but 🤷 on whether physx actually supports that call

waxen adder
#

I think I just found how to make CharacterController.isGrounded consistent. The property gets set after every CharacterController.Move() call. From some tests people have done on the web, isGrounded needs the object to attempt to move into the ground. So, every CharacterController.Move call should have a negative y component if in that specific call it should be grounded.

real thunder
#

plane probably have... 200?

slender nymph
waxen adder
lyric venture
#

Where should I start to start to learn how to code

wintry quarry
radiant voidBOT
lyric venture
wintry quarry
#

what did you have trouble with?

lyric venture
wintry quarry
livid socket
#

cant you just whitelist it?

wintry quarry
#

Can't help you with that. Bring it up with your parents or whoever is running your network

silent elk
#

Im not entirely sure what catetgory this falls into so this is going here, does anyone know how to make a overlay in unity 2d urp to make it look glitchy, like the five nights at freddys 1 main menu static effect

blissful stratus
#

does keeping ragdolls in the scene without deleting them effect alot on preformance?

woven lotus
#

i saved my unity data into a json file but im on mac, how do i find the json file?

slender nymph
#

look at the path you saved it to

slender nymph
grand snow
#

macs also have file explorers 😆

prisma shard
#

My single biggest demotivators in coding is the anxiety of scalability. Is there any actual good ways to know if there isnt danger in scalability or is that just an expert only ability? Because you can see it with some older games where they cant implement even integer limit changes because of 32 bit vs 64 bit etc

eternal needle
#

there isnt anything scalability wise to consider in most games

prisma shard
#

Perhaps a question of "If something works early that doesnt mean its a good build because it wont work later on so u cant build off it"

eternal needle
# prisma shard I guess i wasnt afraid of integers that much because the numbers go so high thes...

🤷‍♂️ make logic that isn't flawed in such a way. its inevitable there will be an edge case you don't consider if you build a large enough game. there isnt that much to really say here other than you just need to sit and think about how systems intertwine so you can design each system properly. if you just start coding stuff with constantly changing goals, yea it'll likely become a giant tangled mess

#

though regardless your game might still be a relatively tightly closed loop. Maybe it doesnt matter if you hardcode certain aspects or follow poor practices to make something work quicker. Pretty much every single massive game you've played or heard of has had game breaking bugs at some point

teal viper
#

Then there are workarounds and bootleg patches when your implementation is too far to rewrite from scratch.

eternal needle
prisma shard
#

has there been times where people had a bug for like 5 years though and eventually fixed it. professional bugs seem either hot patch fixed or they just dont build any architecture off it. Like i doubt runescape was trying to add permant server architecture on top of bugged crashing vulnerablities. but i might be wrong

eternal needle
teal viper
#

Basically, you build something that works within your expected use cases. That much is totally achievable.

eternal needle
#

the point is less about what osrs does, more that you simply don't need to care about bugs to the point that it hinders development. Your game is going to have pre defined closed loop functionality. Make it work and people usually won't care about minor bugs here and there unless they're actually negatively impacting gameplay

prisma shard
#

thanks for the advice its a bit calming even though i know im gonna mess something up anyway

eternal needle
#

Large games often will have more of these bugs because theres so many mechanics going on, and so much deep rooted logic that they cant fix the core issue. So they implement workarounds. Those workarounds very often lead to new bugs

#

If your game is so large with so many people playing it in the first place, you'll have enough money to not care about the bugs suddenly

prisma shard
#

So many league champions have like 8 year + bugged interactions so yea definitely

teal viper
eternal needle
# prisma shard So many league champions have like 8 year + bugged interactions so yea definitel...

Yea go through any vandril videos and see that 2 champions have probably caused 10+ different instances of crashing servers. The osrs ones are a bit more niche to find, no one puts out truthful informative videos on it

Though one important thing is sitting and thinking about gameplay before wasting time writing logic. Just so we aren't purely talking in hypotheticals lets just take movement systems for example. You don't just start by writing a fully finished movement system before any of your game is thought out. You think about how other systems may interact with a character whos moving. Maybe something can push, stop, or teleport you. If you built a system without considering these, you're going to likely scrap your work or be implementing workarounds to allow it to work

prisma shard
#

I think in that in that regard i already got it covered as i have a 20 page document including math formulas for combat etc

gentle forge
#

can anyone help me out with making it slow down when im zooming into somehing its like my mouse is to fast but i dont wanna slow that down

prisma shard
#

if not u can also check the camera's code in C# and it should be pretty easy to find

gentle forge
#

possible ill take a look new to it so i diddnt wanna be messing with stuff idont know much about i aappreciate the help

west rain
#

Hi everyone. I'm trying to build a project but getting this error when i try to do it.
Its not my project, i just need to build it, but i cant update Universal RP from package manager. Kinda lost what i should be doing here to be able to build. Game runs without issues in editor as well

muted sand
#

are these inputs automatically fired or just an example of what the game lets you do?
like, a template is what i mean

prisma shard
#

I am an absolute noob though so take what i said with a grain of salt

west rain
prisma shard
#

i think i had a similar issue when i tried to play with an ancient project imported into unity

west rain
#

yep no luck

radiant wren
#

Hey for people who know Unity and coding and routing in it can you DM me just need some help thanks
someone advanced

need help with the camera to Follow a Race leader on racing game please

slender nymph
#

!ask 👇

radiant voidBOT
# slender nymph !ask 👇

:thinking: Asking Questions

:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.

-# For more posting guidelines, go to #🌱┃start-here

frosty hound
#

I was 99% certain they didn't read anything I said and would repeat their question.

radiant wren
#

if this is about me i listually have been on Google AI and Chat gpt for alot of coding and its helped so much untill the routing part came through and i had it and i messed up one of the files and cant get it to work again

muted sand
wooden cradle
#

hello im completely new to coding and i want to learn how to what should i do ?(just basics like walk or run in first person)

slender nymph
#

!learn 👇 there are also beginner c# courses pinned in this channel

radiant voidBOT
vague comet
#

The community refuses to play on the newer versions of the games because they like the bugs

wanton epoch
#

Has anyone here done vr with unity before
i’m crashing out trying to change the controller to hands with animations 😭
the animations just won’t work

naive pawn
#

we don't condone DM support here

naive pawn
stuck cedar
#

Hi

rich sluice
#

One message removed from a suspended account.

timber tide
#

Decals are projected in the lightmap uv2 space. They aren't exactly blitted onto independent material renderings

rich sluice
timber tide
rich sluice
#

One message removed from a suspended account.

outer knot
#

hi guys i know this has probably been asked a million times but where do i get started? can i use unity.learn?

timber tide
#

oh but you just want decals? So you're just initing a projector in world space, not exactly modifying that texture

jovial heron
#

hey is it best to find objects during runtime with Gameobject.Find... or drag and drop them in inspector with [SerializeField]

frail hawk
#

SerializeField all the way

rich sluice
#

One message removed from a suspended account.

outer knot
#

what tools can i use to collaborate with someone on a unity project? i have to do a game over summer w my buddy, can i use github?

rich sluice
jovial heron
timber tide
#

if you mean to modify a texture then you wouldn't use decals

rich sluice
outer knot
frail hawk
timber tide
outer knot
#

I see, we are doing a graded course so I have to use git anyways for tracking. Thank you!

rich sluice
timber tide
#

Prefab data just has problems and it's hard to resolve for both godot and unity.

#

So if you're working with someone, you don't both work on the same scene or prefabs at the same time.

outer knot
#

oh..

timber tide
#

Unreal actually has some tools to help prevent multiple people working on that data

outer knot
#

probalby too much for us, we're both complete noobs and we need to finish a game over the summer

timber tide
#

But any c# scripts should merge fine, just gotta communicate it out, but it can break serialization of prefabs but wouldn't create problems with those specific assets.

outer knot
#

I see thanks :> hopefully it works out

#

ill check im not sure if its any better

#

not used github desktop before

naive pawn
#

github desktop is just a client for git

outer knot
#

yeah i watched a few videos theres no added feature from the client to help with any merging issue

#

illl just use the cli

naive pawn
#

isn't there a merge editor in github desktop

#

and in ide integration

outer knot
#

idk the videos i watch just covered stuff like clone/push/branching

naive pawn
#

well yeah extensive merge conflicts aren't exactly a beginner topic 😓

cerulean raft
#

wassup chat

#

i got a quetion if u set smthng active false setActive(false ) can u set it back active true from same object

#

or it has to be from a scirp not attached to it

verbal dome
#

So you can't set it back to active if that code is in Update for example

cerulean raft
verbal dome
#

Maybe

cerulean raft
verbal dome
#

(I don't know anything about what you're doing)

sage mirage
#

@cerulean raft Hey! Are you greek?

cerulean raft
cerulean raft
verbal dome
#

!code

radiant voidBOT
sage mirage
cerulean raft
cerulean raft
sage mirage
cerulean raft
#

can i send the code here

#

its 64 lines so short

verbal dome
#

64 is pretty long, use a paste site

cerulean raft
cerulean raft
verbal dome
#

Nah keep it here

cerulean raft
#

new to discord

verbal dome
cerulean raft
#

ok

#

2nd code

#

now the 1st

verbal dome
#

Don't save the website

#

Hold on

#

Paste the code, then press "Paste it" @cerulean raft and then copy URL link here

cerulean raft
#

ok

#

like this?

verbal dome
#

Sure. So what's the issue

cerulean raft
verbal dome
#

Yeah that Update will not run because the object is inactive

cerulean raft
#

lemme change code fast and ill give it to u

#

deletede 2nd code and left this

#

it works!!!!!!!!!!

#

thx osmal

cerulean raft
alpine quarry
#

I have a problem I have a origial iteam steak I make a prefabs folder and I made steak prefabs with copies of origianl appear when u press space with initialisation but now I wanna cap the range of the prefab steakes yet they dont have x y z axis anymore it they ignore it

wintry quarry
#

Also please don't share code as screenshots

#

!code

radiant voidBOT
alpine quarry
cerulean raft
#

chat how to make my olayer a transform for bullets while my bullets ar prefab and player isnt

dark hatch
#

hey i was using a script that moved my camera pos to player in update (with z offset) in 2d to make camera follow player, but its causing really annoying jittering, is there a better way to have the camera follow player? my player is moving by setting velocity in rigidbody

cerulean raft
cerulean raft
#

but try doing a transform player in camera script

#

then make camera position = player position

dark hatch
#

yeah im doing that

#

but it seems to cause a bit of jiterring

alpine quarry
#

LateUpdate instead of Update maybe

dark hatch
#

okay let me try that

cerulean raft
dark hatch
#

what would it really change to stop jitter though

#

its also definitely not my fps lol fps is not dropping below 500

alpine quarry
#

like it does it every frame but as last

cerulean raft
#

can yall help me as well

#

idk what the .... is happening here

alpine quarry
#

like it lets the objext it follows move first

sage mirage
#

Hey, guys! I would really like to expand on Game Math, but I am really very confused on where to start and how to actually study maths?

#

What do you recommend?

wintry quarry
#

prefabs live in the assets folder / project window

#

DO you mean it's an instance of the prefab?

alpine quarry
wintry quarry
#

Is that one that your script spawned?

#

Is it one you put in the scene directly at edit time?

alpine quarry
dark hatch
wintry quarry
#

it shouldn't be in the scene

#

prefabs live in the assets folder

alpine quarry
cerulean raft
wintry quarry
alpine quarry
dark hatch
wintry quarry
#

yes

wintry quarry
#

the prefab is the original

#

delete the one in the scene

cerulean raft
cerulean raft
dark hatch
cerulean raft
cerulean raft
dark hatch
#

yeah

#

set the bullet object's collider to a trigger collider imo

#

wont run into these problems cuz it disables collisions entirely

cerulean raft
#

it was the colider thing thx bro

dark hatch
#

ok nice

alpine quarry
cerulean raft
#

i probably need to work on my pixel art , idk if its even to call it art

dark hatch
#

then drag it on to the inspector from assets

cerulean raft
#

and idk how to do , i cant place the player in transform variable cuz bullet is a prefab

#

i thought about making a prefab that when start spazns to player with same position ext , then do it instead of player in the variable

#

is there any other choices or just this

tiny crag
#

is there a guide on how to use the new input system code wise?

solar hill
#

!Input

radiant voidBOT
# solar hill !Input
How to Set Input

To set Active Input Handling, go to:
Project Settings > Player > Active Input Handling

• Input Manager (Old): Use the original Input settings.
• Input System Package (New): Uses the new input system package.
• Both: Use both systems.

solar hill
#

woops

#

thought that had it

#

gimme a sec

naive pawn
solar hill
#
Unity Learn

In this series of tutorials, you will first learn how to install the Input System Package and quickly get set up with game-ready inputs. Next, you will learn how to script player movements as well as control your player using the game-ready inputs. Then, you will learn how to customize your own input actions, tailoring the input system to your o...

torn yew
#

When trying to build a Unity game with an IL2CPP backend (and HDRP) on a dedicated server running Windows Server (without a dedicated GPU), I'm encountering an issue with missing meshs. I've tried building it using both the CLI and the Unity Editor. What could be causing this problem?

tiny crag
#

thanks ill have a look

alpine quarry
wintry quarry
dark hatch
alpine quarry
#

so basically the prefabs square was white it was incomplete I deleted the original steak and put the projectilePrefab so the copy steak from the prefab folder into assets

grand snow
#

Wha

dark hatch
#

when dealing with prefabs, that is

grand snow
#

Prefab assets can only reference within themselves or other prefab assets

alpine quarry
bitter pine
#

how do i check if a specific animation clip is playing? i have a clip as a variable and i want to know if its playing or not

solar hill
#

you can use a debug log

grand snow
#

How unhelpful

bitter pine
#

animation clip

solar hill
bitter pine
#

sorry

solar hill
#

i assumed it was an audio clip

#

¯_(ツ)_/¯

solar hill
bitter pine
grand snow
muted sand
#

How would i allow unity to use my function
MovementController.cs

using UnityEngine;

public class NewMonoBehaviourScript : MonoBehaviour
{

    public float PlayerSpeed;

    private CharacterController character_controller;
    private Vector3 player_velocity;

    void Awake()
    {

        character_controller = GetComponent<CharacterController>();

    }


    public void Walk(Vector2 player_input)
    {

        Vector3 move_direction = Vector3.zero;
        move_direction.x = player_input.x;
        move_direction.z = player_input.y;
        character_controller.Move(transform.TransformDirection(move_direction * Time.deltaTime));

    }
}```

Another question is if i should edit it in the `hierarchy` or the `assets` tab as i have the player as a prefab
wintry quarry
#

You have the wrong parameter type

#

the correct parameter type for this is InputAction.CallbackContext

#

e.g.

    public void Walk(InputAction.CallbackContext ctx)
    {
      Vector2 player_input = ctx.ReadValue<Vector2>();
      // The rest of your code...```
#

but also

#

putting character_controller.Move in here is wrong

#

that needs to go in Update

#

basically:

  • in the input handler store the input vector2 in a variable
  • in Update call Move using it
muted sand
wintry quarry
# muted sand yeah that

Example:

Vector2 moveInput;

public void OnWalk(InputAction.CallbackContext ctx)
{
   // Get the latest input data and store it in our variable
   moveInput = ctx.ReadValue<Vector2>();
}

public void Update() {
   character_controller.Move(transform.TransformDirection(moveInput * Time.deltaTime));
}```
muted sand
#

i'm trying to call the functions via the input thing in unity though & it wouldn't let me select the MovementController function

rich adder
#

the method needs the proper Parameter type and its not Vector2 but CallbackContext

#

even the inspector says so

grand snow
rich adder
#

also yea
for clarity your file is called MovementController.cs your class should also be named MovementController not NewMonoBehaviourScript

muted sand
#

sorry im new to unity

grand snow
#

Filename does nothing

rich adder
wintry quarry
#

but you wrote this in the code^

muted sand
#

ohokay

rich adder
#

ultimately is the class name it looks for not the filename

muted sand
#

done

#

this is whatever it'd be named when i add components though

rich adder
wintry quarry
muted sand
#

yeah i did CTRL+S

wintry quarry
#

any errors in the console window?

#

Make sure it's visible in Unity

muted sand
#

nvm there is an error

#

inputaction namespace is

rich adder
#

yea you missing new input system namespace

grand snow
#

Is your ide set up?

#

!ide

radiant voidBOT
wintry quarry
rich adder
muted sand
#

thanks

lavish maple
#

Hello I am trying to make random npc like I have many hairs and body parts and more but how do I combine them so that every 10sec an npc spawns with an other variation. You know what I mean? If it helps its in 2d

naive pawn
#

break that down into smaller, simpler parts
eg - combining specific body parts, doing the spawning, randomizing body parts

lavish maple
#

ok

solar hill
#

Yeah this is really 3 seperate issues

#

start with establishing a base system for the body part variants

#

that should be first, then figure out spawning, and then all youre left is with randomizing it

lavish maple
#

thx

muted sand
# grand snow !ide

okok so i have this but theres no error checking squiggly on line 6 for whatever reason

naive pawn
muted sand
naive pawn
#

pretty sure that isn't the only step

#

make sure you also have the solution open, make sure it doesn't say "miscellaneous files" near the top

naive pawn
#

so that's an issue yeha

#

i can't help further than that though, im not familiar with vs

muted sand
#

okay thanks

frail hawk
#

ah ok was already mentioned

muted sand
#

yeah

#

using no intellisense is pain 😭

frail hawk
#

that is true

grand snow
#

I'm late but yea you can tell by the lack of colouring it's not configured still

grand snow
# muted sand how do i

If you followed the help steps linked by the bot msg then close visual studio and open it from unity via Assets > Open C# Project

#

Or double click a script in the unity editor

muted sand
#

yeah

#

did that

#

no underline

grand snow
#

Is visual studio set as the external editor in your unity preferences?

muted sand
#

yes

grand snow
#

Click the regenerate solution button in there and then try to re open vs

muted sand
#

where is this?

#

i cant find

grand snow
muted sand
#

oh i thought it was in VS

grand snow
#

No

#

Unity controls the visual studio solution

muted sand
#

nope

#

nothing

#

still the same

#

ill restart my pc and see if that works

grand snow
#

!vs

radiant voidBOT
# grand snow !vs
Visual Studio guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

kindred remnant
#

Are there any good tutorials for raycasts

ivory bobcat
#

If the problem isn't resolved, I would suggest showing images of these:

  • Unity workloads
  • Visual Studio Package (VSCode package should not be installed - old and conflicting)
  • External Editor
solar hill
# kindred remnant Are there any good tutorials for raycasts

▸ Learn how to CODE in Unity: https://gamedevbeginner.com/how-to-code-in-unity/?utm_source=youtube&utm_medium=description&utm_campaign=raycasts&video=B34iq4O5ZYI

Learn how to use the Raycast function in Unity.

00:00 Intro
00:57 Creating a Ray
02:33 The Raycast Hit variable
03:11 The Raycast function
04:48 Layermasks
07:10 How to exclude Trig...

▶ Play video
kindred remnant
mental terrace
#

idk if this is the right channel, but how can I make a 2D sprite glow? just want bullets to have a nice glow effect, nothing complicated

muted sand
#

it did not work

#

i DO have the workload though

slender nymph