#💻┃code-beginner

1 messages · Page 173 of 1

slender nymph
#

and you have completed the prerequisite steps?

limber stone
#

yh

slender nymph
#

show the visual studio editor package in your package manager

limber stone
slender nymph
craggy oxide
#

i understand what LateUpdate does but what's its actual timing
Like, Update() is every frame, FixedUpdate() is every physics step
When does LateUpdate run

slender nymph
#

show relevant !code

eternal falconBOT
limber stone
#

k and now

tawdry quest
#

could you elaborate ? what vaules youre talking about

craggy oxide
slender nymph
craggy oxide
#

bro i AM

limber stone
tawdry quest
craggy oxide
slender nymph
tawdry quest
#

you can learn unity after c# and after that you can mess around

craggy oxide
#

can you please stop being so condescending to me when I HAVE been taking courses for DAYS

#

i know days isnt a lot but im trying

hexed terrace
craggy oxide
#

everyone keeps treating me like im going in fully blind im not

slender nymph
#

the lie detector test has determined that was a lie

craggy oxide
earnest atlas
#

you infact are going in blind xD

tawdry quest
#

you cant tell us otherwise, youre prooving it with your questions

craggy oxide
#

its called having gaps in my knowledge

tawdry quest
#

Then you know

#

fill these GAPS

earnest atlas
#

I would rather call that a marine trench

tawdry quest
#

with learning

#

exactly what were telling you

craggy oxide
#

that is WHAT IM TRYING TO DO

#

what do you think I do when I'm not in here

slender nymph
# craggy oxide its called having gaps in my knowledge

and actually going through a structured course that teaches c# is how you close those gaps in your knowledge. we're not telling you to go learn the basics for shits and giggles, mate. if you have gaps in your knowledge about literally the absolute basic stuff then you need to take some time to go learn that

craggy oxide
#

leave me alone

hexed terrace
#

best to stop arguing and go off and get on with what you need/want to do

tawdry quest
slender nymph
#

this isn't an airport mate, you don't need to announce your departure

#

just go do the learning instead of complaining to everyone that you're trying to do it

earnest atlas
#

box coming in with a finisher xD

tawdry quest
limber stone
#

do i restart my pc wen done or its ok

earnest atlas
#

wdym?

#

if u changed setting in IDE you can restart it, tho Im not sure you need that.

#

Restarting pc only needed when app on instal tells you to do that

slender nymph
# limber stone do i restart my pc wen done or its ok

if you've completed the configuration steps in the guide and you've already restarted after installing the c# extension (which installs the .net sdk) then you just need to regenerate project files and restart vs code

hexed terrace
#

if (nothingHasChanged) { restartPC(); }

earnest atlas
#

if (somethingChanged) {delete/system32}

slender nymph
#

don't multiply your velocity by deltaTime

rare basin
#

also, it should be called in FixedUpdate

limber stone
#

ok so the eror say Assets\script\PlayerMovement.cs(12,39): error CS0117: 'Input' does not contain a definition for 'getAxis'

slender nymph
rare basin
#

ow its you, did you finally configure your IDE? @limber stone

limber stone
#

ima fix this rn

slender nymph
limber stone
#

ty i was miss typing that one word and other but this one wouldnt be higligther in red

slender nymph
#

yes, you don't need that. a rigidbody's velocity is already expressed in units per second and the deltaTime multiplication is used to convert something from units per frame to units per second

rare basin
#

for sure not because of that

slender nymph
#

yeah that isn't going to affect the actual framerate

rare basin
#

Vector3 direction = playerRb.velocity; also why did you call that variable direction

#

it's not a direction

wicked bolt
#

Unity just ate my full 32gb ram tryna make a 5400x9600 2d grid

earnest atlas
#

lol

rare basin
#

and why do you make such a big grid

wicked bolt
rare basin
#

i mean optimize

deep goblet
#

big grids are funny

wicked bolt
rare basin
#

ok lol

wicked bolt
#

Followed some guide on unity forums exactly

tawdry quest
wicked bolt
#

Square sprites

tawdry quest
#

if its just an empty grid that would maybe eat 2mb+

slender nymph
#

that's 51 million elements

deep goblet
#

honestly, not enough elements

#

go big or go home

tawdry quest
#

it doesnt eat that much ram

#

but yeah with sprites, rip ram

rare basin
slender nymph
#

is your computer freezing, or is it just unity? if the latter then you probably have an infinite loop somewhere

timber tide
#

damn are you in the matrix

slender nymph
#

yeah this seems like a hardware issue not a unity issue

hexed terrace
#

that computer is fucked

tawdry quest
#

yeah your gpu is dead mate

rare basin
#

seems like your GPU is fucked mate 😄

tawdry quest
#

thats a fried gpu

north kiln
#

Update GPU drivers

rare basin
#

put it in the oven for a 1 minute in 200 celcius degree

wicked bolt
#

Yoo, rain?

#

Pixel rain

earnest atlas
tawdry quest
earnest atlas
#

if your goal was pain then yes

tawdry quest
#

mate incase you missed it due to the restart, your gpu is likely fucked

#

its not unity

wicked bolt
#

I cant help but wonder if its now running integrated graphics

rare basin
#

how do you judge its pretty good?

tawdry quest
#

your gpu might be new / good performing, but its in broken condition by the looks of it

#

that kind of artifacts i had them myself before before my gpu fully killed itself

#

if i remember it was something due to the VRMs shitting themselfs, from me overclocking it too much for too long

#

but guess what, what did i do to my new gpu instantly, overclock it xD

slender nymph
#

that is 100% irrelevant to the issue you showed

tawdry quest
#

yeah that has nothing to do with your freezes or issue

#

completly irrelevant

rare basin
#

that piece of code wasn't even used

slender nymph
#

you weren't even using that variable so it was a useless line anyway

rare basin
#

^ this is your code

#

you made Vector3 direction = playerRb.velocity; and never used it

#

so it's not relevant to your fps issue

#

you made a variable

#

and you are never using it

#

im just showing you that after deleting it, NOTHING will change

#

how can we know?

limber stone
#

hello back unity say i have an error in the code "expected" but i dont see werre it is and wen double clicking on the unity error it canot find the error

ivory bobcat
#

Maybe show the entire error..

slender nymph
limber stone
#

therre isnt any red under line

slender nymph
#

screenshot your entire code editor again

#

prove that it is actually configured now. because if you have an error then it will be highlighted in your code editor

limber stone
slender nymph
#

not configured

limber stone
#

what but i followd the internet thing you sent and did all

slender nymph
#

well you clearly missed something 🤷‍♂️

hexed terrace
#

once it's configured, you'll get red squiggly lines in quite a few places for that code, in VSC

slender nymph
deep goblet
#

mb didnt see that one

slender nymph
limber stone
#

i have it but my licence is over and i whatch tons of vidéeos for fixing it but it wont work

slender nymph
#

install the community version

limber stone
#

thaths why i was stoping programing

hexed terrace
#

VS is free

limber stone
slender nymph
#

with the visual studio installer

limber stone
hexed terrace
#

learn how to google things, my friend

limber stone
#

i did for week

hexed terrace
#

google -> vs community download

#

You didn't learn how to google well then

slender nymph
#

delays how. can you show a video of what is happening?

hexed terrace
#

