#๐Ÿ’ปโ”ƒcode-beginner

1 messages ยท Page 675 of 1

burnt vapor
#

I am confused as to why you decided to write this wall of text

clear juniper
#

typically people find it helpful when you help them ๐Ÿ™‚

burnt vapor
#

The main issue they have is that their naming convention is causing great confusion. Bad formatting of class names, the fact Unity has a CharacterController themselves which means you confuse their class with your own.

sour fulcrum
#

but i didnt even respond after that comment what ๐Ÿ˜ญ

clear juniper
burnt vapor
#

Amongst plenty of other things, sure

clear juniper
#

idk if you remember what it's like to be new to all this, but I always found it useful having explanations be grounded in things that I'd already written

burnt vapor
#

When I was new I didn't pick up Unity immediately. It does nobody good to learn both .NET and a whole game engine framework (which implements c# very poorly). Better to just learn basic C# before you take on anything else.

sour fulcrum
onyx geyser
clear juniper
sour fulcrum
#

Depending on the person I do think jumping straight into engine can be solid if you've done a simpl-ish codeacadamy esque c# lesson

burnt vapor
#

Let's be realistic, Sila should take beginner C# courses. Appreciate the help, but you're helping somebody that should take a step back

eternal needle
#

spoonfeeding is usually also discouraged. I'm not directly speaking about the situation above, but we have seen this same scenario many times of an individual refusing to (learn the basics/configure their IDE) because someone chimes in to give them an overexplanation or just the code solution.

clear juniper
#

yeah that's valid

sour fulcrum
#

learning fundementals doesn't exclusively mean taking full on beginner c# courses. I think for a lot of people they would be better off going in engine at a certain point then doing straight c#/net stuff

keen owl
#

Learning C# with a game engine is actually a perfect way to learn the principles of object oriented. You get to see how object and class references work visually rather than just reading about them and running console applications

onyx geyser
#

i'm the type of person that enjoys the struggle, and hate reading so much text or learning from a video, i can't ask questions, sometimes they go too fast, or i get confused by some of the wording, that's not struggling, that's just falling behind.
i like having that human contact because i can ask questions and learn from others experiences rather than a video.

sour fulcrum
onyx geyser
#

i'm not uninterested, and the advice is here, i feel no guilt in asking for help, whether someone wants to give me their advice is up to them, otherwise i would've done something else.

eternal needle
clear juniper
#

when was the last time you used a constructor in unity ๐Ÿ˜‚

burnt vapor
#

You literally can't use it, that's the point

sour fulcrum
#

an hour ago

#

I think learning in engine is really strong because it allows you to make comparisons between pre-existing games in order to understand how things work in practice

#

i swear to god you can teach 99.9999% of beginner to intermediate concepts by making examples out of minecraft

burnt vapor
sour fulcrum
burnt vapor
#

You don't just learn C#, you learn a game object AND the fact you can't even use C# properly. Start with the basics first

clear juniper
#

learn a bunch of things you're not going to use in an environment that is boring as hell - solid advice ๐Ÿ˜‰

burnt vapor
sour fulcrum
burnt vapor
#

Overwhelming, confusing. A beginner is not going to learn anything when they juggle an engine alongside C# basics

sour fulcrum
#

i did

clear juniper
#

I also did

#

though it was flash, which was a bit easier ๐Ÿ˜‚

keen owl
# eternal needle Learning how it works yet a lot of beginners here dont know what a constructor i...

I mean each one learns differently. It helped me seeing stuff visually in the inspector, such as how a boolean represents 2 values, which a checkbox can only have 2 values. Learning about null references and how different objects reference each other in the game world solidified my understanding better than when I were to just write code in the IDE and try learning that way. I found no real example doing it that way. Also learned interfaces alone in unity which was a tough concept for me to grasp.

burnt vapor
#

The majority of people won't be able to do this without getting stuck, it doesn't matter if you did

sour fulcrum
#

are you sure

burnt vapor
#

That's no argument

sour fulcrum
#

what makes you so certain that we are the minority here

burnt vapor
#

I appreciate your argument but I have seen enough cases since coming here in 2019 to know what the approach should be

#

People bite off way too much at once when beginning. Too much ambition to do things. They just get stuck and end up here, overwhelmed

clear juniper
#

the good thing about learning in 2025 is that:

  • there are big active discords where you can get help with a specific problem and get explanations based on stuff you've already written
  • if you don't fundamentally object to the tech, you can ask AI literally anything and be 60% sure what it's telling you is true
  • there's a ton of free content on youtube
sour fulcrum
burnt vapor
#

Most people have no idea how to learn from video's or AI. Especially AI is heavily discouraged here because of the massive spoonfeeding

#

Video's are also just taken for granted. Written over with no idea how it works

eternal needle
burnt vapor
#

Especially a bit issue when a beginner is watching videos. No idea how the syntax even comes together

clear juniper
burnt vapor
#

Doesn't even have to be much, just understand how to write basic C#. That's something that's very often skipped

sour fulcrum
# eternal needle The amount of people we've seen outright quit or get extremely frustrated to the...

I don't think that's a viable metric though. I know many people struggle with learning Unity and c# at the same time. What I'm saying though is I don't believe a lot of those people would actually have a better time dropping the Unity part of that, they would probably have an even worse experience.

The people in question here want to make video games. Removing the video game part of it makes it a lot harder than it does easier.

sour fulcrum
burnt vapor
#

And there you have the issue

#

They go straight to Unity and C# as a complete beginner and get overwhelmed

#

Programming is not about what you want and how fast you can do it

sour fulcrum
#

telling people that are struggling to make a video game to struggle less making something else does not solve the problem

clear juniper
eternal needle
burnt vapor
#

One of the many reasons to just take the basics first

onyx geyser
#

i think the question you should all be asking is if something is genuinely needed for the project the person is doing.

#

the reason i don't hop into fundementals right away is because 90% of the time, most of it is completely useless to what i'm trying to achieve.

eternal needle
#

Ah the age old composition vs inheritance. When the real answer is that both have valid use cases and its never a "always pick one over the other" scenario

onyx geyser
#

so i'd rather learn what i need to know, then when i go into fundementals, i can approach the topic i know i need

sour fulcrum
#

@burnt vapor I think a lot of what your saying applies under the assumption we are talking about people who want to program because they want to program

I'd wager 9/10 people coming into this channel want to program to make video games. The programming is just what they need to learn in order to do that. If you take away the video game aspect of it they aren't going to be interested in the programming

clear juniper
eternal needle
#

Then you likely could be setting things up better

clear juniper
#

that would be the "very specific" part ๐Ÿ˜‚

#

there are very few cases where it's actively better than a simple interface and composition

