#šŸ’»ā”ƒcode-beginner

1 messages Ā· Page 283 of 1

river pecan
#

I thought it was it's own little thing

wintry quarry
#

It is its own little math function

#

In this case we're using it to move the velocity vector towards a new value slowly

lusty sage
#

alright thanks for the help ill check that out! you the goatšŸ™

upbeat root
#

*sorry, typos

Can i export and send someone my unity project assets for help?

i made my final project to complicated for my skill and doing way more than i needed too and needed to get a 30 day extension and i am almost out of time and i desperately need help

wintry quarry
#

Nobody's gonna do that, but you could ask isolated questions with details.

upbeat root
#

Well,
I cant get the durability text, game over text, spawn points, or mystery crate effects to work

eternal needle
upbeat root
#

To be fair, i think i followed all those "DO" steps

river pecan
#

This still has different results at different framerates

wintry quarry
river pecan
#

I see

wintry quarry
#

this is why physics uses a fixed framerate

#

otherwise aceleration always makes things different at different framerates

#

You can get linear motion to work fine with a variable framerate, but not acceleration or any other second-order effects

eternal needle
river pecan
wintry quarry
#

there's always exceptions

#

you could also implement your own fixed-rate tick system if you want, but FixedUpdate is convenient

upbeat root
eternal needle
# upbeat root

yes so where is the code, the description of the problem with context, any error messages, steps you've taken, and a full paragraph with the info ready?

#

you've said "this doesnt work" and showed a screenshot of the editor

wintry quarry
# river pecan I see, I got it in my head from a few forum posts that only rigidbody event shou...

really it's "Physics simulation code needs to go in Fixed", which usually means Rigidbody stuff. But you're essentially implementing your own physics here. So you should also do it there. Of course if you move all your movement etc to FixedUpdate you're going to have to deal with visual stuttering and you then either have to manually implement interpolation or just switch to using Rigidbodies anyway

#

So if physical consistency is important for your game... I recommend using a Rigidbody

river pecan
wintry quarry
#

You can change the fixed timestep yes

river pecan
wintry quarry
#

inefficient? no.

#

multiplication is very cheap

river pecan
#

Is it not good practice?

wintry quarry
upbeat root
# upbeat root
  1. Done
  2. Done
  3. Done ig
  4. Not done admittedly
    • Use post sites: N/A
    •N/A
    •I have youtubed, googled, and chat gbt'd
    •Ive given a list of what i need to make work, but im really not sure where to start or how without just sharing my current coade and assets
#

Remind me, this is code-"beginner" channel right?
Im at the end of an 8 week game design course, so ya, pretty new here
Please be patient with me

eternal needle
upbeat root
#

I found this discord because i am at if not past the limits of my ability and understanding

summer stump
wintry quarry
#

Mechanics need to take a look at the engine if you want them to fix it.

north kiln
#

And nobody is going to download your project to help you, because that is the kind of behaviour you should be paying for

river pecan
wintry quarry
#

Not "better". It's different.

#

they each have their uses.

river pecan
#

What is a situation where it'd be better to use a character controller?

upbeat root
teal viper
river pecan
#

Character controllers can't move rigidbodies too iirc

wintry quarry
summer stump
upbeat root
#

Alright, so
When the game opens, it shows the title and 6 difficulties to choose from, that works, great

Ideally, when selecting a difficulty, i want to be able to have the player and one or more enemies spawn in set locations depending on the difficulty. I also want the rate of certain objects spawning from the sky to increase at higher difficulties, but havemt started that yet.

What happens currently, is 1 enemy and 1 player spawn, in the wrong spots, regardless of difficulty, and now can't move from their spawned spot, and the enemy ai just sits there doing nothing, when prior i had the controls working just fine and enemy moving just fine. I'm guessing they are getting stuck on the spawning onlbhects somehow? But even if i code the spawning objects to destroy themselves after the game starts and they do their job, the player and enemy still can't move.

The next issue is that i had it working at one point, but now, the ui that is supposed to show and change with the player's Durability (health) doesnt display anything. Same thing goes with the game over text, that i had triggering and showing different text depending on of player or enemy(s) got destroyed, but now that doesnt work, and I just dont inow how to fix this.

The last big issue is i have tried every logical method i can think of. But can't get the mystery crates to work. Ideally, if the player destroyes one, one of 3 random effects is supposed to trigger, but nothing happens when they are destroyed

eternal needle
# river pecan Character controllers can't move rigidbodies too iirc

if you need this behaviour, you can always do stuff like addForce but i'd be careful doing this because you really can get really wonky cases. Its nice if you are able to keep every entity using the same movement system, character controller, a custom kcc (kinematic character controller), or rigidbody. When you start mixing them up, you need extra logic to handle other cases.

river pecan
#

Or like a sphere on the body

upbeat root
river pecan
teal viper
eternal needle
teal viper
carmine sierra
#

im watching a tutorial and this guy puts _ before every variable

#

why is that?

teal viper
carmine sierra
#

can i remove it and nothing changes

#

obvious question mb

eternal needle
carmine sierra
#

but whats the exact point of using an underscore?

#

just to pinpoint variables easier when reading?

eternal needle
#

its convention some people use to indicate a variable is private

#

i personally dont use it

teal viper
carmine sierra
#

so if you use [serializefield] its still considered private?

teal viper
#

No

#

As you said, it's for readability purposes only

#

It doesn't change anything functionally. Aside from maybe a discard

timber tide
#

underscore usually denotes some sort of private variable backed by some property field

#

it kinda helps, but im lazy with them too

teal viper
#

I've seen it being used for method arguments/parameters too. It depends

timber tide
#

because sometimes you shouldnt be accessing the private variable outside of the property field as the property may have some extra logic it needs to do

#

updating UI, ect

ionic zephyr
#

how can I activate a child gameobject from an script attached to the father object?

timber tide
#

GetComponentInChildren or assign that reference

teal viper
upbeat root
upbeat root
summer stump
#

It would be a fairly time consuming task, and require explanation anyways

#

Plus I don't download stuff from strangers generally. On servers

teal viper
wild dagger
#

Hi guys, I'm trying to create a pause menu. The game is pausing but the actual image of the pause menu won't appear? It might be something to do with the camera rendering the player map but not the pause menu but im not sure what exactly to check

grizzled zealot
#

How do I debug this problem: when I click on a gameobject during play, the unity editor consistently crashes. I'm using 2023.3.0b8.

eternal needle
wild dagger
#

This is how it is before pressing play

teal viper
wild dagger
#

game is paused, when I pause the scene I can see it but not when I press play

#

which is annoying

summer stump
#

this i'm on my phone 90% of the time I'm on here

Dang. The "this" emoji was for dlich. Slow phone messaging making a good example haha

upbeat root
wild dagger
#

Yeah I just noticed, look at the view of the "maincamera"

#

it doesn't even see the pausemenu

teal viper
summer stump
upbeat root
wild dagger
#

how it looks in game when play is pressed, haven't pressed pause yet

#

after pressing pause it does the same

teal viper
wild dagger
#

deactivated my tilemaps object and that is the camera view

carmine sierra
#

this might be alot to ask but is their anyone i could dm with help on making an appropriate grid lock for my game. I learned the basics but I need to alter the grid to this item. thanks

upbeat root
#

For some added perspective, this may be one of those old dog new tricks issues here,
I am 28 years old and just starting to persue learning something I have wanted to do since i was 8 or younger lol
But i spent my life being gaslit into game development being a waste of my time and stuck in survival mode instead of living and doing what i enjoy
End Segway *

teal viper
# wild dagger

Hmm... Do you have some black full screen image? Or is it black because of camera settings?

wild dagger
#

camera settings

slender nymph
#

do you have your pause menu on a separate canvas? because from your previous screenshot, i see it is not on the screen space overlay canvas

teal viper
wild dagger
#

Yeah it is, I don't even have the tilemap in a canvas it's just within the grid

slender nymph
#