still moving in Update()

slender nymph
#

it's just assigning to velocity though so that wouldn't be a problem

#

also you completely ignored the earlier advice of removing the deltaTime multiplication

#

you also still have several useless lines in there that do basically nothing

rare basin
#

what is Vector3 direction

#

you know that this is not a direction?

#

and you are never using it anyway

slender nymph
#

remember how everyone told you that had absolutely nothing at all to do with the game freezing

tawdry quest
#

your code still has nothing to do with your broken video card

#

either your video card is broken, or if youre lucky the drivers are faulty

#

i would first use DDU to remove all GPU Drivers and then install the newest available for your card

#

if then its still slowing down or doing the freezes you know that your gpu is broken and you will need to buy a new gpu

limber stone
#

ok so wen i got the visual studio comunity the guid say just to update to get ide is it done ?

tawdry quest
#

it isnt tho, that was clearly your gpu

slender nymph
#

doubt

#

if you aren't going to bother actually listening to anything anyone here tells you, why are you even here?

tawdry quest
#

Listen to what we have to say, otherwise why are you even joining here ?

whole field
#

I have a really specific problem which will be a bit more dificult to describe here so if anyone is willing to help me please dm 🙂

tawdry quest
#

if you need help with DDU im willing to help

dapper egret
#

What is the benfit of using an array versus a list?

tawdry quest
slender nymph
slender nymph
rare basin
honest haven
#
        {
            AudioManager.instance.PlaySFX(31);
        }
        else if (score == 60)
        {
            AudioManager.instance.PlaySFX(31);
        }
        else if (score == 50)
        {
            AudioManager.instance.PlaySFX(31);
        }
        else if (score == 40)
        {
            AudioManager.instance.PlaySFX(31);
        }
        else if (score == 30)
        {
            AudioManager.instance.PlaySFX(31);
        }
        else if (score == 20)
        {
            AudioManager.instance.PlaySFX(31);
        }
        else if (score == 10)
        {
            AudioManager.instance.PlaySFX(31);
        }``` is there a cleaner way to do this. feels very repetitive
tawdry quest
# dapper egret What is the benfit of using an array versus a list?

also if you have to ask this, go watch this: https://www.youtube.com/watch?v=gfkTfcpWqAY

C# tutorial for beginners: Get up & running with C# and code in just 1 hour! No prior knowledge needed.

⭐️Want to learn more from me? Check out these links:

Courses: https://codewithmosh.com
Twitter: https://twitter.com/moshhame...

▶ Play video
rare basin
honest haven
#

yh i know

slender nymph
dapper egret
#

So there is no way to add a something new to an array.Got it thx 🙂

tawdry quest
#

afaik he goes over lists and arrays

rare basin
#

Dictionary<int, int>

#

<score,sfxIndex>

gaunt ice
#

no you dont need dictionary
play the same index

rare basin
#

okay didint see it doesnt change

tawdry quest
honest haven
slender nymph
#

yes

honest haven
#

awesome thanks

slender nymph
#

note that also includes 0 though

gaunt ice
#

0 && <=70 && score%10 if you have to restrict the range

honest haven
#

well i set that max to 70 but really i just want to get the 10th so score could go to 1000

tawdry quest
honest haven
#

so ithink the boxfriend way will be best

#

yh

slender nymph
#

also if score is a float, it is almost impossible for any of these conditions to be true

honest haven
#

thanks, score is int

tawdry quest
slender nymph
#

that's not necessarily true and entirely depends on the design

hexed terrace
tawdry quest
#

never seen a decimal score

#

alr im wrong apparently

slender nymph
#

i made a doodle jump clone where the score was just the height along the Y axis which was a float 🤷‍♂️

limber stone
#

oooh ok now my error scan work ty box frend

tawdry quest
#

ok for the payment for all the back and forth with box: 25 box credits /s They gonna misunderstand this anyways

honest haven
#

thanks guys

whole field
#

Okay so im working on fishing game. RIght now I have a world generating mechanic which randomly spawns prefabs of gameobjects on map (like in this vid https://youtu.be/D4EOgZyNk-k?si=6BCPYr1uIWR3ucvC) I have attached a fishingevent script to each newly spawned lake which I have done by attaching the script to the prefabs of the lake gameobjects. But the problem is that the script has its references (pic) and I just cant find a way how to fill those references by a script whenever the object spawns so yeah pls help :DDDD

limber stone
#

ok an other proble not the typing ig but it jump but not evry time i press space

#

like 3 time at 10

hexed terrace
#

What.

limber stone
#

my jump button work but it dont jump evry tim i press

hexed terrace
tawdry quest
#

pfff

honest haven
#

i have another horrid one. if (CansGameManager.instance.above70) { speed = 9; } else if (CansGameManager.instance.above60) { speed = 8; } else if (CansGameManager.instance.above50) { speed = 7; } else if (CansGameManager.instance.above40) { speed = 6; } else if (CansGameManager.instance.above30) { speed = 5; } else if (CansGameManager.instance.above20) { speed = 4; } else if (CansGameManager.instance.above10) { speed = 3; } else { speed = 3; } what could i do to clean this one up. really every 10 it just increases the speed. Could i just get the score again and check if % 10 speed +=1; would that work best

tawdry quest
tawdry quest
rare basin
#

switches will result in the same ugly wall

tawdry quest
#

yes but its way better for performance

limber stone
rare basin
#

where did you hear that

honest haven
#

switches yes dictonarys no. again i dont want this to cap at 70 would like this to be forever 80,80,90 etc...

earnest atlas
#

I dont think its working as I think it should?

gaunt ice
#

dictionary or switch cannot solve it
this is not one to one mapping but many to one mapping

rare basin
#

or serialized dictionaries

tawdry quest
#

it is worlds better, if you do this if else the entire time instead of switches

#

its minimal at once, but very bad at scale

gaunt ice
#

you need sorted set (idk if it support lower bound search)

rare basin
#

why dictionary wouldn't slove it?

gaunt ice
#

read the comment above and above this comment

limber stone
rare basin
#

i did

tawdry quest
hexed terrace
stuck palm
#

Can you crash an audio source? If I run my mouse really fast along buttons which are configured to playoneshot a sound on hover eventually they stop making sounds

rare basin
#

assuming you add the entries via inspector

honest haven
#

Im lost so diconary is a no?

hexed terrace
tawdry quest
whole field
gaunt ice
#

you can use an decreasing array and iterate it and break until you find the element right smaller than it

honest haven
earnest atlas
#
var instance = CansGameManager.instance;

switch (instance)
{
    case var _ when instance.above70:
        // Code to execute when above70 is true
        speed = 9;
        break;

    case var _ when instance.above60:
        //etc
        speed = 8;
        break;
}```
?
gaunt ice
#

run faster then sorted set since you only have few elements (<10)

hexed terrace
earnest atlas
#

thats the most readable

tawdry quest
earnest atlas
#

and easy to add new cases

honest haven
#

i want to change the whole thing. i dont think i want the bool any more i just want to get score now. and if its above 10 speed is 1 above 20 speed is 2 etc...

whole field
hexed terrace
#

So you have references to prefabs 😄

stuck palm
whole field
gaunt ice
#

hashtable basic:
it is used to provide one to one mapping so if you have something likes