#

(in unity)
to be clear if it helps you visualise things and you work best with it, it's not awful, but Unity works on composition and you'll often end up with a mess of inheritance that makes it more difficult to work in a larger project

onyx geyser
#

i'm glad this became an actual conversation, i'll hop on fundamentals when i know what i want to learn, but a lot of the time when someone tells another to go do something like that, it breaks spirit.

sour fulcrum
#

not to be combative to that response but i dont think any of us disagreed on learning the fundementals first

#

its just defining what "the fundementals" actually covers and to what extent

onyx geyser
#

i dunno, some of it seemed like disagreement

#

the application of fundementals is different for every person, and it's easier to hold in knowledge when you know what and why you need to hold what you're learning in.

sour fulcrum
onyx geyser
eternal needle
onyx geyser
#

i'll elaborate.

clear juniper
#

I think there are game dev fundamentals and programming fundamentals, there's some overlap - but if you start with programming fundamentals you will learn things that aren't important, and will miss things that are

#

and learning by doing then asking questions is good actually

eternal needle
onyx geyser
#

what i mean by a cake is 6 slices of knowledge (this isn't literal), and each piece has different bits of knowledge that apply to different things.
by eating the whole cake, you stop when you're full, and theres a huge chance on missing out on what you actually wanted to eat.
while just trying ingredients and saying "yeah i want this in my cake", when you go to eat the cake, you know which slice you actually want to eat.

#

some people ARE able to eat the whole cake and get exactly what they want, that's fine, but i'm not that way, i'd rather know exactly what slices i need to eat to understand what i want, and i can eat the other pieces later.

#

in order to know what i want, i need to eat the ingredients, even if i don't understand them at first.

#

is is less effective, can be, but it's how i like to do it, i physically struggle to learn by eating the whole cake.

#

so when people tell me "just go eat the whole cake and come back", it drives me away from wanting to even look at the cake, that's too much cake.

#

whilst if i asked what i used ginger for and someone tells me the uses of ginger and it's application, i better understand "ok, so maybe i don't need ginger right now"

#

i have no clue if any of this was understood, but that's what i think fundementals are.

#

a big ol cake.

#

and unlike many people, the only reason i get 'burnt out' is because i see something else i wanna go and try, i think it's an adhd thing, i never really get 'burnt out' unless i'm drawing for 3 days nonstop and have nothing left on my mind.

#

(hoho i'm so different i know)

ripe shard
onyx geyser
#

i'm gonna eat a whole lot of frosting before i get to the chocolate

#

LOL

ripe shard
eternal needle
# onyx geyser i have no clue if any of this was understood, but that's what i think fundementa...

The example definitely fell apart at times which is understandable given you dont have so much experience. Though analogies usually never encapsulate the full scenario. I dont want to make analogies for this now because i dont want you to get the wrong idea.
The main thing is you should learn enough so at the very minimum you aren't struggling with the syntax. Meaning how to write a variable, define a method, define a class.
Then naturally you can learn stuff like for loops, arrays, lists and whatever else an actual structured course will teach you. These very basics WILL be useful for you in unity.

onyx geyser
#

it fell apart because half way through i realized it wasn't working as intended and continued anyways

onyx geyser
#

instead of saying a vague term that can mean anything

#

fundamentals are vastly different amongst many groups

#

that might not make sense outside of my own brain

burnt vapor
onyx geyser
burnt vapor
#

I'm not saying you should learn the language because I expect you to do more outside of your project. You are just going to get overwhelmed by combining everything, even with a single project

#

I am not sure what else I should say here, we're going in massive circles here

eternal needle
# onyx geyser fundamentals are vastly different amongst many groups

Part of what I gathered from your cake analogy was that you fear you might not use some things you learn. This definitely won't be the case especially if you stick to something like the intro to c# link pinned in this channel. You will be able to apply pretty much everything you learn

clear juniper
#

you have to do things wrong to learn how to do them right

#

it solidifies your knowledge

ripe shard
clear juniper
#

yeah that's fair

onyx geyser
#

i also just like being able to ask questions others might find stupid because i'd rather the human interaction

offtopic but i hate ai call centers, anyways.

clear juniper
#

failure -> feedback cycle is important

burnt vapor
#

Failure by taking stuff at face value wastes time when you could have just done your research

#

I'm not sugar coating it. If you are aiming to complete a project you should not do this

clear juniper
#

but if you do it wrong then are told how to do it right, that knowledge sticks

onyx geyser
#

times not wasted if you enjoy the process

keen owl
#

Trial and error, action, is the best way to learn. Actually performing a task repetitively and building a pattern until itโ€™s solidified

burnt vapor
#

There's a big difference between trial and error when you at least take the basics. There's plenty more you will encounter during the actual project

onyx geyser
#

this is what i've been saying, i'd rather fail, than look at a fundemental and still not understand anything after, because i'd rather write 100 lines of code, mess up 75 times, than reread the same paragraph about class 50 times trying to understand something

burnt vapor
#

Remember the initial issue that sparked the conversation was caused by gross inexperience of absolute C# basics. Could have just started with a very basic project that takes maybe an hour to learn this

sour fulcrum
onyx geyser
#

i told you all, i tried, i really tried, this was about a system for first person, that was it, that was the entire thing, but because of unity's recent updates, the changes have made following ANY tutorials practically impossible.

burnt vapor
#

Unity doesn't update C# syntax. Your issue sparked because you had poorly formatted code

ripe shard
#

Look at this conversation. One guy is running in circles with their arguments and 5 other people try all sorts of approaches to figure out what we are even talking about. 5 are learning, one is not.

burnt vapor
#

Also, back to my initial point of Unity just making things more confusing, the framework has its own CharacterController which just made your issue worse

sour fulcrum
onyx geyser
#

i tried to do a flappy bird tutorial from 3 years ago.
the dudes code worked perfectly, i followed it, tried to learn it, and while his pipes were within camera view, mine were EVERYWHERE, i checked it multiple times, and eventually was just told to jump on in instead of doing the tutorial

keen owl
clear juniper
onyx geyser
#

even things like pressing space were changed, because i had to go around using the space bar by typing in (a much easier verison) of what i wanted.

sour fulcrum
onyx geyser
#

it was though

sour fulcrum
onyx geyser
#

i looked it up, the specific terms used had been changed

#

i did, and it still messed up!

#

i'm not joking

clear juniper
#

oh they did change rigidbody.velocity to rigidbody.linearVelocity?

sour fulcrum
clear juniper
#

yeah

onyx geyser
#

yeah, and that messed me up as a beginner because i didn't know what it meant at the time, i only found out after looking it up

sour fulcrum
#

that wouldn't cause the issue you mentioned though?

onyx geyser
#

one of the ones for pressing buttons got replaced too i believe

sour fulcrum
onyx geyser
keen owl
clear juniper
#

oh yep

onyx geyser
#

it genuinely confused me

#

i then followed someone elses first person tutorial and it ended up spinning my character a lot

sour fulcrum
clear juniper
#

was it the GMTK one? I can poke mark and tell him that a few things have changed

onyx geyser
#

and while, yes, i won't deny it could be me, i also checked that one half a dozen times and gave up to go find a different way to make a first person camera

keen owl
#

FindObjectOfType is deprecated

sour fulcrum
#

the linearvelocity thing is only thing i can think of where the old way outright wont work anymore

onyx geyser
#

and now this one is slightly changed too, there's an error when i type the same thing the dude in the video typed

sour fulcrum
onyx geyser
#

i don't get it, maybe it was the name, but after changing the name, it still didn't work

onyx geyser
#

and started over

keen owl
#

You should allow it to

burnt vapor
keen owl
#

Or just manually fix it

burnt vapor
#

This is usually how it's done. if they didn't provide the old variant then that's quite a big fuck up on their end

sour fulcrum
#

afaik

onyx geyser
#

anyways for the last several days i've just been running into issue after issue with unity, even so far as to when i booted it up and got errors upon booting it up.

burnt vapor
#

That's dumb. Just makes it confusing and annoying to update

sour fulcrum
clear juniper
#

sorry for light mode but it looks like fused is right

onyx geyser
clear juniper
#

might just be rider being clever though

keen owl
clear juniper
#

that could be why things don't work

#

not saying it definitely is, but e.g. case matters

onyx geyser
#

it could be, i didn't deny it, i've slowly been getting better

#

anyways this is what i was talking about with the bird

#

i'm gonna go back and look through the video, but i was pretty sure i did everything the same way.

#

maybe i'm missing something here

sour fulcrum
#

what did the tutorial have ๐Ÿ˜„

onyx geyser
#

this

#

here lemme grab it

sour fulcrum
#

(i think i found the problem btw :P)

onyx geyser
#

i believe this was the line that handled randomizer

sour fulcrum
#

post whole thing

onyx geyser
#

here's the rest of it before he zoomed

#

and made the changes

sour fulcrum
#

i'd need to see the whole thing

onyx geyser
sour fulcrum
#

take a look at your highestpoint for me rq

clear juniper
#

ah beaten to it ๐Ÿ˜‚

sour fulcrum
#

spoilers

onyx geyser
#

right around void? or below that in the instantiate?

sour fulcrum
#

where you set its value

onyx geyser
#

i really have considered just quitting sometimes.
but then i remember i have a task i need to do.

this is one of those times however.

sour fulcrum
#

do you see the issue ๐Ÿ˜„

clear juniper
#

there's one letter difference between yours and the tutorial!

onyx geyser
#

yes

#

reluctantly, yes

#

i see the issue

#

i think i really do need new glasses

sour fulcrum
clear juniper
#

easy mistake to make!

onyx geyser
#

oh well, it's why i make mistakes and talk to people, i now know to look closer when i'm setting positions

#

i remember years ago i messed up and didn't realize i needed to capitilize certain things, still make that mistake from time to time but it's not nearly as bad as it was

sour fulcrum
# onyx geyser i think i really do need new glasses

everyone makes mistakes, the lesson to learn here is getting into the habit of troubleshooting.

the pipes are in the wrong place? what code relates to the pipes? what code relates to what place they are being placed?

onyx geyser
#

thank you

sour fulcrum
#

getting good at programming isn't avoiding making mistakes but learning how to identify, research and solve them

onyx geyser
#

yeah

#

it's why i talk to people who can point things out

clear juniper
#

the worst issues are the ones that don't have an error message ๐Ÿ˜ญ

onyx geyser
#

i think it's funny when the bird hits a pipe and starts spinning

#

it works now btw

sour fulcrum
clear juniper
#

ahahaha yeah I can imagine

onyx geyser
#

the more i write, the more i understand (just really slow)

#

i've also been going back and forth with the unity wiki or whatever it's called

#

hey actually got the error i made this time for once, i'll stop being pesky here for now lol

burnt vapor
#

It's not bad to continue using it, especially because Unity never removes deprecated features. However, the new variant should be preferred and likely works better

short path
#

can any one tell me why my collison or trigger not working

median hatch
median hatch
onyx geyser
#

they did

#

at least

#

it was a single letter i messed up

#

is humbling

median hatch
#

happens to the best honestly

short path
median hatch
#

this is the actual function

#

not OnCollisonEnter

#

!ide

eternal falconBOT
short path
#

It's not working .

dire field
#

Hello, im looking for a little direction. Ive been working on thei buoyancy script which seems to work mostly ok, other than I seem to get constant bobbing up and down. I think I maybe need to slow the force applied as it gets towards the surface plane but im not really sure how to approach it. Here is the code I have so far: https://paste.mod.gg/sirlvfszrrtn/0

naive pawn
dire field
thick sedge
#

good morning

#

how can u snap meshes into another mesh? without having to move it with x y z axis because building scenes is really difficult
Roblox studio had something like that so i think Unity has it too

#

a simple way to give it is How can I build maps easier

boreal violet
eternal falconBOT
feral moon
#

Guys, you are all hope. How can I make all the Boolery functions on False when I click the "New Game" button? Because the object has a DON'T Destroy On Load. That is, I move from the scene to the menu, and when I transition, I have the same object (Objectbar), and the button reacts to a new object, but there is no to the old one. Therefore, when clicking on the "new game", on the contrary, the game continues, because one BULEV function = True in the old object

When the game is rested, everything is fine

https://hastebin.com/share/lebexabiyi.csharp

boreal violet
eternal falconBOT
naive pawn
naive pawn
boreal violet
naive pawn
median hatch
#

check modular assets for starters

naive pawn
#

is the bobbing you see constant, convergent, or divergent, and what's the desired effect?

winter plover
#

Hello, any idea why this doesnt work guys?

    IEnumerator MoveMonsterJumpscare()
    {
        JumpscareSound.Play();
        while (Vector3.Distance(Monster.transform.position, TargetEndPos.transform.position) > 0.1f)
        {
            Monster.transform.position = Vector3.MoveTowards(Monster.transform.position, TargetEndPos.transform.position, monstermovespeed * Time.deltaTime);
            yield return null;
        }

    }
#

the jumpscare sound plays, but the monster doesnt move

#

i've assigned everything aswell

wintry quarry
#

In the loop

winter plover
#

right, one second

#

hey i swear ive seen you somewhere before

#

on discord

wintry quarry
#

I've been around for a while

winter plover
#

ya maybe

#

btw,

#

nvm ima ask it later

#

lemme do that log

#

hey wait, i figured it out. it only moves an inch?

#

i think its my targetpos thats too close

#

nope, i changed to pivot and its still way over

#

also, it only moves like an inch forward.

#

or lets say towrads the empty object

wintry quarry
#

My guess is it's only running for one frame or so

#

The logging will tell you that

#

That's why I asked

winter plover
#

i was destroying the object im playing the coroutine on instantly

#

i instead destroyed it once the monster reached the destination

wintry quarry
#

That would have been my guess

winter plover
#

oh yeah also,

#

do u know the easiest way to make fades?

#

fades meaning like

#

fade a blackscreen in

#

slowly

wintry quarry
#

A coroutine or a tween library

winter plover
#

yes, ik coroutine but what do i do in the coroutine?

#

also which of those is better, tween library or coroutine

wintry quarry
#

Fade the alpha of a black UI image covering the screen

winter plover
#

yes, how do i fade it ๐Ÿ˜ญ

#

lerp the alpha maybe?

wintry quarry
#

That's what I just said...?

high summit
#

Hey folks, I noticed I can change the main URP assset 'cast shadows' function at runtime, I'm creating a 'potato pc' option for my game to run on old hardware, And I'm wondering if there is a way to toggle this option via code?

dire field
viscid girder
#

I have no clue why this is happening. I disabled all scripts for my player but the player capsule (height of 1.9), will not rest on the ground and is constantly moving on the X and Z axes by tiny float values. Usually at rest, the Y position should be 1.45, I even try to set this manually yet it goes to this weird slightly hovering state?

winter plover
# wintry quarry That's what I just said...?

hey,
cant i do smth like this?



 public void FadeIn(float duration)
{
   StartCoroutine(Fade(1, 0, duration));
}


 public IEnumerator Fade(float startAlpha, float endAlpha, float duration)
    {
        float elapsed = 0f;
        while (elapsed < duration)
        {
            canvasGroup.alpha = Mathf.Lerp(startAlpha, endAlpha, elapsed / duration);
            elapsed += Time.deltaTime;
            yield return null;
        }
        canvasGroup.alpha = endAlpha;
    }
}
#

i think this should work

winter plover
#

unless u have a controller

#

like charactercontroller

#

like the radius of the charactercontroller

viscid girder
winter plover
#

hm idrk then

eternal needle
viscid girder
#

Adjusting it here fixes it but I need the collider to be that shape

eternal needle
#

oh i missed the sword collider. its still a part of your RB since it is a child

viscid girder
#

is there any way to make this not the case ๐Ÿ˜ญ

eternal needle
#

you could probably get away with making the sword a trigger collider instead, since you probably dont want it pushing stuff around either

viscid girder
#

it worked ty

#

I think I need that anyway to check for hits and stuiuff down the line

eternal needle
#

there are also layers and setting up the physics layer matrix which you'd want to use if setting up hitboxes on characters

jade cobalt
#

Im following this tutorial but when i want to add a second path my cat stops after the first instead of following the second
https://youtu.be/11ofnLOE8pw?si=fs0XhFSRT_MRn_Su&t=560

#unitytutorial #unitymovegameobject #unitymove #unitymovement
In this video tutorial, I will show you the way how to make a game object move by Bezier curve. Also we will see how to make a game object follow some interesting and unusual paths using several Bezier curves. In other words, you will be able to create any path to follow using any num...

โ–ถ Play video
#

any ideas? I can send the script but im pretty sure i did everything like in the video with the exeption that my cat is a prefab

split plover
#

Im not fully sure what all of the using things mean, but should i be putting using Microsoft.Win32.SafeHandles; and using System; at the start of my scripts? I'm alreeady putting system collections and the input system in for IEnumerators and the input system.

naive pawn
#

if you're using them, sure?

#

but you probably shouldn't be using that first one

split plover
#

Well i don't really know what they do

jade cobalt
split plover
naive pawn
#

using statements just mean "import this library" (to oversimplify)

split plover
naive pawn
#

that's all it means

polar acorn
split plover
#

like i have no idea what microsoft win32 safehandles is

polar acorn
#

And if you're not using it anywhere, it'll tell you that too

split plover
naive pawn
#

if i had to guess, it's windows file handles

polar acorn
#

example: I'm not using System.Collections in this class, I can remove it

split plover
#

Oh i didn't evene realise that it shows if your using it or not

#

thanks

polar acorn
#

and that tells you "This is the namespace that lets me use this class"

naive pawn
#

or delete it and see what errors come up ๐Ÿ™ƒ

polar acorn
#

which, presumably, you do know what its purpose is

#

or else why would you be using it

split plover
#

i should delete system 32 and see if i get any errors for the win32 thing

#

windows didn't let me

#

windows sucks

naive pawn
split plover
#

im trying to use if (InputSystem.actions.FindAction("M1").WasPerformedThisFrame) in an attacking script and everything should be fine but its giving me this method group error, i have literally zero idea how to use the input system so idk why this isn't working

naive pawn
split plover
#

yes

#

i did

naive pawn
#

then invoke it

split plover
#

what does that mmean

naive pawn
#

call the function, Function()

#

WasPerformedThisFrame is a method that returns a bool, it's not a bool itself

#

you have to call it to get the bool from it

split plover
#

is this another one of those things

naive pawn
#

it's a basic c# thing

split plover
#

where someone who told me to use a line of code

#

forgot to put parentheses

naive pawn
#

you should probably go brush up on basic c# if you weren't able to solve this

#

it's a very basic issue

#

don't rely on copy-paste

#

do some actual learning

#

there are resources pinned in this channel

split plover
#

i mean nobody even told me what a method is and i finished the beginner programming course in the unity help thing

naive pawn
#

the beginner programming course is for unity programming specifically, isn't it?

#

about unity messages and such

#

you still need to learn c# itself as a language

#

see the resources pinned in this channel

split plover
naive pawn
#

!collab

eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
โ€ข Collaboration & Jobs

jade cobalt
naive pawn
split plover
#

ignoring the fact you probably shouldn't put this here why would you advertise this in a beginner coding channel ๐Ÿ˜ญ

jagged gazelle
#

!collab

eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
โ€ข Collaboration & Jobs

naive pawn
#

they aren't reading rules, why would they read anything else

split plover
jade cobalt
#

can u stop spamming it in this channel :c

polar acorn
naive pawn
jade cobalt
#

actual begginer asking a code question

split plover
jagged gazelle
#

Anyone Interested?

naive pawn
split plover
polar acorn
rocky canyon
rocky canyon
#

but at the point why not just use a curve

naive pawn
polar acorn
rocky canyon
#

thers no soliciting here

high summit
#

Oops my bad

jagged gazelle
frosty hound
high summit
jade cobalt
#

and im pressed on time+a noob when it comes to unity

polar acorn
#

but splines are pretty powerful, especially if you ever want more involved shapes of paths

naive pawn
jade cobalt
#

i installed the spline thingy but i dont see it under the window tab and i dont know how to put them in :c

jade cobalt
winter plover
naive pawn
polar acorn
jade cobalt
#

ill try doing that

rocky canyon
#

Movetowards -> nextPosition..

if(distance to nextPostion < threshold) -> nextPosition = nextNextPosition; and so on

#

a loop would be ๐ŸคŒ

high summit
#

Hey, Just wondering is this a very resource intensive way of doing this raycast? I'm optimizing the code/game as much as I can and this being called every tick could potentially be overkill?

(but I'm unsure) I need to happen the instant the player looks at something so I guess there is no other way realistically

rocky canyon
#

the raycast takes less than ur actual Tag comparisons

high summit
#

Oh nice, So it's not as expensive as I thought

rocky canyon
#

i wouldnt worry about a single raycast every frame

#

ohh no ofc not..

#

raycasts are cheap

rocky canyon
#

then its probably time to reconsider ur code ๐Ÿ˜„

#

i have a sailboat that shoots about 30 every physics tick. not soo bad

high summit
#

Actually that's a point. I have a seperate raycast script that is for doors, but in theory I coulld merge that into this 'raycast controller' and use the same ray

sour fulcrum
#

Donโ€™t overthink it tbh

thick sedge
eternal needle
winter plover
#

hey guys, what type of vfx should i do for a jumpscare? i can also tell what type of jumpscare it is if u guys need more info

winter plover
#

mb

#

forgot

rocky canyon
# high summit Actually that's a point. I have a seperate raycast script that is for doors, but...

later on u absolutely could use a single raycast script..

i use Interfaces.. if the object has one of those interfaces it just calls the correct function

 void Update()
    {
        ray = new Ray(cam.transform.position,cam.transform.forward);

        if(Physics.Raycast(ray,out RaycastHit hit,distance,mask))
        {
            if(hit.collider.TryGetComponent(out IInteractable interactable))
            {
                cachedInteractable = interactable;
                cachedTransform = hit.transform;
                cachedHitPoint = hit.point;

                if(Input.GetKeyDown(interactKey))
                {
                    cachedInteractable.Interact();
                    Dbug.Italic($"Interacted with {cachedTransform.name}");
                }
            }
            else
            {
                ClearCache();
            }

            draw = true;
        }```
#

3 different types of interactable objects.. all 3 just using an IInteractable Interface

high summit
#

actually, the same thing lol

rocky canyon
#

๐Ÿ’ช

#

ya see it would be very simple to just manage all the interactables in that single raycast script..

#

but as said.. dont worry too much about it.. unless u feel u need to

sour fulcrum
#

components > tags in a lot of cases like that ye

rocky canyon
#

that'd be more concerning than using too many raycasts.. just food for thought ๐ŸŽ

#

but if it works.. and its manageable.. its bout preference

rocky canyon
split plover
#

Alright I've literally done everything i cannot find a singular reason why this is causing this error

    static bool IsDown(InputAction action) => action.phase == InputActionPhase.Performed;

the exact same code that i even copy pasted in to check from another script is working in the first script but isn't working in the second. I have absolutely zero idea why this is happening and i haven't found anything in the unity docs or by looking anywhere i can online.

polar acorn
ivory bobcat
split plover
#

Its static in the first and action shouldn't be null because it isn't in the first script

thick spoke
#

my brain kinda shutdown for a moment, how do i call classes from other scripts? without inheritance

rocky canyon
#

static / singletons, serialized references

split plover
ivory bobcat
eternal needle
split plover
rich adder
#

[SerializeField] private MyComponent myComp

rocky canyon
#

check out this page.. it covers a few

rich adder
split plover
eternal needle
#

it isnt lying. you need to debug why and how you are passing null to it

ivory bobcat
split plover
ivory bobcat
#

Now you've just got to figure out why.

rocky canyon
#

follow along with its progression... try to find when it happens

ivory bobcat
#

Your error lies elsewhere

split plover
#

alright i know this is stupid but im just gonna add a character controller to the script JUST incase to see if it fixes it

rocky canyon
#

lol.. ok

split plover
#

Yeah it didn't work

polar acorn
#

Guaranteed

split plover
#

Yeah i know that

thick spoke
polar acorn
#

So, maybe try some logs or the debugger to find out which thing calling the function is passing the null

split plover
#

there is only one error in the logs

#

and what do you mean the debugger?

rich adder
#

dont you need myAction.Enable();

naive pawn
#

@split plover perhaps look through the stacktrace to see where action is coming from

split plover
#

I dont even think i have that

naive pawn
#

the list of function calls under the error

#

you do

polar acorn
#

then look at it

rocky canyon
#

stack trace is at the bottom of hte console

split plover
#

its saying its happening when the 30th line is called which is when the function with an if statement is called

#

but idk whats wrong with the if statement

naive pawn
#

it's passing null

#

it's not the if statement that's the issue, it's the function call

polar acorn
#

So, look at the line where you're actually calling IsDown, and that line is passing null to it

ivory bobcat
#

Show some code

#

You ought to be calling IsDown somewhere with some variable that's null

split plover
#

Well unrelated but i added returns to the if statement and the function and now its back to saying that the isdown bool is the thing showing null again

split plover
#

it is everything thats included in the errors thoug hso

rich adder
#

whats that lonley GetComponent doing nothing

ivory bobcat
#

So... Mi Input is null

split plover
polar acorn
rich adder
polar acorn
split plover
ivory bobcat
#

There likely wasn't an object-action called "Mi" when Start occurred

split plover
#

so people cant do stuff while doing other stuff

polar acorn
#

You literally are not using the result of that function

naive pawn
split plover
#

wait where are you seeing that

rich adder
split plover
#

i dont have anything called mi

polar acorn
#

You could delete that line and literally nothing changes

naive pawn
rich adder
split plover
#

oh

naive pawn
#

also, !code

eternal falconBOT
naive pawn
#

if you don't want to flood chat, see the "large code blocks" section

ivory bobcat
#

I'm surprised there wasn't an nre prior in Start

naive pawn
split plover
naive pawn
rich adder
naive pawn
#

or maybe the object wasn't active or the component wasn't enabled lol

polar acorn
#

Basic debugging steps

rocky canyon
#

was nav right? were they just not enabled?

split plover
rocky canyon
#

oh okay. i stepped out for a second..

#

ohhh that classic issue

rich adder
split plover
#

yeah pretty average of me to make a simple mimstake

rocky canyon
#

better than making big mistakes..

split plover
#

Honestly atleast big mistakes would be harder to miss

rich adder
#

this would probably be easier just to assign the InputAction in the inspector
(no worries about event order since its Dependency Injected)

rocky canyon
#

big mistakes may require refactoring entire systems tho..

#

much easier to change a keyword or two ๐Ÿ˜›

ivory bobcat
#

Some big mistakes are unrepairable. You ought to never ask for pain.

split plover
rocky canyon
#

post-it notes

#

ALL over ur desk ๐Ÿ˜‰

#

lol

split plover
#

i dont have those but if i did then believe me they would be

rich adder
#

don't worry for me it takes 3-4 mistakes on the same thing to actually learn from it

rocky canyon
#

thas about average tbh. if u dont make a habit out of it manually.. u have to make a habit out of it organically

split plover
#

i got in trouble cause they thought i was kicking the stair not tripping on it

rocky canyon
split plover
#

but the stairs were pretty weak, idk what it was made of, could've just been the paint scratching off too idk

rocky canyon
#

okay.. im all about reminiscing but we're trending offtopic ๐Ÿ˜„

split plover
#

true

rich adder
#

anyway did you add the log and test if m1 is null in start

split plover
#

Yeah thats working now

#

it doesn't even recognize the input though so i'm probably just gonna take the lazy way and use keycode anyways ๐Ÿ˜ญ

split plover
#

actually let me try something

rich adder
rocky canyon
rich adder
#

there is literally so many ways to use it , can be overwhelming at first

split plover
rocky canyon
rich adder
#

btw isnt InputAction serializable? You could assign it in the inspector anyway

naive pawn
naive pawn
rich adder
#

ahh yes thats one

#

thats how much I don't use that...yet..lol

rocky canyon
rich adder
#

for now i stick to "Generate C# " class and just use type safety

#

I will probably regret it during rebinding though lol

rocky canyon
rocky canyon
#

i believe

naive pawn
rich adder
#

SendMessages was so easyy

#

OnMove
bam done..

thick spoke
#

so i got these classes. i am trying to call them from another script. doesnt seem to work the way i thought they did, i am tryna find a way around a serialized field then dragging the script, anyway to do it incode or nah? i dont want inheritance

rich adder
naive pawn
#

do you really need namespaces though

#

if you're a beginner you should probably just avoid them to reduce complexity

rich adder
#

also why do you have 2 PlayerMovement classes lol one MB and one poco

#

anyway if you wrote FirstPersonMovement.PlayerCamera then it would work

rocky canyon
split plover
#

So before i do this im gonna assume it is 100% a stupid and non performant way of doing actions by switching action maps every single time i want to switch between the character moving and attacking

#

and i should probably jump put everything in the same action map anyways

#

should i do it anyways

rocky canyon
thick spoke
split plover
#

like would it be smart so i could learn the input system better

rocky canyon
#

anything u can do will help u learn.

rich adder
rocky canyon
#

even if it doesnt work out

split plover
split plover
rich adder
rocky canyon
split plover
#

The real fix was not trusting myself โค๏ธ

thick spoke
rocky canyon
#

if u store things in a namespace u have to reference that namespace somehow

rich adder
thick spoke
#

i see, understandble, tysm guys

round orbit
#

Im making a car game but
I'm stuck trying to make my car drive properly, even though I added a Rigidbody and tried some scripts it just doesnt move

rocky canyon
#

forces are too low.. or the rigidbody is too heavy / too much friction/drag

#

forces being too low is the first thing i always check

round orbit
#

i can sent screen shot if you want

rocky canyon
#

the code would be more helpful

round orbit
#

kk

rocky canyon
#

possibly a screenshot of the Hiearchy setup and Inspector of them

split plover
#

holy shit the error is back

#

fuck this im using keycodes

round orbit
#

btw i got the code from yt

rich adder
ivory bobcat
rocky canyon
#

Errors can be gatekeeper for other errors...

#

just part of the process

rich adder
#

you have to log and see which one is null

#

before use put Debug.Log

split plover
#

i tested before

split plover
rich adder
ivory bobcat
split plover
#

im just gonna make sure M1Input = playerInput.actions.FindAction("M1"); this is perfectly fine right (the action is called "M1")

round orbit
#

this is the code

rich adder
split plover
#

oh

#

ill put that instead i just put Debug.Log(M1Input);

rocky canyon
#

ohh weel colliders ๐Ÿคข .. sorry i can't help with those

round orbit
#

maybe i need to do it in a diff way?

split plover
#

so like now im just confused

rich adder
rocky canyon
queen adder
# round orbit

maybe I'm missing something but I don't see where you're actually moving the car?

rocky canyon
#

or even adapt it to what u need

round orbit
split plover
#

im genuinly going to go insane

round orbit
rich adder
rocky canyon
#

u can test ur input.. with Debug.Logs

rich adder
#

thats the way these things go

round orbit
#

i did test it with debug

queen adder
rocky canyon
#

go step by step.. first log ur inputs and see if they're working..
then so on and so on

queen adder
#

could be a friction thing

rocky canyon
split plover
rocky canyon
#

it kinda slides to be honest..

round orbit
#

i can send the rig body if you want

split plover
#

atp should i just put everything in a single script so i dont have to deal with this

rich adder
#

you cannot move on to something as a fix without finding the root cause

rocky canyon
#

wheel colliders are rough to work with.. (even as someone thats experienced).

ivory bobcat
rich adder
#

probably 80% of dev is debugging

rocky canyon
#

i prefer hovering cars with raycast suspensions.. and fake wheels

queen adder
split plover
thick spoke
#

another random question, so after i called my class from the other script, can i just like... make it run the entire class? exacly the same, no changes

rich adder
queen adder
ivory bobcat
split plover
naive pawn
ivory bobcat
rich adder
split plover
#

holy fucking shit

ivory bobcat
#

And that you're assigning it through the inspector

round orbit
rich adder
#

show that

split plover
rich adder
#

no offense lol

split plover
rich adder
#

show the inspector for where MovementScript is

rocky canyon
split plover
#

I just dont know what you mean about assigning it in the inspector

rocky canyon
#

so ur basically just using physics to move the actual car.. and the wheels are just there as graphics.. and whats keeping the car up off the ground would be raycasts (suspension forces)

round orbit
split plover
rich adder
ivory bobcat
split plover
rich adder
#

Jinx

rich adder
split plover
#

thats where i assigned it

rocky canyon
# round orbit can you send me a vid link pls?

In this series of videos we will learn, How to make a simple Car movement, Camera follow and add Engine sounds to our Vehicle in Unity 3D by using C#.

In this specific video we will learn the basic and most efficient way to make a Car move, steer and brake by using Unity's Wheel collider component.

SUBSCRIBE FOR MORE !
โžค https://bit.ly/3dR...

โ–ถ Play video
split plover
rocky canyon
#

i think this is a good one.. its a long series.. so it goes into lots of details

#

may not be what u want. but u could def learn from it

rich adder
round orbit
rocky canyon
#

nah, i dont accept DMs sorry.. but u can feel free to ask here

split plover
#

well it doesn't do null errors anymore

rich adder
rocky canyon
#

im not the best person to be asking tho.. im anti- unity wheel collider ๐Ÿ˜„

round orbit
naive pawn
#

which is why you should ask here

rich adder
split plover
rocky canyon
#

let me see if i can find it for u

rich adder
round orbit
rocky canyon
split plover
rocky canyon
rocky canyon
#

the 4th one is important ๐Ÿ˜‰

ivory bobcat
# split plover wdym

You've got to be a bit more creative in your response. It's a rule to help better acquire support and not just make folks explain everything because a person is unwilling to explain what they do not understand. #854851968446365696

round orbit
rich adder
#

I used to be hung up on a problem with a string being misspelled and spent 3 hours on it..
just the way these things go

split plover
#

i feel like im blind in all of this

thick spoke
# rich adder wdym "run the entire class"

so basically, i called the class. i just want it do the exact same thing that wirtten in that class, i edited the script, i tried calling it using a function, but seems i am struggling

split plover
#

that just sounds horrible

rich adder
# split plover oh god

yes which is why I started Opting for Components and type safety instead of Tags ๐Ÿ˜›

#

you live and you learn

naive pawn
split plover
#

just making sure this is the left mouse button right

rocky canyon
#

nav getting messed up by string formatting?? what in the world.. cant be lol

ivory bobcat
naive pawn
winter plover
#
    public void FadeOutVig(float duration)
    {
        StartCoroutine(FadeVig(1, 0, duration)); // from transparent to opaque
    }
    
    public IEnumerator FadeVig(float startAlpha, float endAlpha, float duration)
    {
        float elapsed = 0f;
        while (elapsed < duration)
        {
            canvasGroupV.alpha = Mathf.Lerp(startAlpha, endAlpha, elapsed / duration);
            elapsed += Time.deltaTime;
            yield return null;
        }
        canvasGroupV.alpha = endAlpha;
    }

any idea why the FadeOutVig(); doesnt do anything

rich adder
rocky canyon
split plover
#

Im at the point where still everything i search up isn't working and its the only thing i could even think is wrong with it

round orbit
thick spoke
#

soooo... i think i am doing everything possible wrong

polar acorn
spare mountain
polar acorn
#

Also you have functions in your function

rich adder
naive pawn
thick spoke
rocky canyon
winter plover
rocky canyon
#

theres always alternative ways to do everyhting in unity

naive pawn
thick spoke
thick spoke
polar acorn
# thick spoke

Okay, so, you have a variable of that type? Is that what you mean?

rich adder
#

Update wont run properly if its nested inside another function @thick spoke

#

Unity wont be able to find it

spare mountain
polar acorn
# thick spoke i tihink so...

So, you've made a variable named playerCamera that can hold an instance of your PlayerCamera class. What do you want to do with that reference?

rich adder
#

You might need to follow a tutorial or somethign, seems you're just guessing your way through this lol

thick spoke
naive pawn
polar acorn
rich adder
winter plover
split plover
#

If im using the left mouse button do you guys think its just fine to use a keycode? cause like who would even wanna rebind that anyways ๐Ÿ˜ญ

rich adder
rocky canyon
# round orbit kk

just letting u know now tho... wheel colliders are rough.. (said that bout 3 times already)... maybe an Arcade setup is better for what ur going for..
unless ur making a racing game or something arcade car controllers are pretty good..
(they involve just basic rigidbodies that are hovering off the ground w/ raycasts and "suspension forces" with the wheels drawn in after..

or theres a version thats just a ball (sphere) thats rolling around.. and u then draw in the wheels..

but again.. its up to you. i'll let u cook now ๐Ÿ”ฅ

polar acorn
#

"If it works, leave it" is a fine heuristic -- if it works

split plover
# thick spoke "if it works, leave it"

coding is one thing that i feel this only works if you dont understand the code yourself, which if you wrote the code there is probably an issue there and if you didn't write the code then you should probably atleast try to understand it

rocky canyon
winter plover
naive pawn
naive pawn
winter plover
split plover
rocky canyon
#

ya, never seen a baby run first and learn to crawl second ๐Ÿ™‚

winter plover
#

wait wtf i just realized why is elapsed frozen

round orbit
split plover
rocky canyon
#

i wish u the best

rich adder
naive pawn
#

analysis before synthesis

split plover
round orbit
rich adder
# round orbit kk

this video helped me greatly, its raycast based.. it has a nice feel
https://youtu.be/CdPYlj5uZeI?si=2iEkdyBl_xDPB9Q9

A detailed look at how we made our custom raycast-based car physics in Unity for our game Very Very Valet - available for Nintendo Switch, PS5, and Steam.
BUY NOW!! https://toyful.games/vvv-buy

~ More from Toyful Games ~

โ–ถ Play video
rocky canyon
#

^ yes thats the setup i was describing earlier

#

he also does that with his character controllers ^

#

unique feel for real

thick spoke
#

@polar acorn @rich adder so i am tryna attempt to make a script, where i can call functions from it. as you saw, i have a class in Script A, i managed to call that class from Script B. after that, i just want the code there, like if i paste this code rn inside the script, it works perfectly fine. i want to do the exact same thing, but call it from another script.. i doubt you understood a thing

round orbit
ivory bobcat
polar acorn
naive pawn
# split plover so wait you were disagreeing with me before but now you're agreeing with me?

this only works if you dont understand the code yourself
this implies you just don't know enough about code yet - you just need to learn more
which if you wrote the code there is probably an issue there
code you write yourself generally doesn't tend towards have issues. sure maybe the first time you missed something, but just because you wrote it doesn't mean it'll have issues - this again just points to inexperience, trying to write code before you actually know what you're doing
if you didn't write the code then you should probably atleast try to understand it
this is true

I mean if you wrote code and you dont understand the code then there is an issue isn't there
it's certainly an issue, yes - it just shouldn't happen. if you don't understand it, you shouldn't be writing production code, you should be trying to understand it first

thick spoke
thick spoke
polar acorn
split plover
polar acorn
#

What are you trying to do

naive pawn
winter plover
thick spoke
naive pawn
polar acorn
#

What is the thing you want to be happening

thick spoke
ivory bobcat
# thick spoke let me see

Make a public field. Drag and drop the object you want to reference (using the inspector) into the field. You will now be able to access all public members of that object.

thick spoke
naive pawn
#

what are you trying to achieve

polar acorn
naive pawn
thick spoke
polar acorn
#

You have an object in a box. What thing do you want that object to do

polar acorn
#

"Run the class" is nonsense

#

Stop trying to use code words

#

Tell me using actual things you want to see

#

"I want this cube to move when I press W" kind of stuff

naive pawn
#

what is the outcome you want

#

right now you're talking about what you're trying to do to achieve that outcome

ivory bobcat
polar acorn
thick spoke
naive pawn
thick spoke
polar acorn
#

A Class is a Cleanroom, full of Machines. You can have your Bender and Extruder and whatnot in the Cleanroom, right? Each one of those machines does a specific thing. You give it a metal plate, and it spits out a metal pipe. Right?

naive pawn
thick spoke
winter plover
naive pawn
naive pawn
winter plover
#

im not

polar acorn
#

You set up your AE2 wires to feed in a bunch of different kinds of metal, and your cleanroom routes those metals to your various machines, and spits out the results

thick spoke
naive pawn
polar acorn
#

So, when you're setting up your auto-crafters, you just put the Interface on the input of your cleanroom, and let the machines work, then you pipe it back into the AE2 system

#

That is calling a function. A function is a singular machine.

#

A class is a cleanroom.

#

It's a collection of machines, some of them might feed into each other

#

but the cleanroom itself doesn't do anything. It just holds the machines

winter plover
polar acorn
#

They need to be in the cleanroom to actually work, but the machines are what do the work

thick spoke
naive pawn
polar acorn
#

The cleanroom simply contains the machines

naive pawn
thick spoke
winter plover
thick spoke
polar acorn
naive pawn
winter plover
sour fulcrum
naive pawn
thick spoke
winter plover
polar acorn
#

Let's say you've got a cleanroom that contains a single production line. You'd still need a machine to start it, and that machine pipes into the next, into the next, and so on. You're not giving items to the cleanroom, you're giving them to the first machine in the chain

winter plover
#

oh wait

#

yes

#

im getting multiple

#

@naive pawn

naive pawn
#

cool.. you ghost pinged someone lmao

winter plover
#

ye

polar acorn
#

The cleanroom just passes the items along to the first machine

naive pawn
#

you don't need to ping at all, i'm still in this chat

winter plover
#

wait look

#

it froze at that, then it never gave more logs

naive pawn
#

so no that's not "freezing"

winter plover
#

i didnt timescale in any script

#

at all

naive pawn
#

is the entire game/editor frozen?

winter plover
ivory bobcat
winter plover
#

nothing

naive pawn
rocky canyon
#

if u have a class u dont want running at a certain time its simple as Disabling the script (component) or disabling the entire gameobject

thick spoke
polar acorn
#

Explaining Code using GregTech Metaphors

winter plover
naive pawn
#

frozen as in, can you interact with anything in the game/editor

winter plover
#

i can interact

#

with everything as normal

naive pawn
#

ok so there's not actually any issue with Time.deltaTime then

#

the loop just exited normally

#

it wasn't "frozen", nothing was frozen there

winter plover
#

but it just stops?

naive pawn
#

so have you checked elapsedTime?

untold seal
#

i'm new to unity, any tutorials or tips i should use for starting out?

naive pawn
naive pawn
eternal falconBOT
#

:teacher: Unity Learn โ†—

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

untold seal
winter plover
naive pawn
#

you aren't though, you're adding deltaTime

winter plover
#

so i should set it equal ur saying?

naive pawn
#

can you show your current code

#

no, you should not do that

winter plover
#

//////////////
    void Update()
    {
        Debug.Log(Time.deltaTime);
    }

    public void FadeOutVig(float duration)
    {
        StartCoroutine(FadeVig(1f, 0f, duration)); // from transparent to opaque
    }

    public IEnumerator FadeVig(float startAlpha, float endAlpha, float duration)
    {
        float elapsed = 0f;
        while (elapsed < duration)
        {

            canvasGroupV.alpha = Mathf.Lerp(startAlpha, endAlpha, elapsed / duration);
            elapsed += Time.deltaTime;
            yield return null;
        }
        canvasGroupV.alpha = endAlpha;
    }
naive pawn
#

oh the log was in Update

winter plover
#

yea

naive pawn
#

so.. the object got destroyed/deactivated or the component was disabled

winter plover
#

i have it in update

naive pawn
naive pawn
winter plover
naive pawn
#

..sure?

winter plover
#

ok wait i think i know why now

#

this is prolly why.

#

wait

naive pawn
#

so if the component was destroyed, the object was deactivated, or the object was destroyed, then the coroutine wouldve stopped

winter plover
#

what if i just disable the Is Trigger

#

on the trigger

#

instead of destroying

#

can i do that

naive pawn
#

that would make it a solid collider, probably not what you want

winter plover
#

hm ur right

#

so what can i do

naive pawn
#

i have no idea what you're trying to do

winter plover
#

idk

#

either

naive pawn
#

you do though..

#

what is your game supposed to do

winter plover
#

what if i just disable the box collider completely ๐Ÿ˜ญ ๐Ÿ˜ญ

naive pawn
#

go read that

#

figure out what behavior you want it to actually have

#

what the flow is between these actions

#

i'm not psychic, i don't know what your game is

winter plover
#

i can just send u the script

#

or the specific part

naive pawn
#

use your words

#

what is your game supposed to do

winter plover
#

well when you hit the trigger

#

it makes the canvas fully visible

naive pawn
#

perhaps form a complete thought before hitting enter

winter plover
#

when u hit the trigger, canvas goes fully visible (canvasgroup)
monster movement happens using a while loop to transform the position to a set target position using an empty gameobject
destroy the monster and trigger to avoid double collisions

naive pawn
#

ok, and what does destroying the trigger represent

winter plover
#

forgot it

naive pawn
#

what does it achieve though

winter plover
#

๐Ÿ˜ญ

naive pawn
#

i meant what does destroying the trigger achieve lol

winter plover
#

avoids double hits

#

like if the player walks in it again

#

it might re-trigger it

#

i dont want that t o happen

naive pawn
#

this is for when the player hits the trigger?

winter plover
#

yes

naive pawn
winter plover
#

i used a ontriggerenter, where it checks if the collider was the player and it starts the MoveMonsterJumpscare Coroutine