show the settings for the canvas that contains your pause menu

wild dagger
#

ok

wild dagger
slender nymph
# wild dagger

in this image, you see that white box whose corner is in the center of your camera's view and extends up and to the right? that is the bounds of your canvas. you need to put your menu stuff within those bounds

also check the documentation in #šŸ“²ā”ƒui-ux to learn how to use unity's UI stuff

upbeat root
#

I digress, did the more thurough explanations of my issues help explain my problem, or the screenshots?

dire tartan
#

i need someone to point me in the right direction here i have two buttons i want each one to when clicked spawn a different player prefab heres my code for the room manager im using https://hatebin.com/hzcgnjhtnv

wild dagger
teal viper
teal viper
slender nymph
wild dagger
wild dagger
#

I've moved it within the canvas bounds

slender nymph
wild dagger
#

bigass canvas

#

aight

slender nymph
#

yes, this is how screen space overlay canvases work

#

which you would know if you'd bother reading the documentation

wild dagger
rich adder
#

sounds like you should probably learn more about unity before doing networking though

dire tartan
#

it wasnt the networking that was the issue it was the button system

#

i should of been more clear

slender nymph
dire tartan
#

was trying to make a function that makes it so i can change each buttons skin value

#

but ive got it working now

wooden vine
#

Hi, as you can see on the bottom left, there is a picture of ironman. But, when I make the screen a bigger size, the position of the canvas changes and I don't want it to. My canvas was always scale with screen size. But it is the position of the images that are changing. Is there any way to fix this?

slender nymph
rich adder
#

^^this. Anchoring is very important

slender nymph
#

also consider setting your game view to a specific aspect ratio instead of Free Aspect so you can see how it actually behaves on the target resolution

wooden vine
#

Ok

slender nymph
#

look above the start game button in that screenshot

wooden vine
#

oh

#

thanks

rich adder
# wooden vine thanks

might wanna fix your reference resolution, doubt anyone has a 4:3 monitor now days lol

wooden vine
#

Oh thanks

tawny hedge
#

am i using the transform.position = currentCheckpointT.transform.position; in a correct sense according to my code?
its attached to the player, when the player reaches -10 on the 'y' axis or presses the reset button (r), the position should change to the current checkpoints transform position

wild dagger
#

Imma probably have to come up with something else if I wanna do this

slender nymph
#

i mean, you scaled your UI objects down from what they would have been when you added them to the canvas initially. just add them again manually. and keep in mind this only applies to the UI because it is in screenspace not world space like your tilemap and stuff

wild dagger
#

Yeah it's just that having to scale also the tilemaps would be a pain and I have to reassign all of the objects if I re-add the UI elements

slender nymph
#

you shouldn't be scaling your tilemaps for this at all

#

your tilemaps do not belong on the canvas and are in world space with your camera

tawny hedge
#

merged them into one script

#

attached to the same player

forest galleon
#

how do I add flips to my vr game? I want them to be like the Blade & Sorcery mod, but I'm not good at coding so if somebody could help i'd appreciate it sm

paper snow
#

i want my gun to stay rotated constaly and not once how do i fix it void OnCollisionEnter(Collision collision)
{
print(gameObject.name);
if(collision.collider.tag == "wall")
{
Gun.transform.Rotate(90f, 0, 0);
}
}

summer stump
flint heath
#

I've got a bit of a tricky issue here. I have this line of code that makes my character always point towards the mouse cursor:
player.transform.rotation = Quaternion.Euler(playerBody.transform.position.x, playerBody.transform.position.y, angle);
and I am trying to make it so that on click you swing your tool, so I tried to do something like this:

if (Input.GetMouseButtonDown(0)){
    player.transform.rotation = Quaternion.Euler(playerBody.transform.position.x, playerBody.transform.position.y, swingAngle);
}

and obviously, since they are both in the update function, the rotation of the second function works but immediately goes there for one frame and then goes back to the mouse cursor the next frame. Is there some way I could have it offset the angle by some amount over time to make it swing?

#

I could make it lerp to it and then back maybe, but I'm just not sure how to set that up.

slender nymph
#

you're overwriting the rotation. you need to stop assigning the rotation using that first line for the duration of the swing rotation

flint heath
#

hm. so instead should I have the line that have it points toward the mouse cursor afterwards and have something inside that modifies the angle for some time when i swing instead?

slender nymph
#

also the way you have it set up now, it will only ever rotate for the swing for a single frame

flint heath
#

i figured

slender nymph
#

so what you could do is instead of just rotating it immediately right there in the if statement, instead start a coroutine that will slerp its rotation over some desired period of time and while that coroutine is running prevent the mouse position from affecting the rotation

flint heath
queen adder
#

Hey i may have a problem in coding something is there anyone willing to help?

teal viper
#

Don't ask to ask. That's a recipe for never getting an answer.

queen adder
rich adder
# queen adder I don't quite get what your saying

The solution is not to ask to ask, but just to ask. Someone who is idling on the channel and only every now and then glances what's going on is unlikely to answer to your "asking to ask" question, but your actual problem description may pique their interest and get them to answer.

teal viper
queen adder
#

thx

#

the problem that i have an inventory in my game and it seems that if i get to the second Item in the inventory it Disables It's code i don't why it just does it with the everyitem under the first one

teal viper
queen adder
#

Alot

#

but none of them are really helpful

teal viper
#

Well, then you'll need to fix them.

teal viper
queen adder
slender nymph
#

look at the very first error in the console and you'll likely find the root cause

teal viper
#

Also, there's a chance you're confusing the cause with the effect.

queen adder
slender nymph
#

show the errors, starting with the first

queen adder
#

but the weird one is the second

#

it states "UnityEngine.GameObject:SetActive(GameObject, Boolean)"

slender nymph
#

a component being disabled will not cause a NRE

#

what will do so is calling SetActive on a GameObject variable that is null

#

so show the errors and the !code

eternal falconBOT
queen adder
#

https://hatebin.com/gcecgecvkl first this is the gun code and this is the error NullReferenceException: Object reference not set to an instance of an object
Booty1Shooty.Awake () (at Assets/Scripts/BootyShooty - Copy.cs:64)

slender nymph
#

your GameObject.Find call is failing causing the NullReferenceException

queen adder
#

So how do i fix it?

slender nymph
#

avoid any of the Find methods when possible and use a better way to get a reference to the desired object

queen adder
slender nymph
#

and the problem with that is that the object it is trying to find does not exist

#

there are plenty of ways to get a reference to an object, GameObject.Find is objectively the worst

queen adder
#

i can't keep setting the inspector for everybit

teal viper
#

It doesn't need to be "with you". You can pass the references around via code.

slender nymph
rich adder
#

yea GameObject.Find is very britle

mental flower
#

Yea but... isnt that the whole point of this server? To help others in need whether their a newbie or the most experienced user of Unity? Like, I get there is a whole website, but seriously, not everyone has the time to sit there on a website for hours on end trying to figure out one singular issue when it could be easily solved by others helping. Also, isnt it a cardinal rule of a community to help others in need? We reached out asking for help and we bascially get slapped in the face by getting redirected to something that may not even prove useful for the current issue(s) being experienced. And all we wanted was a nitrous system and a digit only speedometer for 9 hours straight! it's called "beginners" for a reason, not "shun away people to a website who don't know how to script"......

even if we did pull a script from a youtube video it still gave errors. even after copying everything down to the T. forgive me if I sound like a jerk, but where i come from, if you come askin for help, you get it no matter who you are. Apologies in advance but with something like this.. we get stressed. :/

queen adder
#

So GameObject.find is terrible So what do you guys prefer using?

rich adder
summer stump
# mental flower Yea but... isnt that the whole point of this server? To help others in need whet...

Yes it is the whole point. And we are here to help you. No one shunned you. This is a misinterpretation of what happened

You never provided information on what you did or how we could help. Just said you wanted a "nitrous system" which is rather bespoke. Provide code and we can help correct it and find bugs.