type val;
int x=X;
if(x<100){
  val=thing;
}else{
  val=another thing
}
```which implies the for x in **range** [INT_MIN,100) val=thing, which is not one to one mapping
tawdry quest
honest haven
tawdry quest
honest haven
#

that might be php sorry

hexed terrace
slender nymph
tawdry quest
stuck palm
buoyant knot
tawdry quest
#

but it shouldnt like stop playing completly, that behaviour is not normal

#

what unity version are you on ? Some new beta version or is it a "stable" release

whole field
buoyant knot
#

SpawnedEntityHandler : Monobehaviour has Initialize(…) which is like a standard initialize

#

the script that instantiates the new gameobject has basic information needed to pass in to call Initialize

#

SpawnedEntityHandler can also get other information from singletons.

buoyant knot
#

but SpawnedEntityHandler gets the key unique info it needs to start up in that Initialize( call

honest haven
buoyant knot
#

shit like starting position, starting velocity, starting rotation, what kind of object it is supposed to be…

#

SpawnedEntityHandler has basically 1 job: manage loading and unloading of the thing. It does not have any code specific to the kind of object it is.

#

Other scrips on the object query SpawnedEntityHandler in Start() to know wtf is going on, to initialize their own variables.

#

does this all make sense, tt?

bitter axle
#

When i import a 3d model from blender into unity and apply rigidbody it doesnt work? The only way it works for is to put a invisible capsule with a mesh collider. But how can i make the 3d model itself have mesh collider all around it instead of having to use a capsule or something?

tawdry quest
#

oh wait are you saying hover ?

#

is it in update ?

#

and checking for hover

#

or are you using lateupdate / fixedupdate

#

cuz it could be that its playing the oneshots like 300times per second (at 300fps)

stuck palm
tawdry quest
stuck palm
#

like onhover on select and stuff

#

ill record a vid one sec

tawdry quest
tawdry quest
#

and only fire once

tawdry quest
# stuck palm

can you show how youre playing it, on the ui and the code

tawdry quest
tawdry quest
#

Listening to events, hmm i have no clue, maybe the logs can help, but i dont think thats it, i think something else might be broken

#

im out of ideas what could be the problem

stuck palm
#

you hear what the problem is though right?

tawdry quest
#

yeah

stuck palm
#

seems to fix it self when one item has fixed playing

#

idk

tawdry quest
#

can you go in the audio settings and make a screenshot of that

#

maybe you set your max voices to some weirdly low amount by accident

stuck palm
#

where do i check audio setitgs

tawdry quest
#

Project settings audio

#

ah ye

#

512/32 seems normal

#

ok now im lost, i have no clue anymore to be honest

#

maybe an editor bug ?

#

have you tried restarting your pc since this happend ? If its an editor bug it might fix it, thats the last thing that i can think of

proper flax
#

it wont move the player

stuck palm
tawdry quest
ember imp
#

why is the code different colour?

stuck palm
#

i also have this weird issue where when i switch UI panels, the button that was last active before i make set the gameobject to false keeps its previous state, so it stays yellow or whatever. how can i fix this?

tawdry quest
ember imp
#

IDE?

tawdry quest
#

the development enviroment

#

youre using visual studio code, the person in the video is using visual studio

#

i would recommend installing visual studio inside unity hub, its the first addon if you click on manage install

#

Also you would need to set up visual studio code manually for unity if you want to use vsc

#

!ide

eternal falconBOT
ember imp
#

this dont work and idk why

tawdry quest
deep goblet
#

I'm trying to set up a simple grid, and seperate objects that you can drag and snap onto the grid, I have a working grid and a separate dragging script that doesnt snap to anything, is there a way to snap it to the separate grid or would it need to be in the same grid manager script

tawdry quest
tawdry quest
#

ok that seems correct, please send the whole code

#

!code

eternal falconBOT
thorn holly
tawdry quest
thorn holly
#

Or are you asking if there a way to make the code for the grid snap in the objects?

tawdry quest
deep goblet
thorn holly
#

Ah, I see

deep goblet
#

but because i will have different objects to drag i would think i need the snapping feature to be on the objects rather than anything in the grid

thorn holly
#

I see

#

So what you could do is make a list of every grid tile’s transform in the grid, then loop through that list, find the closest one, and set the objects position to the closest one

thorn holly
#

Alternatively, you could just simple make its position round to the nearest ____

deep goblet
#

hmm, because the grid manager and dragging scripts are separate would I be able to access that list of tile transforms?

ember imp
#

i dont think its the code

#

but this makes no sense

thorn holly
fossil drum
tawdry quest
tawdry quest
# proper flax

can you refrain from reposting everything if i dont instantly answer? i will get to you

ember imp
deep goblet
tawdry quest
# ember imp what new input system

unity has an "old" and a new input system, if you look into your package manager and you search input manager is that installed or not

fossil drum
#

His spelling is all wrong, why are you talking about the new or old input system? UnityChanHuh

cosmic dagger
tawdry quest
#

cuz it looks like its trying to use the new input system but its not fully set up

ember imp
thorn holly
ember imp
deep goblet
#

i honestly forgot raycasts existed i was just gonna use screentoworldpoint 💀

slender nymph
# ember imp

and do you see an axis called Horiznonal in there?

tawdry quest
cosmic dagger
tawdry quest
#

same for @slender nymph

ember imp
tawdry quest
slender nymph
tawdry quest
cosmic dagger
slender nymph
#

and actually take a look at the stack trace for the errors too if they persist

cosmic dagger
#

if it still appears, then you haven't saved the script . . .

tawdry quest
#

didnt even see the spelling mistake, i thought its some error from the new input system, my bad

slender nymph
#

click one of them and show the stack trace

tawdry quest
ember imp
tawdry quest
#

no way ?

#

nearly as much as you need to save your stuff for it to change

ember imp
#

but this scares me, why is it yellow

cosmic dagger
#

you kinda have to save your changes when you update the code . . .

ember imp
#

when ever i close the clode

cosmic dagger
tawdry quest
#

but its bad

#

cuz with every save unity will recompile

#

so youre constantly recompiling while typing

ember imp
tawdry quest
ember imp
#

errors gone now

#

had to reload the game

#

it only took me 4 days to make the player be able to move xd

static bay
#

This is why we don't do hardcoded strings.

cosmic dagger
ember imp
cosmic dagger
# proper flax now ?

you can post all of your stuff. anyone in the chat can help and they'll need all the info. don't wait for anything . . .

proper flax
tawdry quest
cosmic dagger
#

yeah, Woly told me . . .

tawdry quest
# proper flax now ?

the thing is, just dont repost it like instantly, if noone is getting back to you after like 10 minutes (unless your message is still on screen) you can repost it

tawdry quest
#

and then i actually forgot them 💀 thats my bad

proper flax
#

soo whats the problem

cosmic dagger
tawdry quest
cosmic dagger
proper flax
deep goblet
verbal dome
# limber stone

Idk if you solved this already but calling GetButtonDown is not reliable in FixedUpdate. Do it in Update instead

#

GetButtonDown is true for one frame, and it's not guaranteed that FixedUpdate runs every frame

limber stone
#

i dont anderstand what to change

tawdry quest
#

you got told exactly what to change by osmal

buoyant knot
#

GetKeyDown etc is true for exactly one frame

#

FixedUpdate does not happen every frame.

#

If you use GetKeyDown in FixedUpdate, it will usually not work.

verbal dome
#

I mean move the if-statement that sets isJumping to true, into Update.

#

Update runs every frame

limber stone
#

i dont anderstand very well the coding language so instead of get button down i type what

#

ik what you mean but dk what to do to change that

tawdry quest
#

read

#

take GetKeyDown out of Update, put in FixedUpdate

verbal dome
limber stone
#

nah

verbal dome
#

It's a method just like FixedUpdate that you currently have

limber stone
#

ok

verbal dome
#

It's one of the 'Unity methods' that gets called automatically if it exists in your script

#

This is very basic stuff so I suggest taking some starter courses !learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

tawdry quest
# limber stone ok

🔴 Get bonus content by supporting Game Maker’s Toolkit - https://gamemakerstoolkit.com/support/ 🔴

Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then gi...

▶ Play video
#

or use unity learn from the link above

verbal dome
#

That's a decent beginner video, yeah.

limber stone
#

ok

tawdry quest
#

GMT is very good imo

buoyant knot
#

yeah, it’s a good start

limber stone
#

ty it work but now my walking speed is slow like it wwalk litle bit and stop and re strat ik were this come form but idk how to fix it

turbid robin
#

How can I repair this? (Ar android only project)

verbal dome
eternal falconBOT
tawdry quest
tawdry quest
#

but a screenshot of the tracelog would make it easier to help you

turbid robin
#

I don't have discord there

#

And I can't download it, it's a school PC only

turbid robin
tawdry quest
turbid robin
tawdry quest
#

youre making something, you need the java sdk, not the consumer thing

#

2 different things

turbid robin
#

Wait wait, android studio SDK?

tawdry quest
#

no

#

Java SDK

tawdry quest
#

not really, but better then nothing

turbid robin
tawdry quest
#

problem is that its compiled for the wrong version and cant be loaded

turbid robin
#

More recent, what do I need to do?

tulip turtle
#

does anyone have template for a runner game like subaws surfer ?

tawdry quest
#

but you can buy one one websites, im pretty sure

tulip turtle
#

where ?

tawdry quest
turbid robin
tawdry quest
# tulip turtle where ?

this is a game development discord and not a lazy ripoff discord, you wont find help here regarding that

#

you can tho, use google to find a place to buy that

#

or you could do it like other people here and learn coding, learn unity and make it yourself

tulip turtle
#

but i want to see how runner game is doing and in youtube tutorials are very bad

turbid robin
tawdry quest
#

you need to look better or you call them bad cuz you dont understand what they are doing

tawdry quest
#

and then look if the error still exists

#

we go from there

tulip turtle
#

but i don't want to copy paste every tutorials beause if one day my friends or any person say how i do it i can't say i copy paste it in youtube

tawdry quest
#

Then learn how to code / create games and make it yourself

#

C# tutorial for beginners: Get up & running with C# and code in just 1 hour! No prior knowledge needed.

⭐️Want to learn more from me? Check out these links:

Courses: https://codewithmosh.com
Twitter: https://twitter.com/moshhame...

▶ Play video

🔴 Get bonus content by supporting Game Maker’s Toolkit - https://gamemakerstoolkit.com/support/ 🔴

Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then gi...

▶ Play video
tulip turtle
#

Thanks, you are very useful

tawdry quest
#

you mean helpful, but thanks

limber stone
#

so can somone tell me how to fix the non walking problem pls

tawdry quest
#

That can avoid confusion or mistakes

tawdry quest
#

cuz youre mixing Vector3D and 2D

limber stone
#

2D

tawdry quest
#

then dont use Vector3D

#

use Vector2D

limber stone
#

its a tutorial i folowd

tawdry quest
#

the tutorial very surely didnt tell you to pump a Vector2D into a Vector3D

limber stone
#

not that one

#

i just typed what the gye sayd and he did say that

tulip turtle
tawdry quest
# limber stone i just typed what the gye sayd and he did say that

try this

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{ 
  public float moveSpeed;
    public float jumpForce;
  public bool isJumping = false;
  public Rigidbody2D rb;
  private Vector2 velocity=Vector2.zero;    

    void Update()
    {
        float horizontalMovement = Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime;
     if(Input.GetButtonDown("Jump"))
     {
            isJumping = true;
     }

     MovePlayer(horizontalMovement);
    }
 
     void MovePlayer(float _horizontalMovement)   
     {
     Vector2 targetVelocity = new Vector2(_horizontalMovement, rb.velocity.y);
     rb.velocity = Vector2.SmoothDamp(rb.velocity, targetVelocity, ref velocity, .05f);

     if(isJumping == true)
     {
      rb.AddForce(new Vector2(0f, jumpForce));
            isJumping = false;
     }

     }
 
}    
#

I replaced the wrongly used Vector3D with 2D

radiant sail
#

i cant figure out how to make this re-enable the rigidbodys gravity when the stair has been walked over...
can someone plz help

// Stair check
    RaycastHit objHit;
    Vector3 heightVex = new Vector3(0, playerHeight, 0);
    if (Physics.Raycast(lowerStair.transform.position, moveDirection, out objHit, 0.6f, whatIsGround))
    {

        float angle = Vector3.Angle(Vector3.up, objHit.normal);

        if (!Physics.Raycast(upperStair.transform.position, moveDirection, out objHit, 0.6f) && angle > 85)
        {
             rb.drag = 0f;
             rb.useGravity = false;
            rb.position -= new Vector3(0f, -stepSmooth * Time.deltaTime, 0f);


            // Push the player towards the movement direction smoothly
            float pushSpeed = 1f; // Adjust the speed as needed
            Vector3 targetPosition = rb.position + moveDirection * 0.5f;
            rb.position = Vector3.Lerp(rb.position, targetPosition, pushSpeed * Time.deltaTime);
        }
    }
tawdry quest
#

rb.useGravity = true;

#

😅

#

just do an else case with that

#

unless i missunderstand something

limber stone
radiant sail
#

it dosent work when i do that

tawdry quest
limber stone
#

wen i do its very clumbsy and not clean

#

like it go fast go slow go fast go slow

tawdry quest
#

can you activate the performance window or maybe im overlooking something (can someone else please look over it =))

#

in the game window there is a option to show the performance window with the fps

limber stone
#

its not fps bcs i have rly nice pc and jump is clean

tawdry quest
#

ah ok

limber stone
#

do you think i should use an other script

#

like take it

tawdry quest
#

are you following this tutorial ? If no, follow this one instead
https://www.youtube.com/watch?v=XtQMytORBmM

🔴 Get bonus content by supporting Game Maker’s Toolkit - https://gamemakerstoolkit.com/support/ 🔴

Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then gi...

▶ Play video
safe flicker
#

Hi , i'm starting to code on Unity with C# and i'm following a tutorial to start somewhere
i'm doing exactly everything the guy do but i don't have the same result x) here are some picture
for my movement or the blue square everything work fine but for the square i can't fill any value like Speed min max X and min max Z
Anyone know what's happening ?

rare basin
#

is your IDE configured?

#

also you need to fix compile errors

#

that's why it doesnt work

queen adder
#

i cant explain like what i want but, this walls are strange like when i jump and walk i can stay on the wall, anyone know how to stop that?

queen adder
eternal needle
#

Otherwise post code

safe flicker
#

that's the video script

rare basin
#

@safe flicker configure your IDE first

#

and fix compile errors

languid spire
rare basin
eternal needle
#

That would be a rigidbody yes

queen adder
#

but where i set friction to 0?

languid spire
queen adder
#

i am sorry for my questions i am still learning

rare basin
#

it's just because his IDE is not even configured

safe flicker
eternal needle
earnest atlas
#

Need help with tile rules. I dont get how to make them work.

I want top one only to be on right and never in other different positions.

Second one in middle, 3rd one on right only

safe flicker
#

work now

rare basin
#

@safe flicker

#

man

#

configure your IDE

#

you'd have spotted the error in 5 seconds instead of 15minutes

cosmic quail
eternal falconBOT
safe flicker
#

i don't know what a IDE is

earnest atlas
#

OMg not again

rare basin
#

then google it

earnest atlas
#

An IDE (Integrated Development Environment)

rare basin
#

and when you find out, configure your IDE

safe flicker
#

i'll do it

opal ridge
#

I'm wanting to make enemies spawn outside the screen. Do I need to make it spawn outside of the viewport or can I also just make it spawn a certain distance from the player which probably is outside of the viewport?

earnest atlas
#

Both

languid spire
#

@rare basin You know as well as I do, this is programming, a one character difference in a script of 1,000 lines can make the outcome totally different

rare basin
#

but yes i get it

opal ridge
# earnest atlas Both

I don't intend on making u do the work, but I have figured out the viewport, how do I make it spawn outside of this? Is it like ```cs
vector2(random.range(and somewhere here outside that viewport))