See the #šŸ“–ā”ƒcode-of-conduct and #854851968446365696 channels for what is expected to get help here though

slender nymph
# mental flower Yea but... isnt that the whole point of this server? To help others in need whet...

this isn't the place to just get free handouts of code or have someone walk you through coding an entire mechanic one step at a time. as has already been pointed out to you, you can ask for help with your implementation to help resolve errors in your logic and exceptions and the like. but just asking for someone to give you code or to do the work for you is a waste of everyone's time, including your own.

teal viper
queen adder
#

i appreciate the help

flint heath
#

mans was just tryna help and u got mad

summer stump
#

I'm still more than willing to help. But we haven't been given anything we can help WITH! Lol

flint heath
#

maybe they were asking for help on how to add a script to a gameobject to start coding? I don't think it's fair to format your messages as if it's a riddle though

summer stump
#

@mental flower if speedroute is right about what you wanted, you simply drag the script onto the gameobject (likely the car?)
Or click "add component" in the inspector of the object and type the name of the script in

slender nymph
summer stump
#

Well, that is not help. That is work

flint heath
#

they weren't asking anything

slender nymph
#

The car does move, and we'd need the script written in C#, with a separate script for the sound and key binding for the booster. (Left shift if anything) Is this the right place to come to?

flint heath
#

anywayyy, could someone help me figure out why this swing animation thing isn't working?

if (Input.GetMouseButtonDown(0))
{
    angle = Mathf.Lerp(angle, angle + swingAngle, swingSpeed * Time.deltaTime); // modify angle so swing will happen no matter where you move your cursor
}

player.transform.rotation = Quaternion.Euler(playerBody.transform.position.x, playerBody.transform.position.y, angle); // point towards mouse cursor
slender nymph
#

because you only lerp for a single frame which is why i suggested a coroutine earlier

summer stump
polar acorn
rich adder
#

you need amount over time

#

Coroutines / Update loop

flint heath
summer stump
#

In short, the third parameter is not a "rate" or "speed", it is a current percentage between parameters 1 and 2

flint heath
polar acorn
flint heath
#

do I need a method to trigger a coroutine, or can I just call the routine by doing exampleRoutine(); at any point?

slender nymph
#

you should look up how coroutines work because you have to use StartCoroutine for it to work correctly

flint heath
slender nymph
summer stump
#

StartCoroutine(myMethod())

But definitely look at the docs. That is just one part of what you need to know

pale nacelle
#

Hello, is there a way to make like one-sided colliders in unity? im making a collider that would decrease the score of the player when for say, he enters a no entry zone. It works but when I enter it from the other side where entry is possible, it decreases the player's score and I want to avoid this. Is there a technique for this?

slender nymph
#

i know 2d has platform effectors which might be able to work like that. otherwise not really, you would probably want to check the direction that the player enters from manually

polar orbit
#

Hello, i'm trying to put a cloud on material but the size shredded and im trying to back it to the normal size to put it on the praticle

vale karma
#

or you could have 2 colliders, and figure out if one is touched before the other then do this bc it wou8ld mean it came from this direction

#

if one was a bool set to true and then passed in the second "do this if bool is true" would be easier

polar orbit
#

do i can back my material to the average size

flint heath
#

is there any way that I can access the local variables from the update function in a script outside of the function as it updates?

slender nymph
#

no

#

local variables are only accessible within the scope they are declared in. so variables declared inside of Update cannot be access outside of Update because they simply do not exist there

#

use fields (class-level variables) if you want to access them in other objects

#

alternatively you can pass data as a parameter to a method if you just need to access something when you call a specific method

vale karma
faint sluice
vale karma
#

yea its a mech for platformers

faint sluice
#

Ye, i just forgot the name

slender nymph
#

that would be the platform effector i already mentioned

vale karma
#

i know its called something... it effects it... hmmm

flint heath
#

you definitely put an italicized might

slender nymph
#

i am not confident that it can be used for that specifically. but i am confident that it is called platform effector

vale karma
#

lol its on the tip of my tonguee

flint heath
#

i think i know!

faint sluice
#

I might be wrong, haven't used in while

vale karma
#

you should check your sources on that

slim moss
#

I think I'm gonna like it here.

vale karma
#

trying to mess with boxfriend failed, hes unphased

faint sluice
#

Who's messing? Just clearing my doubts UnityChanThink

#

Nvm yes it's possible for one way

#

I mistook platform effector for surface effector

flint heath
#

another way you could check is just check the velocity.x of the player or wtv at the time it hits the collider and if its positive then add to the counter and if its negative then you dont add to the counter maybe

slender nymph
faint sluice
#

Mb

slender nymph
#

however i am not 100% certain if that works at all for trigger colliders and whether it would prevent the OnTriggerEnter2D message from being sent

#

especially since trigger colliders do not produce collisions

polar orbit
#

does anyone know about particle thing

summer stump
slender nymph
polar orbit
#

as you guys out of questions will you look at my problem (dont mean to be rude)

flint heath
polar orbit
slender nymph
summer stump
#

variable.accessedThing

flint heath
polar orbit
#

dude that's the same answer ;c

summer stump
slender nymph
flint heath
summer stump
polar orbit
#

then speak my language i can help you

flint heath
#

right so in my situation I don't think I actually do need to return anything from the coroutine, I just need the rotation value to lerp there and back, but because I can't access the local variables from the update function, I can't just put the line of code I normally would there. I could just set up the same local variables that I did in the update function, but then that creates the same issue, that the animation will be overlapped!

polar orbit
#

i'm sorry, i didn't know that my english is that bad.. i was just trying to help and it's okay i understand our friend

#

i will try to practice english more and im not using translator XD

flint heath
#

ty for trying to help

slender nymph
# polar orbit i will try to practice english more and im not using translator XD

you should consider using one. this isn't a dig at your english skills or anything, i know learning another language is hard. it's just that your messages are nearly incomprehensible and you would be much better off if you used a translator so that the people in this discord actually understand what you are trying to say so that you can not only receive help, but help others as well

brisk escarp
#

if anyone is free i need a bit of help with a bit of my code... My error is Assets\Scripts\GunSystem.cs(24,12): error CS0246: The type or namespace name 'CamShake' could not be found
and dont give that link to that help tab thing i have it set up i need real people help

slender nymph
#

start by configuring your !IDE
after that make sure that you have a type called CamShake

eternal falconBOT
brisk escarp
#

i just said i have that set up

slender nymph
#

well you don't

brisk escarp
#

i have followed that document, multiple times

slender nymph
#

like your screenshot very clearly demonstrates you do not have proper syntax highlighting or errors underlined

#

so you either missed something or you need to restart your pc and/or regenerate project files

#

but if you cannot get vs code configured, then consider switching to a real ide like visual studio which is easier to configure and much less likely to randomly break

teal viper
#

I think that might be a custom coloring scheme

#

Because it seems to recognize references.

slender nymph
#

it highlights float but not the other types and does not provide errors underlined

teal viper
#

Ah, true that.

teal viper
brisk escarp
#

vs code

slender nymph
#

it's vs code. vs doesn't do code lens for fields

teal viper
#

Good luck configuring it then.šŸ˜…

wooden vine
#

Hi, in my game, I have a total of four scenes. When I play the third scene by itself, I can see the UI text when I lose and win. However, after I connected the scenes and start from the first one and get to the third scene, the UI text becomes hidden although I could see a panel in the same canvas. I don't know what the issue is.

#

Actually nvm I fixed it

brazen canyon
#

hey guys, please help me with this

teal viper
#

You'll need to provide some context...

languid spire
brazen canyon
languid spire
broken bridge
#

I don't know if this is where to mention this, but there is a bug with my unity pathway (Unity Essentials) where the first quiz isn't counting. Any idea what I can do to fix it?

slender nymph
broken bridge
#

You right, my bad. Ill try, thank you

sonic dome
#

is there a way i can get a bool value for an animation like while the player is running i want a bool value that animation is still playing = true