swift crag
earnest atlas
#

Get camera size and just use x and y bigger then camera size on random?

swift crag
#

then you can pick a random position that's less than the left edge or larger than the right edge

#

repeat this for the Y axis and you're good

opal ridge
swift crag
#
Vector2 result = Vector2.zero;
bool left = Random.value < 0.5f;

if (left)
  result.x = Random.Range(-0.3f, -0.1f);
else
  result.x = Random.Range(1.1f, 1.3f);
#

this would give a 50-50 chance of being on the left or the right

#

and pick a reasonable view-space position that's a little bit off the edge

opal ridge
swift crag
#

Right.

#

If you want to do pixel distance (screen-space) or physical distances (world-space), you'd just replace those constants in the Random.Range calls

#

so for screen space you might do Screen.width and Screen.width + 100f to spawn on the right side

#

for world space, you'd need to first compute where the right edge of the screen is

Vector3 rightPos = Camera.main.ViewportToWorldPoint(Vector3.right);

result.x = Random.Range(rightPos.x, rightPos.x + 5);

This would spawn something up to 5 meters off the right side of the screen.

simple cedar
#

hello everyone hope you are well, I am a beginner and I would like to have a script that allows me to get in and out of a vehicle and be able to drive with my vehicle and already on my scene and my character the same I can move with my character and move the camera but I can't make it go up and down, thank you for your help!