slender nymph
#

what would the purpose of that be? I ask because that is typically an xy problem

swift elbow
swift elbow
slender nymph
#

checking if an animation is playing is usually the attempted solution to finding out when an animation has completed. so yes, that is usually an XY problem and the typical solution is to use animation events

limpid wren
#

I'm starting to get a fair amount of singleton manager type objects (SFX manager, enemy manager, projectile manager) Is this bad?

#

I feel like there are a lot of systems that need to connect to a more central system

#

And my go-to solution has been to just make a manager, but it feels dirty

swift elbow
#

I thought the point of making a manager was so that it doesn't feel dirty...

limpid wren
#

It felt good in the moment but now that I have like 6 of them and am looking at my 7th it feels less so

brazen canyon
languid spire
brazen canyon
#

It should work now right ?

brazen canyon
languid spire
#

no

#

then you should just be able to delete the Folder

brazen canyon
#

Wait just to be clear, I typed "%temp%" in the Run box.
And then I deleted files there
is that right ?

languid spire
#

no

#

it's this Temp Folder

brazen canyon
brazen canyon
limpid wren
#

you're probably okay, like 90%

brazen canyon
limpid wren
#

instant death

#

But if nothing broke then you're probably fine

languid spire
#

Probably best to reboot the PC just to be on the safe side

vapid mesa
#

hi, i have make animation and now when i jump we see the knee of my character, can i do something to make my camera follow like the head of my character ??

slender nymph
#

this is a code channel

vapid mesa
#

where i can ask this??

slender nymph
sonic dome
#
        is_grounded = Physics.Raycast(transform.position,Vector3.down,playerHeight * 0.5f + 0.2f, ground);
        if(!is_grounded)
        {
            can_roll=false;
        }

why is the is ground not working?

slender nymph
#

but either your raycast is not as long as you think it is, it isn't in the position you think it is, or there is nothing in its path on a layer contained your ground layer mask

sonic dome
#

no its like

#

i m on a terrain

#

sometimes the ray cast is hitting

#

somtime it doesnt

#

i assume it is cuz of the ununiform nature of the terrain

slender nymph
#

draw the raycast so you can see how long it is and where it is actually at

sonic dome
#

i tried using the ongizmos func but i cant set a specific length to the drawn ray

slender nymph
#

although you probably want a query that has some volume like an overlapbox or something instead of just a tiny little raycast

sonic dome
#

let me try using checksphere ig

#

yea worked

#

thanks

hasty spire
languid spire
hasty spire
languid spire
#

how is this set to true?

hasty spire
brazen canyon
#

Hey guys, is there way to compare 2 game objects ?

teal viper
brazen canyon
#
public GameObject A;
public GameObject B;

if(A == B) {
    Debug.Log("I'm ugly");
}

Like this ?

stuck crest
#

hello guys where do i start learning coding?

queen adder
#

!learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

stuck crest
#

ok'

#

ty

queen adder
#

Honestly, the Pathways are the best, start with the Unity Essentials.

fossil gulch
#

Hey! So I'm trying to make a grid-like movement system in 3D, but it's not really going according to plan...
https://gyazo.com/4359c75f70a90452372e1dc19e3df2f6
This is the result I'm getting, now I know that the reason some of the movement in this happens is because the targetPos is just 0,0,0 + whatever is pressed, but I have no idea how to fix this to make it from the current position or anything like that. Am I approaching this whole system incorrectly? If so, what should I do instead?

https://gdl.space/tocemisupa.cs

#

every single movement you see in this is just 1 key press btw, I'm not pressing both D and S to go from the top tile to the right one, just D.

sonic dome
#

is there a way i can shoot a raycast from the center of my camera?

verbal dome
#

Or just make a ray with camera position and camera forward

wintry quarry
#

What's the goal