earnest atlas
#

lmao no

rare basin
#

and what do you have so far

#

describe your issue, no one will pull your tongue to tell us that

earnest atlas
#

I have a suspition he considers this chat as ChatGPT

cosmic quail
#

well they said "but I can't make it go up and down" so maybe hes done everything and the only problem is his camera cant go up and down? in which case u have to post ur script @simple cedar so we can help fix it

rare basin
#

okay so what does i cant make it go up and down even mean?

#

we dont need to speculate

#

we need facts

cosmic quail
#

allow me to speculate. the camera cant go up and down and it only moves sideways

#

😄

earnest atlas
#

He kinda got silent

polar acorn
simple cedar
rare basin
simple cedar
rare basin
#

what did unity remove?

#

entering and exiting vehicle?

#

Unity Standard Assets is not related to a enter/exit vehicle system you want to create

simple cedar
rare basin
#

then make your own system

#

to enter/exit vehicle

simple cedar
rare basin
#

it depends on what design do you want

#

do you want it to be raycast based

#

to enter vehicle

#

or trigger based when you are close to a vehicle

#

plenty of interactable things tutorials

simple cedar
rare basin
#

then do it

#

and when you face certain issue then ask

#

we won't make the code for you

earnest atlas
#

I have some weird tile? The one on left doesnt even exist in my rule set

simple cedar
rare basin
rare basin
earnest atlas
#

Where then to deal with Grid Rule tile

rare basin
#

watch some, pick one you like the most

rare basin
simple cedar
#

ok ok thanks you !

cunning rapids
#

My cursor is still visible ven though I set its lock state and visibility

earnest atlas
#

Its because its standart sprite for it bruh

cosmic quail
cunning rapids
#

Ugh screenshots don't show the cursor

#

But trust me it's there

cosmic quail
# cunning rapids

well the way i would debug this first is add a debug log in there to see if this code is even getting run

queen adder
cunning rapids
#

It has both camera functionality and movement combined

cosmic quail
cunning rapids
#
Debug.Log(Cursor.lockstate);
``` should work right?
frosty hound
#

Are you actually clicking into your game view?

cunning rapids
#

Meaning?

frosty hound
#

Click the game view?

cunning rapids
#

Yes?

#

Also holy shit my code is like 500 lines for wallrunning jumping and sliding

#

That can't be efficient

late bobcat
verbal dome
cosmic quail
cunning rapids
polar acorn
# cunning rapids

Log Cursor.visible in update. See if it's getting set back to true

cosmic quail
#

and if it is then ctrl+f and search for cursor.visible to see where you're setting it to true again

cunning rapids
cosmic quail
#

thats Cursor.lockState

cunning rapids
stiff stump
cosmic quail
# cunning rapids

so ur probably not clicking on ur game view then? like u gotta click it once when u start playing

cunning rapids
#

It had a few "False" statements and then suddenly a bunch of "True"

polar acorn
# cunning rapids

If it just keeps spamming false then the cursor is invisible and it's likely just an issue with your editor. Either you aren't focusing the game or you've got a stuck alt key or something

cosmic quail
polar acorn
cunning rapids
#

I honestly can't even remember where or what is everything because my code is so stupidly complex

#

half a thousand lines just for jumping, crouching/sliding and wallrunning

#

There is a surprisingly high lack of quality movement tutorials on rigidbody online

verbal dome
#

Movement code tends to be large

cunning rapids
#

500 lines for 3 basic functionalities?

#

It also handles camera controlling

cosmic quail
queen adder
cosmic quail
# queen adder how do i do that

Learn how to create AI pathfinding using the Unity NavMesh components!
This video is sponsored by Unity.
● Watch on Unity's website: https://goo.gl/jUsU8D

● Example project: https://github.com/Brackeys/NavMesh-Tutorial

♥ Support Brackeys on Patreon: http://patreon.com/brackeys/

·································································...

▶ Play video
polar acorn
queen adder
#

ty guys

earnest atlas
#

How to fix Grid Tilemap collider 2d being quite wrong?
Its way too far away from visible tiles. I can stand almost one extra tile futher then they end

cunning rapids
#

Can someone please link a good tutorial for fast-paced rigidbody movement?

#

Actually nevermind

#

I can try find a system I used in the past that worked well

#

It was buggy but I was able to fix it relatively quickly

#

And build on top of it

verbal dome
#

Its also good to mention what kinda game you are making when asking for a tutorial

cunning rapids
#

Fast-Paced FPS

#

I've been going back and forth on games

#

Once I wanted to make a 2D game and another 3rd person story-driven one

#

I just looped back to FPS

#

Might as well finish it

verbal dome
#

Transitions are one-way

#

Also your IsEquip trigger is true so it will keep going to that state

earnest atlas
#

I tried using unity Imput system. I created it in 2 places one is DontDeleteOnLoad gameobject other is Player that is on the scene.

One is interfiering with another. Should I only create it once in the dontdeleteOnload object and access it in the player?

swift crag
#

you created what?

#

two PlayerInput components?

earnest atlas
#

private PlayerControls _playerControls;

swift crag
#

and what is PlayerControls?

earnest atlas
#

Unity Input sistem

swift crag
#

PlayerControls is not the "unity input system"

#

so you checked the "Generate C# Class" option?

earnest atlas
#

It was working before I incialized anothe instance of them in different class

green copper
#

Is Gradle something I need to manually install to build a project for android?

delicate zinc
#

i think i shouldnt be capturing when there is a hotcontrol

earnest atlas
verbal dome
swift crag
earnest atlas
#

Im using this

delicate zinc
#

should i switch to the new input system

swift crag
#

But did you go and check the box here to generate a class from your input action asset?

delicate zinc
#

im used to the old one and im not bothered to learn the new one but is there anything better abt it

earnest atlas
#

If it was working before it means I have setup it correctly

swift crag
#

This is a simple yes or no question.

#

Yes or no.

earnest atlas
#

Well old one detects one action/frame new one can take in multiple

#

Arent you reading what I write?

swift crag
#

Yes. I am. You haven't answered my question.

earnest atlas
#

IT WAS WORKING BEFORE MEANS YES I DID

#

Its still working but in borked manner

swift crag
#

there are lots of ways to receive input.

#

I'm not asking you if your code used to work. I'm asking you which way you're getting input.

green copper
#

I need help deciphering this error message, it occurs whenever I try to build my project for android

swift crag
# earnest atlas

given that your asset is named PlayerControls, I'm guessing you did, indeed, use the "Generate C# Class" option

earnest atlas
#
void OnEnable()
{
    _controls.Enable();
    _controls.PlayerControl.Movement.performed += OnMovementPerformed;
    _controls.PlayerControl.Movement.canceled += OnMovementCancelled;
}

void OnDisable()
{
    _controls.PlayerControl.Movement.performed -= OnMovementPerformed;
    _controls.PlayerControl.Movement.canceled -= OnMovementCancelled;
    _controls.Disable();
}

private void OnMovementPerformed(InputAction.CallbackContext context)
{
    _moveVector = context.ReadValue<Vector2>(); // Deals with movements

}

private void OnMovementCancelled(InputAction.CallbackContext context)
{
    _moveVector = Vector2.zero; // cancels movement
}```
earnest atlas
swift crag
#

and this code looks exactly like what you'd get if you checked the "Generate C# Class" option, yes

tame ferry
#

Is there are way to stor A* from cluttering the console?

earnest atlas
#

As I said before it was working okey before. I made another instance of it in different object and it got borked

late bobcat
swift crag
#

I asked how you got input, not whether it worked

swift crag
#

You can get input in many different ways.

#

A generated C# class is just one of them

late bobcat
swift crag
#

it should have options for that somewhere

earnest atlas
#
 private PlayerControls _controls;

 void Awake()
 {
     _rb = gameObject.GetComponent<Rigidbody2D>();
     _controls = new PlayerControls();
 }```

Its only way is C# generated script
swift crag
earnest atlas
#

ITS THE ONLY OPTION

swift crag
#

I do not understand what that means. There are many ways to get input, like InputActionReference and the PlayerInput component. That's why I needed to be sure which one you were really using.

#

anyway, coming back to the original problem...

late bobcat
#

@verbal dome any idea on what i should put to exit a trigger? (to go from player_equip to idle) let's say

#

like on the exit transition what should i put? As far as i know triggers should reset after the animation is called, no?

polar acorn
swift crag
#

I think you're seeing "interference" because the first PlayerControls is grabbing the devices, so the second one can't find any more devices to bind to. I don't use the generated C# class in my own game, so I can't be completely sure about that.

Keeping a single instance on a DontDestroyOnLoad-ed object sounds fine. You can just make it a singleton that the player component looks for.

#

I mostly use InputActionReference to reference specific input actions

earnest atlas
#

Gonna look that up. Now me sleep

#

Iq = 0/0

verbal dome
#

So it automatically exits via the transition when player_equip finishes

#

And yes triggers are just booleans that go false automatically when a transition uses it

queen adder
#

I have a script that create a maze randomly, and i add a enemy but my enemy instead of go around the walls he face it, and try go trough it, i already have seen some videos, with Nav mesh, but it doenst work, idk if it is because of the maze is generated randomly or i am doing something wrong.

wintry quarry
#

You can also use A* for this

verbal dome
#

Did you look at the NavMesh after it's generated?

queen adder
#

i dont understand much of unity so have i high chance of me doing something wrong

verbal dome
#

What steps are you doing to generate the navmesh?

queen adder
verbal dome
#

If you are generating the maze at runtime, you need to generate the NavMesh after that too

queen adder
#

i dont know how to that

languid spire
#

NavMeshSurface.Bake();

verbal dome
#

Or .BuildNavMesh() unless it was changed in newer versions

queen adder
#

i am gonna try ty

simple cedar
#

hello i have littel problem 😅
can someone help me I tried to hack to make it stop but it won't work

stuck palm
#

can i force a button state in code?

wintry quarry
stuck palm
#

and like force it back into the normal state

wintry quarry
strange peak
#

hi, im making a room spawn system that spawns a series of rooms in a random order, the way i have it done is for each room theres an empty game object (or more) called room connectors. these spawn other rooms at their position and rotation. the problem is that some rooms have room connectors on all sides, and sometimes (most of the times) some rooms end up clipping through eachother. heres a pic and the code. if theres a way to do it without a grid system then that would be amazing

    public List<Transform> roomConncections;
    public List<GameObject> rooms;
    public List<int> weights;

    void Start()
    {
        int sumOfAllWeights = getSum();
        if(roomController.rooms>0)
        {
            foreach(Transform roomConnLoc in roomConncections)
            {
                int roomRand = Random.Range(1,sumOfAllWeights);
                int i = 0;
                bool spawned = false;
                while(!spawned)
                {
                    if(roomRand<weights[i])
                    {
                        spawned = true;
                        Instantiate(rooms[i], roomConnLoc.position, roomConnLoc.rotation);
                        roomController.rooms-=1;
                    }
                    roomRand -= weights[i];
                    i++;
                }
            } 
        }
    }
    int getSum()
    {
        int s = 0;
        foreach(int weight in weights)
        {
            s+=weight;
        }
        return s;
    }```
wintry quarry
#

sounds like the button you press is going into the selected state

wintry quarry
#

You can also change this

#

to do Normal instead

#

but that would break keyboard selection

stuck palm
wintry quarry
#

Ok both of those options will break controller navigation actually

#

maybe add an Event Trigger to it and set up a listener for PointerClick that deselects it.