#
if (input != Vector3.zero)
            {
                var targetPos = transform.position + input:
                 StartCoroutine(Move(targetPos));
            }```
Don't you just want this @fossil gulch ?
fossil gulch
#

The one in FixedUpdate

#

It keeps returning "Object reference not set to an instance of an object"

#

I thought that Event.current.keyCode was the correct thing to use for this switch, but I think I'm mistaken...

#

I'm unable to find anything else that could work by myself

#

scrap that, I googled it and switches are not the way to go for this.

timber tide
#

you can just await the coroutine until thenext action is performed

#

or do a queue of inputs if you wanna go that way

fossil gulch
timber tide
#

keep input in update

#

if it is moving in fixedupdate

#

and as I was saying, you can probably queue the last input so they will instantly respond to it when they get to their destination

fossil gulch
#

that sounds great, but I've no clue on how I'd actually do that...

#

I'll google it

timber tide
#

it's just caching the input someway instead of discarding it when the player is in an action. You see it usually done in networked games to combat latency

fossil gulch
#

I'm thinking of storing the queued input in an array, working on it right now

quiet kindle
#

Hi all, Im using the Unity Splines in-built component, and am able to move amy player along the spline, but I wanted to make my player object do a jump over an obstacle when key is pressed, but Im stuck because the character just keeps on moving ahead, instead of completing the jump action.

rich bluff
wintry quarry
sleek orchid
#

Hey hey!
I am trying to do a simple menu for my game. However, when following a tutorial I came out with a question, how do I check a scene index? How do I know that my "Game Scene" is index 1?

queen adder
sleek orchid
#

Thanks! ā¤ļø

jagged latch
#

Hey my friend

quiet kindle
#

Im using SplineAnimate component on the player to move it along, so the player is usually never touching the groundlayer, just floating a little bit above it.

#

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

private void Update()
{
     // Jump when space key is pressed
    if (Input.GetKeyDown(KeyCode.Space) && jumpCooldownTimer <= 0)
    {
        rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
        jumpCooldownTimer = jumpCooldown;
    }

    // Decrease jump cooldown timer
    if (jumpCooldownTimer > 0)
        jumpCooldownTimer -= Time.deltaTime;

}
#

THis is the code that makes it jump, which works nicely when I am not using SplineAnimate, but it struggles when SplineAnimate is active.

#

All I want to do is get an effect like something we used to see in the iTween library.

rich bluff
quiet kindle
#

Yes

#

and it works great to move the character along the spline, but it prevents the character from jumping, etc. via RigidBody because two forces are acting on it at the same time (probably).

rich bluff
#

i doubt it uses forces to move along the spline

#

most likely it simply sets transform.position

buoyant knot
#

or MovePosition

#

rigidbodies can’t be moved by forces, but also be told to follow a specific trajectory at the same time. the two requests are mutually exclusive

#

it’s like calculating two different positions of where you want it to go. you can only pick one

rich bluff
#

there are several ways i can think of doing this

  1. animate an empty root transform along the spline, and animate the player model locally (jump) while its parented
  2. animate a completely separate transform, and write code that follows that transform
#

second will keep the whole thing physical

buoyant knot
#

when I do this sort of thing, I keep a ground-lock variable

#

it’s a variable to tell me if my character is supposed to ignore all other forces and try to move along a ground slope

rich bluff
#

i think you can make 1 also fully physical

buoyant knot
#

the way I describe no. Because you always get vertical force to try to conform to the ground. you need to be able to disable that to jump

#

and turn it back on when you touch ground in a groundable state

#

i hope that makes sense, even tho it makes the machine state more complex

rich bluff
#

separate the vectors, manage influence/weight, use counter force, i seen it done well

buoyant knot
#

you cannot because if you tell your RB ā€œapply force to conform to this floorā€, and you also apply force to jump, you will get really weird behaviour

#

you need to really shut off the force that snaps you to the spline so you can force only one to happen at a time

#

otherwise, you are applying counterforce to cancel out the force you added, conditionally

#

which is the same thing as what I said, but with more steps, because you add the wrong force, then later need to know what it was you added to properly counter it.

quiet kindle
#

Yeah, and I really like the SplineAnimate component and it has all the fun ease-in, ease out, ping pong, etc. but it completely ignores the groundLayer, which -- I think -- I will probably need to apply the force for the jump.

#

alos, the splienanimate rotates the object in the direction of the spline.

buoyant knot
#

i feel like player movement just isn’t the case where you want to use this component

#

probably a projectile, or a bat, or something that just isn’t grounded

#

so you don’t have two people grabbing the same steering wheel

rich bluff
buoyant knot
#

idk that game

#

if you are in 3D, I would try KCC first tbh

#

it has a lot of the stairs and slopes and camera already figured out

quiet kindle
#

I wonder how the iTween guys did it many yrs ago?

buoyant knot
#

at the end of the day, you need to calculate where your character needs to be, and where it is going next

quiet kindle
#

Look at tht Path constrained character example.

buoyant knot
#

not supported on mobile lol

#

if I had to do it, whenevr I get a jump command, I would put a hard stop to current pathing, and totally recalculate the next destination

#

you basically need to change your trajectory from one frame to the next

#

idk. physics is hard, and idk how much i trust tweening for it

#

as opposed to clearly defined forces that calculate next proposed position/vel solely from the current frame’s position/velocity

#

a proper spline requires using multiple frames of information, and physics information can dramatically alter what you are doing one frame to the next. so i find trying to juggle old data to not be worth it

rich bluff
#

i think its possible to keep character locked to a path, if you only need left/right movement along that path, you will need to sample the point periodically, generate the movement vector by looking ahead on the spline, and compensating with forces only perpendicular to the spline on 2 horizontal axis

#

while keeping it all physical

buoyant knot
#

yeah. lot of work

quiet kindle
#

but it's fun. and I thank you all for your suggestions, some interesting things to learn.

#

so I will stop using SplineAnimate and then work from the grounded work, then rigidbody to jump around.

rich bluff
#

i didnt use that package (?) but i guess you first build the spline itself using objects and SplineAnimate is just additional component?

quiet kindle
#

yes, Spline is built-in, and SplineAnimate is separate component that I've added to the player to follow the spline, so I can remove that, and get the raw spline points, and follow it along like waypoints.

buoyant knot
final kestrel
#

Hey all. I am again here with the same problem. I have a door prefab. This door teleports my player to the gizmo when activated. It works all fine until I put another door. The second door (on the left) teleports my player to the first door's destination point. I drag the destination transform in the inspector.

rich bluff
final kestrel
#

I dont have any way to know that no

#

I mean the first door

rich bluff
#

am i correct to assume that both teleporters are starting their coroutines at the same time?

#

since they both sub to the same event

final kestrel
#

Yes that is the case I believe

#

They only work when interacted though. So When I go for the second door shouldn't it use its own destination?

rich bluff
final kestrel
#

ah okay

#

So when I go to the second door. It acts like this because of subscribing the same event?

rich bluff
#

are you calling StartTeleportCoroutine from some other script?

#

when interacting

final kestrel
#

I am just invoking the softloadstart event on interact.

rich bluff
#

then thats the issue

#

you designed it so that only one teleport can be enabled at a time

#

otherwise it will be random

final kestrel
#

hmm so I can just put the teleports individually OnInteracts without utilizing events

#

So they both call them seperately without doing the same thing

rich bluff
#

typically people use IInteractable interface for this kind of thing

#

or something similar

final kestrel
#

I have an abstract Interactable class

#

The methods are coming from there

rich bluff
#

less optimal imo, but serves the same purpose

final kestrel
#

Oh okay. So I can just do it the way I mentioned right?

#

without events

rich bluff
#

how else will you solve this issue?

#

yes

final kestrel
#

All right. Thanks a lot.

rich bluff
#

you can, in theory pass the context (teleport that was interacted with) in the event payload

final kestrel
#

as an argument you mean?

rich bluff
#

its just a less obvious and more convoluted way that solves it in xyproblem manner

#

yes

final kestrel
#

hmm all right I will look into it. Thanks again.

#

It worked yay

tired junco
#

Hey i tried working with the Scriptable Render Pipeline and created a Custom Renderer Feature that should render the Depth-Texture to the Screen (here Source) but somehow this doesn't seem to work. Any ideas why or do you have any good documentation about Renderer Features (becuase i haven`t found any good so far) https://pastebin.com/UFzaUngi

gray rivet
#

Why is Rigidbody2D not turning blue?

buoyant knot
#

IDE isn’t configured properly

summer stump
eternal falconBOT
buoyant knot
#

try rebuilding solution

#

sometimes IDE can be properly configured, but weirdly gives up if it can’t build the solution properly.

gray rivet
#

i see, so do i click a certain one or can i choose either

buoyant knot
#

first follow the links in the bot. then try rebuild solution if that doesn’t work

gray rivet
#

kk

rich bluff
# gray rivet kk

dont forget to show hidden folders in your project root and nuke .vs folder

gray rivet
#

im a little confused

rich bluff
#

after everything above

#

confused about what

gray rivet
#

where does it say "edit"

summer stump
buoyant knot
#

that’s unity, not VS

gray rivet
#

ohhh

buoyant knot
#

visual studio and unity are two different programs

#

VS is an IDE for making C# code, which may or may not be going into Unity.

summer stump
#

@gray rivet Since you said edit, I assume you're looking for the external tools menu? That is in the Unity Editor, not the Hub

buoyant knot
#

if VS is not configued properly, you need to fix VS

gray rivet
#

so this is what i installed?

lost anvil
summer stump
gray rivet
#

it says to go into the unity editor

summer stump
vestal valve
#

I need to rotate characters at random direction at random time and move towards it. how to do that?

summer stump
#

Well, I guess it would just use the last Time.deltaTime

#

It would still complete all in one frame

#

The frame cannot complete until update does, which cannot complete until the entire while loop does

gray rivet
#

does this look right (i just changed it)

#

okay thanks

summer stump
gray rivet
#

done

#

YESSS

#

tysm

gloomy bison
#

hi! my animation wont play even though the animator says it is?