long ginkgo
#

I have a problem with my code :( my wheel position isn't correct when i load the game. Here is the Scene vs Game while running

Here is my code for updating the wheels:

    void UpdateWheel(WheelCollider col, Transform trans) {
        // Get wheel collider state
        Vector3 position;
        Quaternion rotation;
        col.GetWorldPose(out position, out rotation);

        // Set wheel transform
        trans.position = position;
        trans.rotation = rotation;
    }

and it gets called from:

        UpdateWheel(frontLeft, frontLeftTransform);
stuck palm
wintry quarry
lusty socket
#

!code

eternal falconBOT
stuck palm
wintry quarry
#

try in OnPointerUp?

lusty socket
#

hey just looking for some help with a line renderer in 3d, i usually work 2d but have been trying to make a drag and shoot basketball game and using a line renderer to display the force and direction the ball is being shot in, with code attached to the empty object with the line renderer, although in game it does not pull back as intended it just appears on screen. Could someone tell me if my code is completely off tracks or if im just missing something simple in 3d. Thanks :))))

wintry quarry
#

You sure cam.nearClipPlane is right?

#

You probably want to use Plane.Raycast and Camera.ScreenPointToRay in 3D

#

not Camera.ScreenToWorldPoint

stuck palm
strange peak
#

does physics.overlapbox return null when nothing is overlapping

wintry quarry
#

No. It returns a bool

#

check the docs

#

Actually sorry it returns an array

#

again, check the docs

strange peak
#

then why does this give an error if(roomRand<weights[i] && Physics.OverlapBox(new Vector3(0,0,0), roomDimensions[i]))

#

yea array

wintry quarry
#

because it returns an array

strange peak
#

yep\

lusty socket
wintry quarry
strange peak
#

ok

strange peak
#

ty

lusty socket
pastel barn
#

(ingor my friend i was playing with)

languid spire
wintry quarry
pastel barn
#

also its not that deep

languid spire
pastel barn
#

i dont care

long ginkgo
languid spire
pastel barn
#

its not that serious its just a discord channel man

languid spire
#

but we have rules to stop chaos being caused by people like you

pastel barn
#

i just dont care enough man

languid spire
#

you might not but the <@&502884371011731486> will

pastel barn
#

yeah i just dont care

#

i just accidentally somthing in the wrong chat on accident

languid spire
#

yes, and having been told where you should have posted you decided to behave like an ass

pastel barn
#

ok i still just dont care

tulip stag
#

Hey, so I'm getting a Null Reference Exception but when I go to the part of the code that's in the error message I can't find any of the usual culprits of a null reference. The code looks fine to me. It also compiles & runs & behaves exactly how I'd expect it to— except for the debug screaming null reference exception

#
            {
                bool isInRange = Vector3.Distance(transform.position, target.position) < weaponRange;

                if (target != null && !isInRange)
                {
                    mover.MoveTo(target.position);
                }

                else
                {
                    mover.StopMovement();
                }
            }```

Line 28 would be `bool isInRange = Vector3.Distance(transform.position, target.position) < weaponRange;`
short hazel
#

target was null

#

You check for that, but 2 lines after, too late

tulip stag
#

ohhhh

lusty socket
wintry quarry
#

I already shared my suggestions for calculating the correct world positions to use with it

honest haven
#
    {
        for (int i = 0; i <= 99; i++)
        {
            var shooter = Instantiate(projectile, transform.position, transform.rotation);
            
            shooter.transform.parent = spermFolder.transform;
            shooter.gameObject.SetActive(false);
            sperm.Add(shooter);
        }
    }``` i have this function that Instantiates a projectile to fire. i set it a max of 99. but i want it to shoot more. rather then giving it a higher value is there a smater way. could i detect it fires 3 and Instantiate another 3. feel like im hard coding it
polar acorn
#

That way the pool is by definition always the smallest it has to be to cover the worst-case scenario

honest haven
#

ok thanks never hear about pooling

fickle plume
#

!warn 966393302389784607 You were directed to the correct channel. Use appropriate channels and don't spam.

eternal falconBOT
#

dynoSuccess quackkerssss has been warned.

strange peak
honest haven
stuck palm
honest haven
#

lol you dont want to know. I can show if you want its a mini game very simular to an atari adult game called beat em and eat em

raven kindle
#

Does anyone know how to remove these black dotted lines? My player keeps getting stuck on them, though it gets stuck for around 0.2 sec then falls through like its not there. They seem to flicker on and off while the player is running. They arent part of the platform itself.

stuck palm
raven kindle
honest haven
#
    {
        if (queueSprem.Count > 0)
        {
            projectile = queueSprem.Dequeue();
            projectile.transform.position = new Vector3(transform.position.x, transform.position.y -1.3f, transform.position.z);
            var spremshoot = projectile.GetComponent<CumCansProjectile>();
            spremshoot.Move();
          
        }
        else
        {
            projectile = Instantiate(projectile, transform.position, transform.rotation);
            projectile.transform.position = new Vector3(transform.position.x, transform.position.y -1.3f, transform.position.z);
            var spremshoot = projectile.GetComponent<CumCansProjectile>();
            spremshoot.Move();
 
        }

        yield return new WaitForSeconds(0.5f);

        runTimer = false;

        ChangeDirection();
    }
``` so trying the pooling way. fires the first one then says the object is destroyed.
wintry quarry
#

why are you doing this

#

now the next time you call Instantiate you will be copying the clone in the scene instead of the prefab itself

#

var clonedProjectile = Instantiate(projectile, transform.position, transform.rotation);

honest haven
#

ah yes what a plonker

#

thanks PraetorBlue

simple cedar
#

Why when I use gravity on my rigid body, my vehicle flies away, if someone can help me please ??

cunning rapids
#

Guys my cursor is not locked and is visible on a new project even though I used a script that deals with that already

#

I know for a fact it can't be anything wrong with the script

#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerLook : MonoBehaviour
{
    [SerializeField] private float sensX = 100f;
    [SerializeField] private float sensY = 100f;

    [SerializeField] Transform cam = null;
    [SerializeField] Transform orientation = null;

    float mouseX;
    float mouseY;

    float multiplier = 0.01f;

    float xRotation;
    float yRotation;

    private void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    private void Update()
    {
        mouseX = Input.GetAxisRaw("Mouse X");
        mouseY = Input.GetAxisRaw("Mouse Y");
         
        yRotation += mouseX * sensX * multiplier;
        xRotation -= mouseY * sensY * multiplier;

        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        cam.transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
        orientation.transform.rotation = Quaternion.Euler(0, yRotation, 0);
    }
}
green copper
#

This code for detecting the beginning and end of touches will only detect the first endTouch of an instance of running the app, and no subsequent ones

#

While the game is running, isCurrentlyTouching will correctly toggle on and off the first time but just stays permanently on after that point

limpid wren
#

Hm, if I have two objects with collider2D's on them that are both set to "IsTrigger", can I make those two collide? They don't appear to be driggering "OnTriggerEnter" when they touch. I'm getting some mixed information online.

Would it be a bad idea to try to do this?

languid spire
limpid wren
languid spire
limpid wren
#

So "Body type" Kinematic?

languid spire
#

yes

limpid wren
#

Cool, I'll give that a shot thanks

polar acorn
swift crag
#

regardless of the cursor lock settings in the game

cunning rapids
#

I restarted the editor

swift crag
#

clicking in the game view will re-lock the cursor if needed

cunning rapids
#

I don't think I pressed esc

#

Because when I clicked on the game view again it didn't lock the cursor back

cunning rapids
#

Btw does anyone know any cool comic-book style shader for URP?

#

Most are for SRP

#

I can't just change all my assets back

swift crag
#

URP is a scriptable render pipeline

#

that's what SRP stands for

#

or do you mean the built-in render pipeline?

hexed terrace
#

BiRP is also known as Standard Render Pipeline

hexed terrace
green copper
#

touchCount is current 0, but the function touchEnded is still not executing, even when all other checks have been removed.

#

the function will run once per frame the first time but once touchCount rises above 0 the first time it will never fall again

swift crag
honest haven
#

Got a strange one. i have the enemy player that moves left and right and speeds up based on score. around the screen i have box coliders. but as soon as my score reaches over 80 he seems to push either right or left of screen and goes beyond the box colliders https://gdl.space/mudobamico.cs

woeful lagoon
#

Im having some problems with multiplayer and netyworking

woeful lagoon
woeful lagoon
woeful lagoon
#

or transform.position

honest haven
#

rb

woeful lagoon
#

have you checked the constraints on the sode bpxes?

honest haven
#

Vector3 temp = myTransform.position + directionVector * speed * Time.fixedDeltaTime;

    myRigidbody.MovePosition(temp);
scarlet skiff
woeful lagoon
polar acorn
#

Nothing in the code plays that state directly and you have no transitions

honest haven
#

yh thats why i switched to continuouos speculative

#

but still pass through

#

just incase it was a speed issue

#

but its only one object moving not multi

polar acorn
#

If you teleport all the way past something you never collided with it

#

Either check your distance manually with a raycast before calling MovePosition or move the object via velocity

honest haven
#

is there a reason it detects it at smaller speeds i see it hit the collider

polar acorn
jovial sandal
#

hey guys i made a cube with legs and rigged it with blender does some1 know how i can make it move what dani has so i walk without animations and still ragdols

honest haven
fickle plume
green copper
#

The TouchEnded function will not run, verified using the inspector that TouchCount did reach zero and isCurrentlyTouching was true

swift crag
#

you set isCurrentlyTouching to false at the top of the Update method

green copper
#

Right, meant to remove that. The issue remains though, except now TouchEnded will run exactly once and never again

#

that line setting isCurrentlyTouching to false was part of my attempted debugging

swift crag
#

Should work fine after that fix. isCurrentlytTouching will be reset to false after calling touchEnd

#

it'll become true again the next time Input.touchCount > 0 is true

green copper
#

Current script, console log after two touch events, and inspector after same two touch events

#

TouchCount went from zero, to one, then back to zero, but touchEnded never ran a second time and isCurrentlyTouching stayed enabled

swift crag
#

does selectedItemGrid become null?

#

if you don't think it is, prove that it doesn't by logging its value

#

I see no other reason (other than an exception being thrown) for touchEnded() to not execute

green copper
#

THAT'S IT

#

when the touch is let go, the pointer is no longer on the grid and the selected grid becomes null!

#

I was trying to transition from mouse control to touch and didn't realize!

swift crag
#

that'll do it (:

green copper
green copper
#

I have no idea how to solve it but it's not a magic ghost problem anymore

swift crag
#

Always verify that the code is actually running! Logging or attaching a debugger can help with that

green copper
#

the script that handles selectedItemGrid is attached to a different object so it never even occurred to me

#

thank you again

green copper
pastel barn
pastel barn
#

Where’s the spam?

fickle plume
#

!mute 966393302389784607 1d ignoring warnings

eternal falconBOT
#

dynoSuccess quackkerssss was muted.

summer stump
fathom bramble
#

I don't know if this question belongs in ⁠animation because it's not specifically about how to do it, it's more conceptual so if it does belong there, I apologize.

But can someone explain how animation works within a game loop?

So for example, let's say you have a simple scene with a cube in it. Right now every time a script's update() is called, I update the cubes position to make it move. That makes sense to me.

But let's say I've got a humanoid that has a run animation. I know the humanoid model gets rigged and whatnot but how does that conceptually work in the code? Would the update method just call the animation once? If so, how does it keep getting rendered each frame? Unless it calls it more than once?

buoyant knot
#

My man can’t even behave in front of a mod. Even children know to wait for when their parents are gone. smh

#

Which is not to condone, but to highlight the lack of self control.

buoyant knot
#

Imagine Animator has Update(Time.deltaTime) called in Update loop.

#

this advances the animation, if it is playing.

#

Also, i thought animator was really only for 2D sprites?

fickle plume
buoyant knot
#

that page describes when shit happens. It is an extremely useful page

#

I would not write Move this way

short hazel
#

Inside. It's not really about optimization, but more to not clutter the class with members that are not used anywhere else

buoyant knot
#

I would write Move as a function of the movement vector

#

Move should not be a function of input action callback context

#

The most efficient code is written in assembly

static bay
short hazel
#

Since the variables here are all value types (structs), then it spares a call to "load the memory address of this class instance" to retrieve the variable values. So, prefer local variables

buoyant knot
#

Because it’s bad architecture/design. With respect to single responsibility principle, Move should solely be tasked with Moving by the amount, not both parsing controller input AND moving

#

also you don’t want to store more variables/fields in your class. it is actively bad

#

the fewer fields your class has, the better off it will usually be. within reason

short hazel
#

It's insignificant. A few nanoseconds at worst

buoyant knot
#

why are you concerned with optimization if you struggle with basic code architecture?

#

you are putting lipstick on a pig

#

focus on architecture/design before you even bother with optimization.

eternal needle
#

It being insignificant does matter. It makes literally 0 difference, any concerns otherwise are just ignoring how to keep your code clean.

#

Run the profiler if you truly need to see what's worse

#

You've spent more time thinking about the difference than the difference would be if it was run 1 million times

buoyant knot
#

then you should speak as though you understand, and not like you still want to optimize your code at the cost of your sanity. Because that is the vibe I’m getting

static bay
#

revisionist history going on

short hazel
#

Gone, reduced to atoms

static bay
#

Hey so I want to know if this is reasonable or insane overengineering. I've noticed that a lot of what I'm doing boils down to collecting some group of objects, filtering them, and then doing something with them. I wanted to try making a system where I could dynamically define how a series of objects were captured, and the filtering that would be applied to them, all in the inspector.

#

TriggerUnityEvents exposes some UnityEvents to hook into when something enters/exits the trigger. It has a filter which will make sure only gameobjects with specific conditions pass. In this case, a specific tag.
This uuuuh, too much?

short hazel
#

(moderators can still see edits made to this channel though, so your deletions were logged)

#

Then why delete your conversation? Doesn't make much sense

clear seal
#

quick question, would it be ok if i plcace the wait for second before the if? or inside at the beginning in the if

rich adder
clear seal
rich adder
#

you are starting a new coroutine everyframe too btw

rich adder
short hazel
polar acorn
# clear seal

Your wait does nothing and you're shooting every frame

buoyant knot
clear seal
#

but then how do i do so

clear seal
eternal needle