void Update() {
    if (Input.GetMouseButton(0)) {
        // Debug.Log("CLICKING");

        anim.SetTrigger("Active");
        

    } 

Please help idk what i did wrong

buoyant knot
#

that sounds like a trigger to go from atk to still

gloomy bison
#

yeah i have that but the attack animation never plays

vast vessel
#

how the f does weaponSlots[targetSlot] end up out of the bounds of the weaponSlots array?

wintry quarry
vast vessel
#

it has 4

wintry quarry
#

Debug.Log to prove it

#

just print all these numbers:

  • targetSlot
  • weaponSlots.Count
vast vessel
#

i have break points, when my code hits the break points, i checked all the values. weaponSlots was fine

wintry quarry
#

Then the error happened a different time the code ran

#

probably another copy of the script where weaponSlots is empty

#

Debug.Log will be easier here than a breakpoint

vast vessel
#

heres the debug log

gaunt ice
#
int C=A+=B;
#

this is a valid syntax

#

so you dont get error here

polar acorn
wintry quarry
vast vessel
# polar acorn Show code for `SwitchWeapon`
void SwitchWeapon(int targetSlotIndex)
        {
            if (weaponSlots[targetSlotIndex] == null || weaponSlots[targetSlotIndex].isEmpty)
                return;//dont do anything if the target slot is empty or just dosnt exist

            if (!SelectedSlot.isEmpty)
            {
                SelectedSlot.weapon.PrimaryAttackInputCanceled(default);    //Cancel the shooting on the active weapon before switching
                SelectedSlot.weapon.gameObject.SetActive(false);    //Deactivate the current weapon
            }
            //change the weapon
            selectedSlotIndex = targetSlotIndex;

            weaponSlots[targetSlotIndex].weapon.gameObject.SetActive(true);
            weaponSlots[targetSlotIndex].weapon.DrawWeapon();

            UpdateWeaponIcons();
        }```
vast vessel
#

thank you šŸ™

sleek orchid
#

while building the game this error appeared, any idea how to fix it?

Assets\Scripts\DeathMenu.cs(3,19): error CS0234: The type or namespace name 'SearchService' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
using System.Collections;
using System.Collections.Generic;
using UnityEditor.SearchService;
using UnityEngine;
using UnityEngine.SceneManagement;

public class DeathMenu : MonoBehaviour
{
    public GameObject canva;

    void Awake(){
        Time.timeScale = 1;
    }
    
    void Update(){
        if (IsAlive()){
            canva.SetActive(false);
        } else{
            canva.SetActive(true);
            Time.timeScale = 0;
        }
    }

    bool IsAlive(){
        if(GameObject.Find("Player")){
            return true;
        } else{
            return false;
        }
    }

    public void RetryGameButton(){
        Time.timeScale = 1;
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
    public void MainMenuButton(){
        SceneManager.LoadScene(0);
    }
}

merry spade
#
    private void FixedUpdate()
    {
        if (!childOverlaps)
        {
            UpdateMom();
        }
    }
    private void MoveLeft()
    {
        partTransform.transform.position = new Vector3(transform.position.x - 0.4505f, transform.position.y, transform.position.z);
        
    }
    private void MoveRight()
    { 
        partTransform.transform.position = new Vector3(transform.position.x + 0.4505f, transform.position.y, transform.position.z);
    }
    private void OnTriggerEnter2D(Collider2D other)
    {
        if(other.transform.tag == "SideCheck")
        {
            print("Entered");
            childOverlaps = true;
            MoveRight();
        }
    }
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.transform.tag == "SideCheck")
        {
            print("Exited");
            childOverlaps = false;
        }
    }

Iam programming a tetris like game and I have trouble with coding the boundaries... UpdateMom() Updates the Renderer of the Part(Its called like this because the renderer is on the parents Part) But if I move into the boundary and the trigger goes of the Renderer is allready clipping over the boundary and then snaps back
I would appreciate it if smb could look into that and If needed I can send a video clip of it

tidal kiln
queen adder
queen adder
merry spade
queen adder
sleek orchid
#

I believe I don't need it at all, no Idea why it is there

queen adder
tidal kiln
#

maybe it was intellisense

sleek orchid
#
  • What do u mean by "namespace"?
queen adder
sleek orchid
#

oooh

#

Thanks guys ā¤ļø

#

You were of great help

queen adder
#

np bro

merry spade
#

Wait I send a video clip

#

It snaps back and I dont want that therefore I implementet "UpdateMom()" This teleports the renderer onto the current position but it shouldnt go to the position if the hitbox which searches for boundaries has found one

polar acorn
sleek orchid
#

Just curious... Why?

polar acorn
tidal kiln
polar acorn
#

there's no editor to run editor code in

tidal kiln
#

you dont need physics for this

#

set up a grid system

merry spade
#

Yes I thought of that too but then rotations would make it worse

gaunt ice
#

why?
you can still rotate it but you have to handle the math...

tidal kiln
#

it shouldnt be too much more to rotate it

merry spade
#

ok I will try it

#

But then I would have to make a big array and set all rotations of the parts

#

that would take hours

tidal kiln
#

use a 2d array

merry spade
#

yes i meant 2d

gaunt ice
#

using grid system should be much easier
i have no idea how to detect if a line if full and cutting the collider in physics system

merry spade
tidal kiln
#

anyway to answer your original question the problem is youre setting the position then checking if its out of bounds then you move it again

merry spade
tidal kiln
#

i believe the trigger doesnt get called until the next frame

merry spade
#

ok but then how do i fix this

tidal kiln
#

you change the position in frame 1, in frame 2 the move function is called

#

you need to check if its out of bounds first

#

which is why i recommended the grid system

#

i dont think you can make it work easily with your current system

#

maybe a work around would be to check the width o f the shape and calculate if its position is past the bounds position

#

quick fix i guess

merry spade
tidal kiln
#

why

merry spade
#

All of my parts are squares

#

only the hitbox is different

tidal kiln
#

so take the left most and right most squares and see if they are out of bounds

#

this isnt gonna work with physics so just scrap that

tidal kiln
merry spade
#

what do you mean by "the left most and right most squares"?

sleek orchid
#

Yo, I just made my first game! It looks like shit. However, thanks for the aid guys ā¤ļø

tidal kiln
#

if the position of these are past the blue line dont move it

#

theres a function like get position at corners or something

merry spade
#

ah so you mean make a hitbox for every block?

#

square

tidal kiln
#

no, no hitboxes no physics

merry spade
#

just from the renderer?

tidal kiln
#

lets say position of lines is(-4,0) (4,0)

gaunt ice
#

checking the (logical) position of each block of the falling tile

timber tide
#

if I had a dime for every tetris tutorial that used colliders for their game i'd be rich

tidal kiln
#

before you move or rotate the item, check if that position will be past the bounds of the lines

merry spade
merry spade
#

thank you

languid spire
#

I've got 3D tetris code that doesn't use colliders

tidal kiln
#

for rotation you could get the top most square and rotate it about the origin then check the bounds

verbal dome
#

Colliders for tetris sounds absurd

#

Unless it has some physics-based twist

bitter carbon
#

how would i check if a certain thing is in the Hierarchy with code?

tidal kiln
#

simple way could be FindFirstObjectByType<T>

merry spade
# tidal kiln for rotation you could get the top most square and rotate it about the origin th...

I think I missunderstood sth this feels illegal haha

    private void CheckRight(int curr)
    {
        float[] positions = { transform.position.x + 0.4505f, transform.position.y};
        for (int i = 0; i < positions.Length; i++)
        {
            square_pos[curr, i] = positions[i];
        }
    }
    private void CheckLeft(int curr)
    {
        float[] positions = { transform.position.x - 0.4505f, transform.position.y };
        for (int i = 0; i < positions.Length; i++)
        {
            square_pos[curr, i] = positions[i];
        }
    }
    private void CheckDown(int curr)
    {
        float[] positions = { transform.position.x, transform.position.y - 0.4505f};
        for (int i = 0; i < positions.Length; i++)
        {
            square_pos[curr, i] = positions[i];
        }
    }
    private void CheckHere(int curr)
    {
        float[] positions = { transform.position.x, transform.position.y};
        for (int i = 0; i < positions.Length; i++)
        {
            square_pos[curr, i] = positions[i];
        }
    }
    private void CalculateSquares()
    {
        if(this_part == Parts.t_block)
        {
            CheckRight(0);
            CheckLeft(1);
            CheckDown(2);
            CheckHere(3);
        }
    }

and thats only one part one rotation every part has 4

#

it writes down the coordinates of every square

gaunt ice
#

your grabage collector:
there is s struct called vector2

wintry quarry
#

The fun thing about Vectors in Unity is you can do this:

Vector3 myV3 = new(4, 5, 6);
for (int i = 0; i < 3; i++) {
  print(myV3[i]);
}```
#

although I'm not really following what this code is doing

tidal kiln
#

ok so i think your way is a little inefficient

merry spade
#

Ok explanation: I want to make a tetris like game and want to check if the block would be outside of the boundaries if I move it therefore I need to know every position of every square of every part so even if I rotate I can check If its outside and this should calculate every square pos of the T-Block in tetris

fossil gulch
# timber tide it's just caching the input someway instead of discarding it when the player is ...

Hey! With the help of some friends I was able to get the movement working how I want it to. This is what it currently looks like
https://gyazo.com/7c20d9784c71d11181382bdda3b5ca18
https://gdl.space/besajiruyu.cs
That's my script.
I just seem to be stumbling upon one small issue, and that is that the animation is glitching out because the player stops on the nodes/points of the grid for a split second. I have no idea how to fix this...

stable moth
#

Something is wrong with the synthax guys ?

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

public class CustomGravity : MonoBehaviour
{
   
    // Update is called once per frame
    void Update()
    {
        AddForce(Vector3(0,0,9800), ForceMode.Acceleration);
    }
}```
languid spire
#

yes, AddForce need a Rigidbody instance to work on

frigid sequoia
fossil gulch
#

yes. Give me a second, I've hidden the grid points. I'll show them

timber tide
#

your animation state is changing to movement -> idle -> movement

#

so if you dont want the hiccup then you need logic that bypasses the idle if you've got continuous input

tidal kiln
#

@merry spade lets say you have 3 square wide object and each square is 1 distance, origin is in the middle. when this object is spawned we can take the distance from the origin to end of the object. in this case its 1.5. now when we try to move left we will calculate our new distance and subtract 1.5 from it.

fossil gulch
merry spade
languid spire
#

oh, yeah, sure, I'm here purely for your benefit

fossil gulch
#

So like, If there's a queue then don't set the forward animation float to 0

tidal kiln
frigid sequoia
timber tide
#

because if it's a bool you'd just loop it ^

merry spade
#

I will try it again

fossil gulch
fossil gulch
#

I didn't make them, they're placeholders

timber tide
#

well if they are bools then you dont want to flip them off if you're continuing in a direction

wintry quarry
fossil gulch
#

They're in a blend tree is all I know

#

this is what my animator looks like

tidal kiln
merry spade
#

yes in that case I only have to write down the distances for every rotation that should be simpler

bronze lynx
#

i have a game where you can pick up things. but when you go near the wall, the object goes through it. Does anyone have a script or any ideas that makes it so it collides with the walls?

stable moth
#

Is there like a self alternative in c# ?

gaunt ice
#

this
and it is still wrong, monobehaviour is not rb
!ide

tidal kiln
#

this

gaunt ice
#

!ide

eternal falconBOT
gaunt ice
#

you dont really need this. in c# unlike python

rich adder
stable moth
tidal kiln
#

lol

rich adder
stable moth
tidal kiln
#

2 people answered your question

#

and youre just being rude

stable moth
#

Im sorry ?

fossil gulch
#

set up your ide

rich adder
#

if you refuse I have no issue contacting Mod about it

stable moth
merry spade
polar acorn
eternal falconBOT
fossil gulch
polar acorn
#

Now that we know, it won't happen again

stable moth
#

Didid i say something wrong ? English is not my maiin language

tidal kiln
#

language doesnt matter

fossil gulch
#

you have to configure your IDE to be able to spot errors in your code more easily. Without it, helping you is more or less impossible.

rich adder
#

You literally have compile errors, and that is part of the solution

stable moth
#

Then just explain why setting up the ide, you never said how it gonna help

fossil gulch
rich adder
stable moth
stable moth
#

But it's not a reason to insult me of b word

rich adder
fossil gulch
stable moth
rich adder
fossil gulch
#

I've tried checking if the queue is empty, adding a small delay before ending the MoveRoutine, etc. And It's still glitching out. I'm really bad with animation, So I struggle to understand what is causing the issue

stable moth
stable moth
polar acorn
eternal falconBOT
tidal kiln
#

it says right there that its disabled

stable moth
fossil gulch
swift sedge
# stable moth

that's not an ide. Unity pairs with VS Code, but its a challenge to setup

timber tide
stable moth
timber tide
#

of course there could be other issues but id make sure that's working first

rich adder
rich adder
#

and yes ur running it in Restricted mode it wont work

swift sedge
fossil gulch
#

well I think the best way to go about this is just not stopping the movement coroutine at all until the player is done with their inputs, (the player stops for a split second when moving to the TargetPosition) because it also causes my shadow (gameobject) underneath to glitch out.

stable moth
rich adder
rich adder
#

that generally opens the editor not in Restricted mode

fossil gulch
stable moth
#

Ok i found i

swift sedge
#

I wish unity had a built-in code editor

stable moth
rich adder
fossil gulch
#

wasting more disk space, I like

stable moth
#

Ahhh the good old godot days(litterally 5 days ago)

tidal kiln
languid spire
rich adder
#

Unity hasn't even made their own VSCode plugin , I would not trust them making an IDE

final kestrel
#

Say I have several panels in canvas. How can I choose which canvasgroup to play with its alpha? Without dragging them on inspector.

rich adder
#

or Simple Dependency inject

final kestrel
#

All right. Thanks navarone.

queen adder
#

There used to be a thing called MonoDevelop which was built into Unity I think?

rich adder
#

no MonoDevelop is a sepearate app

fossil gulch
#

Any ideas? anyone?

rich adder
cosmic quail
fossil gulch
#

It's in my code. I can explain it if you want

fossil gulch
tidal kiln
#

check the next queue item

#

if its move forward dont switch it

eternal falconBOT
fossil gulch
#

I sent the code...

#

it's the gdl.space link

rich adder
#

oh ops

cosmic quail
#

i thought that was the video link

#

i havent heard of gdl space

rich adder
#

I think you may be running the coroutine multuple times

rich adder
fossil gulch
#

I tried doing

           animator.SetFloat("forward", 1);
       else
           animator.SetFloat("forward", 0);

but it doesn't work, as, for some reason, the queue is empty

#

but it's obviously not, seeing as the queue is working how it should

#

Anyways, the way I thought about fixing this was by not stopping on the next grid spot at all while another move is queued

rich adder
#

Id check the coroutines first

timber tide
#

could make it like snake and just run in the direction until you queue another direction

#

;)

rich adder
#

store it inside a coroutine variable, make sure u dont run it multiple times
start new Coroutine wont stop previous so might cause issues

tidal kiln
#

i cant read it all right right now but peek the queue and see if the vector has changed, if not dont do anything

fossil gulch
#

1s I can show you guys what the issue is

tidal kiln
#

actually not peek just get the dequeue vector

fossil gulch
#

Look at the rigidbody's speed

#

property

#

it goes back to 0 when touching the next grid point

#

which makes sense

#

because when a move is queued it's making 2 movements, not 1 (It's running the MoveRoutine coroutine twice)

#

And because the coroutine ends, the float also returns back to 0

#

so how can I make it move 2 grid points when holding a button and not stop on the first one..... that's where I'm stuck

#

the goal is to just make movement like an old gameboy game but in 3d

tidal kiln
#

ok im on break lemme check the code

#

ok so

#

you can set Forward to true, set isMoving = true, start moving, once you reach destination check if key is still down, if true just continue queueing another move

#

if im missing something lmk

fossil gulch
#

hmm let me try that

#

thanks

#

small problem

#

no clue how to do that

#

I've been looking through my code to see where I could put the check

tidal kiln
#

1 sec

fossil gulch
#

but the new movedirection is being selected at the top, and just replaying the coroutine again would lead to the same issue as I'm currently having

tidal kiln
#
private void CheckQueue() 
{
  float horizontalInput = Input.GetAxisRaw("Horizontal");
  if (horizontalInput != 0f || verticalInput != 0f)
            {
                Vector3 direction = new Vector3(horizontalInput, 0f, verticalInput);
                inputQueue.Enqueue(direction);
                RotateCharacter(direction);
return;
            }
transform.position = targetPos;
        isMoving = false;

        
        
        if (inputQueue.Count == 0) 
  
          animator.SetFloat("forward", 0);

}
#

sorry for formatting lol

#

you can put that after your while loop in in MoveRoutine

#

i think that should work or something similar

vapid mesa
#

hi, i try to make a link between two script but he tell me this:

#

i've done a serializerd fied but it don't work

polar acorn
# vapid mesa

Then something on that line is null but you're trying to use it anyway

#

What's that line?

vapid mesa
#

it is from another script

polar acorn
#

Where do you assign PickupItem?

vapid mesa
vapid yew
#

I think I destroyed my Unity project when I was deleting files in my C drive.

What are the consequences of deleting the Library folder?
Is there a quick way to repair project?

vapid mesa
polar acorn
# vapid mesa

This is a class. Where do you assign a value to the variable PickupItem in your Animation Script?

tidal kiln
#

did you drag drop PickupItem

polar acorn
#

That's it

vapid mesa
#

i need to asign a value into my 2 script??

polar acorn
fossil gulch
vapid yew
#

Well is it worth deleting trying to recover a corrupt project?
Do you have any other suggestions?

@polar acorn

polar acorn
#

It's purely ephemeral data and gets rebuilt if it doesn't exist on next startup

tidal kiln
#

my bad i copy pasted some things from your other code

#

remove the verticalinput part and RotateCharacter

#

what else is wrong

vapid yew
#

The error I am receiving is There were problems loading project Assembly-CSharp.csproj There's nothing wrong with dotnet and I can make/open other Unity projects.

#

What if I just deleted the .csproj files?

tidal kiln
#

you should be able to call that function from inside the coroutine

polar acorn
fossil gulch
#

The thing I need is to check whether the same key is still being held down that caused the initial movement, and if it is, continue moving without stopping, at the end of the Move Coroutine. (I just don't know how to do this) :d

https://gdl.space/ogohosumet.cs

tidal kiln
#

cache it once you start movement

#

then compare in the function i wrote

swift sedge
vapid mesa
#

i can't

swift sedge
#

Unity will regenerate the csproj file anyway

vapid yew
#

Is there an easy way to rebuild my project without having to fuck around?

vapid mesa
#

and i can't drag the scri^pt

vapid yew
#

There's nothing wrong with "my end" of the project. I just deleted a shit tonne of files when I was drunk without thinking.

vapid mesa
#

he reconize variable but they don't work

vapid yew
#

Realistically, Assets and Packages are all I need, right?

vapid yew
#

That is not concrete.

tidal kiln
fossil gulch
tidal kiln
#

is there a reason for the queue

#

maybe you can scrap it

fossil gulch
#

the queue exists so that, if a button is held down, it doesn't stop upon reaching the next grid point and that you'd have to press the movement button again

tidal kiln
#

sorry i didnt get it

rich adder
vapid yew
#

I never implied I was deleting any project files.

#

I thrashed my C drive from Microsoft bloatware(TM)

tidal kiln
#

cant you scrap the queue check input, start animation/movement, set isMoving true, if input is received while isMoving is true ignore it, once MoveRoutine finishes check input again, if its still the same dont do anything and let movement continue, if its different or none change/stop movement?

rich adder
#

doesnt make my statement any less valid

vapid yew
#

Maybe a few extra files were lost in the process, you can't help casualties.

swift sedge
rich adder
#

You still need project settings, n manifest

vapid yew
#

What is the path to: things like Project settings and my URP asset settings?

vapid yew
rich adder
#

just use Version Control and slap a gitignore

#

it know exactly what to back up

summer stump
vapid yew
#

@rich adder Granted, I would still like to know the path.

rich adder
#

ProjectRoot/ ProjectSettings
etc.

vapid yew
#

Oh cool, thanks

tidal kiln
rich adder
#

URP settings are typically Scriptable Objects so they exist in the Assets folder

charred heart
#

Hi, why my animation event not firing? I'm adding an animation event at runtime. It is expected to be fired at the end of the animation clip. This is my code:

private void DefineAnimationClipEvent()
{
     AnimationClip standUpClip = _animator.runtimeAnimatorController.animationClips.First(x => x.name == "StandUp");
     if (standUpClip.events == null)
     {
         AnimationEvent standUpDoneEvent = new AnimationEvent();
         standUpDoneEvent.functionName = "StandUpDoneAnimationEvent";
         standUpDoneEvent.time = standUpClip.length;
         standUpClip.AddEvent(standUpDoneEvent);
     }
}

private void StandUpDoneAnimationEvent()
{
    _npcBehaviorMode.NPCBehaviorMode = NPCBehaviorModeEnum.PathAction;
    Debug.Log("StandUpDoneAnimationEvent");
}

vapid yew
#

I can just copy that entire folder and paste over once I make a new project, right? @rich adder

rich adder
vapid yew
#

Great idea.

short hazel
vapid yew
#

I want to try delete the csproj files first and regenerate them before I start a new project. I know sln is a solution file, but can this also be regenerated?

#

@rich adder

rich adder
#

yes both can be deleted and regenerated

languid spire
vapid yew
#

@languid spire Then clearly I have other issues with my project then?

#

Also whilst I'm here, how do I change a material preset for TMP during runtime?

rich adder
vapid yew
#

Nah doesn't work

rich adder
#

wdym "Doesn't work" ?

charred heart
vapid yew
#

The default material preset persists.

rich adder
#

hmm worked for me last time.. weird. Gonan try it again

fossil gulch
tidal kiln
#

ok gimme a minute ill show you what i mean

vapid yew
#

And that creates an instance of the material also.

#

That is unwanted behavior.

fossil gulch
#

What the hell, it does!

#

what did you change?

tidal kiln
#

oh wow lol

#

i removed the queue

fossil gulch
#

that's all?

tidal kiln
#

yup

#

and just used isMoving

#

the queue wasnt doing anything special

fossil gulch
#

the player is still technically stopping on the grid points, but at least the animation isn't glitching out anymore

#

wait let me show you

tidal kiln
#

sure

#

i dont really have a way to test it so that helps lol

fossil gulch
#

under the player

#

you can see that the player is still stopping by the shadow stopping for a split second

#

but that is something I'm willing to live with

#

and touching a collider causes a stack overflow lmao

#

or well, it seems trying to leave the grid causes a stack oveflow

tidal kiln
#

oh i thinkn the problem is with either the animator or the lerp

tidal kiln
#

oh theres no lerp lol

fossil gulch
tidal kiln
#

gimme a sec i gotta do something at my job

timber tide
#

the grid idea making me want to make some snake adventure game

fossil gulch
#

for me it came from playing old pokemon games

#

games like X&Y and Omega Ruby & Alpha Sapphire have this grid esque system as well

#

not that those are old, but they achieve it in 3D

tidal kiln
#

im also making a grid game based on a GBA game i played when i was a kid

#

megaman battle network

fossil gulch
#

ohh I think I might've played that as a child as well

silver girder
#

I Have an issue of play sound on collision here is the script:
***`using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
AudioSource audioSource;

void Start()
{
    audioSource = GetComponent<AudioSource>();
}

void OnCollisionEnter(Collision collision)
{
    foreach (ContactPoint contact in collision.contacts)
    {
        Debug.DrawRay(contact.point, contact.normal, Color.white);
    }
    if (collision.relativeVelocity.magnitude > 2)
        audioSource.Play();
}

}`***

tidal kiln
fossil gulch
#

there is not

tidal kiln
#

thats the problem

#

i think

#

wait lemme check again

silver girder
rare basin
#

debug the code first

#

and describe your isse

#

"i have an issue" doesnt tell anything

silver girder
rare basin
#

identify what's not working?

tidal kiln
#

actually i think im wrong

rare basin
#

and why it's not working

tidal kiln
#

do you know where the error comes from

queen adder
# silver girder wdym debug?

Mate, its what you were told yesterday when trying to seek help.
You weren't describing your issue and someone had a painful experiance trying to extract information from you.

fossil gulch
#

all I know is that it tries to move off of the grid and that causes a stackoverflow

delicate venture
#

Hey guys, sorry to bother but I've reached a dead end so any help is welcome, so basically my game has a Quest System where the Player can interact with NPCs, depending on the NPC he can accept Quests, when accepting the Player needs to go after a specific item , if the player passes over the item, the item disappears from the world and appears in the inventory, the player returning with the necessary item to the NPC the mission is over

The problem is, I have a function that checks if the Quest can be finished, it checks all inventory slots and checks if the item needed for that quest is present, if it is present the player can talk to the NPC again, if this happens, the NPC removes the item from the player's inventory and the mission ends.

But this function to check if it can be finished isn't working, I've already tried using debug logs and breaks and it didnt return anything, so i dont know what could be causing all the problem (the console in VS returns zero errors too btw)

TL;DR i have a function that his purpose is to check if the Quest can be completed although i don't have any errors in vs or unity the function seems to not be working