#šŸ’»ā”ƒcode-beginner

1 messages Ā· Page 569 of 1

woeful bridge
#

roblox is a pretty powerful engine imo its more of the recourses you have to use limit you a ton

plucky kernel
#

I remember seeing a 100 robux game would give me 10 robux in profits

crimson pike
#

That’s disgusting

#

Sheesh

woeful bridge
#

it use to be 0% of profits

#

lol

plucky kernel
#

WOW

frosty hound
#

This isn't a Roblox server, keep this channel on topic please.

grand snow
#

there is a great video series of the exploitive nature of roblox games

#

ops

woeful bridge
#

scary man appears D:

plucky kernel
woeful bridge
crimson pike
#

so how do I script the code to make an mmo

woeful bridge
#

you type things

#

and put some magic in your words

#

then boom mmo

plucky kernel
#

alright so my unity question that I had written somewhere else

crimson pike
#

(Something rest of the owl)

plucky kernel
#

omg it's too long

woeful bridge
#

HOLY SHIT DEACTIVATING A OBJECT MAKES THE SCRIPT NOT RUN ITS A FUCKING CHRISTMAS MIREACLE

#

Ok back to my slave shift on programming

polar acorn
woeful bridge
#

you should tell roblox that then

#

anyways I'm gonna code

ivory bobcat
woeful bridge
#

for like an hour thanks for the yap and talk and help

crimson pike
woeful bridge
#

system32

polar acorn
teal viper
crimson pike
#

Oh really?

woeful bridge
#

kk

crimson pike
woeful bridge
#

woah thats insane it stops everything when you disable a object unity is so fucking cool

ivory bobcat
teal viper
ivory bobcat
#

Both which may share behaviors though

crimson pike
#

Huh. Good to know

polar acorn
woeful bridge
crimson pike
#

Unity’s got so many quirks to navigate

polar acorn
woeful bridge
#

Huh weird

#

That functionality was within my old engine and it was also single threaded

teal viper
crimson pike
#

You can do thread pooling still tho right?

woeful bridge
#

Maybe I meant process

crimson pike
#

Like native c# multi threading tools work the way I’d expect?

polar acorn
#

Yes, but you can't run any UnityEngine functions outside the main thread

crimson pike
#

And that was my next question. Ic

#

So it’s only useful for background logic jobs or async asset loading?

woeful bridge
#

So I’m confused within my old engine I was able to create virtual threads then kill them is that not a thing for unity?

polar acorn
#

But Unity does provide Coroutines for psuedo-asynchronous code

#

It's not actually multithreaded, it just pretends to be

teal viper
woeful bridge
#

Yields pretty much

#

I can show the docs ig

crimson pike
#

I could make a background data logger that sends http requests to a remote server tho yea?

teal viper
crimson pike
#

Like I guess you’d have to read all the game data in the engine and pass it off to the background remote logger job or something

woeful bridge
#

I FOUND THE WORD

#

coroutine

#

THAT

grand snow
#

Unity is not "single threaded" purely but the core update cycle logic is single threaded and ofc most user code will be too

woeful bridge
#

Is that a thing on unity

wintry quarry
#

yes

#

unity has coroutines

woeful bridge
#

Ok

grand snow
#

Coroutines šŸ™‚
async šŸ˜Ž

crimson pike
#

What was their purpose in rbl

#

Oh

woeful bridge
#

Killing virtual threads

crimson pike
#

So what about InstantiateAsync is there a practical use for that?

teal viper
# woeful bridge coroutine

It might be a totally different thing if it's a different engine and even more so if it's different language. But it doesn't sound like a feature built in into the language, so the "thread killing" probably has some more complexity to it than you understand.

grand snow
#

last time i tried instantiate async it was half broken šŸ˜†

woeful bridge
crimson pike
#

I couldn’t find any perceivable difference besides it taking like .01 Ms to finish

wintry quarry
#

and you cannot disable a component outside the main thread

teal viper
crimson pike
#

!code

eternal falconBOT
grand snow
woeful bridge
#

Or I don’t understand that in-depth of code idfk

#

Was just curious tho thanks

crimson pike
#
public void DoSomething() {
     this.someComponent.DoAnotherThing();
this.gameObject.SetActive(false);
this.someComponent.DoYetAnotherThing();  //does this happen?
}

grand snow
#

yes

#

enable state controls if some functions like Update() are called and thats about it for monos

#

ofc for say a renderer, it wont render anymore

#

Up to you to check the enabled state if you want it to be used!

teal viper
woeful bridge
#

I’m sure lol theres no way to see behind the scenes on that platform so I have no idea

wintry quarry
crimson pike
#

Yeah that’s what I was asking šŸ™‚

woeful bridge
#

But yeah thanks!

crimson pike
#

Cool

polar acorn
#

Disabling an object only prevents Unity from calling a function. If you do it manually it works. Otherwise, you'd never be able to activate it

crimson pike
#

Though I don’t see a practical reason to structure code in a way it could step on its own toes but good to know

wintry quarry
grand snow
#

Awake() is always called even if disabled and ofc user code can do whatever

crimson pike
#

Well, I mean it clearly is intended to be an easy way to strike objects from a scene without destroying them

wintry quarry
grand snow
#

that should be start no?

wintry quarry
#

Nope, both of them

crimson pike
#

What’s the Diff between awake and start?

wintry quarry
#

Ah active object vs disabled component yeah

grand snow
teal viper
#

Script != Gameobject

polar acorn
teal viper
#

Enabled != Acitve

grand snow
#

yea i mean the components disable state

polar acorn
#

If the object is disabled, the scripts don't run awake

grand snow
#

I kinda wish that wasnt the case myself but yes

polar acorn
#

I think we've been kind of loosey goosey with the words "enabled" and "active" this whole conversation

#

because there is a very important difference

crimson pike
#

Also I’m assuming trying to access components in a constructor is not gonna work right

wintry quarry
#

Weird question

grand snow
#

nah it moans at you usually for being too early

wintry quarry
polar acorn
wintry quarry
#

You should use awake

#

If it's a regular C# class then you can do whatever you like in the constructor

crimson pike
#

I’ve only been using constructor to instantiate things like lists

#

With a : base() just in case

wintry quarry
#

Not a constructor

polar acorn
wintry quarry
#

If this is a MonoBehaviour

polar acorn
#

Chances are you have serialized the lists so they're created by the inspector and you've never noticed those functions don't run at all

crimson pike
#

Yeah, I mean it does work but I was only making sure the list isn’t null at runtime

#

Nothing more complicated than that. But probably better get out of that habit for unity

#

Sorry for weird questions still getting my head around how unity thinks in general

teal viper
#

You should initialize your fields with field initializers or in awake in MonoBehaviours

crimson pike
#

So awake is like unity’s pipeline constructor? What differs between that and Start()?

grand snow
#

img i sent before, awake is called even if the component is not enabled

crimson pike
#

Oh thanks didn’t see it

grand snow
#

start gets called first time it is enabled (usually the case)

teal viper
crimson pike
#

Neat

grand snow
#

i need that image as a poster

polar acorn
#

If you spawn an object in code, that object's Awake method will run before Instantiate returns. Start will run after the current Update frame is done

grand snow
#

Dunno if common but 99% of what I write has manual Init() functions that we use (usually also to pass some dependencies too)

polar acorn
#

That's not an uncommon pattern. Sometimes you need something that runs between Awake and Start (like if you're instantiating multiple things and need them to reference each other)

swift crag
#

especially for objects with an obvious owner

woeful bridge
#

can you make custom properties in a object without like making a script?

#

Like I wanna some how just have a refrence to another object in the object

#

but do I really need a whole script to do that

wintry quarry
#

you need a script for that

woeful bridge
#

ā˜¹ļø

#

kk

wintry quarry
#

You could also have another script that stores a dictionary that holds the data but... that's a script

woeful bridge
#

yeah just having a refrence is easier

wintry quarry
#

It's really not a big deal to have a script

woeful bridge
#

ik

wintry quarry
#

beginners often use way too few scripts

polar acorn
woeful bridge
#

I just need to tell the game what item in my character thats inactive to activate when I pick up an item

#

so I legit just need to get that refrence and activate the object then destroy the object on the ground

wintry quarry
woeful bridge
#

Yeah! I was just being sure there wasn't a different way

wintry quarry
#

really this is one script on the player - the interaction script
and one script on the object - that has the info about which item to activate on the player.

#

Really it could be a prefab reference to instantiate too

#

there are many ways to do everything and anything

woeful bridge
#

I know I'm just coming from a different engine so I'm trying to figure out the traditional way to do things before I make my own ways

#

like the way I would do it in the other engine is the heiarchy is a big ass dictionary table so I'd just grab the name and get the child with the name lol but I think with unity its a big ass array

#

or list idk

wintry quarry
#

unity has much more efficient ways

woeful bridge
#

ye thats why I asked

polar acorn
#

And you should never tie functionality to names. If you decide later you wanna capitalize something suddenly all your inventory system stops working

woeful bridge
#

like I said I didn't have a choice in the previous engine so I kinda had too I'm mindsetted in one engine and now I'm trying to swap my mindset to a new engine

#

its why I'm asking questions that might sounds dumb lol

hallow bough
#

So I am working on exporting my project thorugh WebGL, but when I run the game outside of the editor, the screen zooms in a wierd manner, and the button for changing the scene does not work. Can anyone help?

{
    ClosePhidgets();
    SceneManager.LoadScene("Scene1");
    StartCoroutine(WaitForSceneLoad(SceneManager.GetSceneByName("Scene1")));
}

public IEnumerator WaitForSceneLoad(Scene scene)
{
while (!scene.isLoaded)
{
    yield return null;
}
Debug.Log("Setting active scene..");
SceneManager.SetActiveScene(scene);
}

private void ClosePhidgets()
{
    redButton.OnApplicationQuit();
    ui.OnApplicationQuit();
}```

ps. I know start is not capitalised, it is the name of a button
wintry quarry
#

Also make sure the button is responding to mouseover.

hallow bough
wintry quarry
#

of course...

#

depends which browser you're using

hallow bough
#

sorry...

wintry quarry
#

For chrome

#

I take it you don't know anything about web development then

#

Thje size of the game window is determined by the HTML/CSS on the page

hallow bough
#

definetly not, this is my first ever coding project outside of block code

wintry quarry
#

specifically of the html canvas element the game is being drawn in

#
#

this is strictly a web development concern

#

there's nothing Unity can do to control this

#

you control this with your HTML/CSS/Javascript on the web page

#

Note that by making a webgl game you are essentially committing to making a small, simple web page as well.

hallow bough
#

is there a better alternative? my goal is to get it to run on a raspberry pi

wintry quarry
#

the unity build will give you basically a barebones sample web page

#

but you can and should customize it

wintry quarry
#

If it's webgl, it runs in a web browser

hallow bough
wintry quarry
hallow bough
#

yes

hallow bough
#

ty ā¤ļø

teal viper
hallow bough
#

what do you mean? for WebGL?

teal viper
#

Though I guess if it runs in the browser, it should be fine as a standalone build too.

teal viper
hallow bough
#

how big would a linux build be? I have 8 gb and I am curious if it takes more (it is a decently small project with 2 scenes)

wintry quarry
#

The minimum build size with a completely empty project and basically all assets and packages removed is probably around 5MB

hallow bough
#

which linux module should I use? I saw these three and I am not sure of the distance

teal viper
#

Or both just in case you want to test both builds

hallow bough
#

is one of them better than the other? I have limited storage and processing power, so I do not want to waste space

dense mica
#

Hey folks, over the years I've periodically had issues with Unity Editor Run performance while running my games. This past month it has gotten really bad, where things will freeze up for seconds on a 7800X3D w/ 4080 super just running a simple 2D game. The profiler is showing long waits like this. I've been messing with Gsync and other settings to no avail. Compiling/running my game gets 200+ fps without any issues, so this all appears editor related. Any thoughts on what it might be?

mighty compass
#

Hey guys, I’m transforming a player model during update, rotating it during late update (because of animation priority), and setting a gun model’s transform and rotation to the player models hand during late update. I’m having an issue where the gun models position is not synced up with the player at all.

sweet mica
#

Why is it red?

slender nymph
#

you're missing the closing brace for the Update method

#

looks like maybe the one for the class as well

sweet mica
#

Does the moving code go in the blueprint or is it applied after it spawns?

echo ruin
#

What moving code?

#

Assuming you’re doing the flappy bird tutorial, moving code should go in the Pipe object

sweet mica
#

Do i have to make a new asset?

#

If i left it out

echo ruin
#

You already have the pipe object

#

Which I’m assuming you want to move?

sweet mica
#

Yeah, i made a sprite, then the tutorial said to make an asset with a top and bottom pipe, do i add the move script directly to the asset?

echo ruin
#

Wait okay. I think I know what you mean

#

You add it to the prefab

rich adder
sweet mica
echo ruin
#

I.e. Blueprint. The thing you clicked and dragged into the folder

sweet mica
#

I forgot to drag and drop

#

Lol

echo ruin
#

If you put it on the prefab, it will be attached to all the objects that spawn. If you put it on an object in the hiearchy (the window where your objects are), it will only be attached to that one

sweet mica
#

Well at least they are moving

echo ruin
#

Does it work?

sweet mica
#

It's spawning 1, then a second later thousands

echo ruin
#

Did you put the spawner script on the pipe object?

sweet mica
#

Lemme check

echo ruin
#

Cause then each pipe will spawn more pipes lol

sweet mica
#

What do i need to screenshot?

echo ruin
#

The window you attached the script to

sweet mica
echo ruin
#

Okay all good

#

Now screenshot the hiearchy window.

sweet mica
echo ruin
#

Okay

#

Screenshot script again

#

Your updated script

sweet mica
#

You did mean the spawn script, right?

echo ruin
#

Yes

#

It looks right. Can you screenshot the pipe object window

#

Inspector window

sweet mica
echo ruin
#

That’s the spawner. Find the pipe prefab

#

Should be in a folder somewhere

sweet mica
#

Thats what i clicked on

#

The one with the blue cube

echo ruin
#

You’ve attached a Pipe object, but you’re looking at a PipeSpawn object

sweet mica
#

Oh i clicked and nothing happened mb

echo ruin
#

That looks like a prefab that contains more child objects

#

I want to see what components you have in the child objects (you should have an upper or lower pipe?)

sweet mica
#

The sprite itself? I just ctrl c > ctrl v'd and flipped it

#

That's what the tutorial said to do

echo ruin
#

But you should have an object containing the sprite renderer

sweet mica
echo ruin
#

Oh wait

#

I see the error

#

In the spawner script, you’re not resetting the timer

sweet mica
#

Lemme check the video

echo ruin
#

You need to set the timer back to 0 in the spawnPipe method

#

Timer = 0;

#

Cause now, it will just keep spawning a pipe every frame once the timer is up

ivory bobcat
# sweet mica
if(...)
{
    ...
}
else
{
    spawnPipe();
    Timer = 0f;
}```
sweet mica
#

Yeah I found it lol

#

Thanks

#

It's beautiful

echo ruin
#

Very nice!

sweet mica
#

I feel like a toddler learning the alphabet

ivory bobcat
#

I'm sure it was just as magnificent prior to fixing the cooldown timer šŸ˜

sweet mica
#

Also, I noticed it takes a solid 10 seconds for the game to run, is there a way to make it go faster?

swift elbow
#

go to your project settings > editor and change the reload domain setting to reload scene only

versed cove
#
void Move()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");

        Vector3 move = transform.right * x + transform.forward * z;
        controller.Move(move * speed * Time.deltaTime);

        isGrounded = controller.isGrounded;

        if (isGrounded && velocity.y < 0)
        {
            velocity.y = groundedGravity;
        }
        else
        {
            velocity.y += gravity * Time.deltaTime;
        }

        controller.Move(velocity * Time.deltaTime);
    }

    void Look()
    {
        float mouseX = Input.GetAxis("Mouse X") * lookSpeed;
        float mouseY = Input.GetAxis("Mouse Y") * lookSpeed;

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

        playerCamera.transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        transform.Rotate(Vector3.up * mouseX);
    }```

Just need some advice on this, thoughts? Anything I can clean up or improve? Is this acceptable?
sweet mica
#

I added a box collider to the prefab and now the bird is flying backwards

echo ruin
#

When it flies into a pipe?

sweet mica
ivory bobcat
#

Maybe the birdie is bumping into something in the scene.. for instance, the background UnityChanThink

echo ruin
#

Sounds like the collider pushes the bird away

#

Did you attach the collider to the bird itself

sweet mica
#

I made the background through the main carmera though

#

Does it start with a collider?

echo ruin
#

I.e. The same object that has the rigidbody2D component?

echo ruin
sweet mica
#

The bird has a rigid body and a circle collider

echo ruin
#

Then what did you put the box collider on?

sweet mica
#

The pipe prefab

#

Is there a voice channel to share screens?

echo ruin
#

Colliders don’t automatically adjust their size and location to the object, so it might have spawned at the center of the screen

#

You have to adjust it manually

sweet mica
#

Oh, that makes sense

echo ruin
#

That would be best to do inside the prefab.. when you press the cube inside the asset folder

teal viper
sweet mica
echo ruin
#

Then on the box collider component, there should be a button with a bunch of lines and circles on it (i think). Click that so you can see the collider

#

Then you can easily adjust the borders of the collider by pressing and dragging on the x and y on the scale input

sweet mica
#

FOUND IT. FINALLY.

#

Thanks

#

It looks like this, right?

echo ruin
#

Yes

#

Then just fit the size to the pipe

#

You might need another box collider for the top pipe

sweet mica
#

The reason i couldn't find it is because i didn't have the actual pipe on the scene lmao

#

Can i delete it now?

#

I'm still flying backwards but faster now

echo ruin
#

Even when not near the pipe?

sweet mica
#

Why did it do that

#

Uh oh

fickle plume
#

@sweet mica Please create a thread.

sweet mica
#

The best flappybird game ever

echo ruin
#

I can’t watch that on my phone

sweet mica
#

I'll fix it, its going in the thread now

slate haven
#

How to jump with new input system but with using Transform.Translate and custom gravity? how do u do that

hexed terrace
#

Those are two separate unrelated things.
You just want to find out how to detect a key/button press with the new input system -> do basic tutorials (probably found in the pinned msg's on #šŸ–±ļøā”ƒinput-system )
Once you've learnt that, all you do is call a method with it, in which you put whatever you need -> google unity how to jump

slate haven
burnt vapor
#

With 2d games I generally just make it myself and a FixedUpdate method constantly pulls down objects based on the configured gravity

dreamy gull
#

Is there documentation for global-metadata.dat anywhere?

fossil drum
dreamy gull
fossil drum
dreamy gull
#

Okay. What does that have to do with learning about file formats?

burnt vapor
#

Because why else would you want to learn about the file?

dreamy gull
#

Curiosity?

#

There's already tools to dump the data from the file.. I was just interested in the file format

fossil drum
#

So yeah, this is about decompilation.

dreamy gull
#

In what way?

fossil drum
#

I'm not going to argue semantics with you, good luck with it.

dreamy gull
#

I already found it. I was just looking for official documentation

sharp sluice
#

Doesn't unity generate that file

keen owl
#

A built project typically contains those, yes

sharp sluice
#

oh i'd reckon that this would be the place for asking about that stuff

dreamy gull
#

Wow. I was about to reply to the person asking why I would want to learn and they deleted their message v.v

echo copper
#

guys, i want to rotate player like that:

#

i forget how to send a code...

fossil drum
#

!code

eternal falconBOT
echo copper
#

ok

#

so, why when i have Horizontal axis = -1, player rotates x rotation?

#

i didn't wanted to

echo copper
#

code should rotate only z and y rotation, but not x. it didn't suppose to do it.

#

is anyone here?

grand snow
#

do you have any other components that change the rotation? try debugging what the rotation is actually set to when going left

#

cus if thats all that sets rotation it must be it. working with eulers only can cause issues like this

echo copper
grand snow
willow shoal
#

Hi quick question. i need add (0 ,0 ,0) and spawn my player here after destroy. i try my self but i cant do that

public GameObject Prefab;
public GameObject gracz;
 void OnTriggerEnter(Collider other)
{ 
if (other.CompareTag("wood1ded"))
{ 
Destroy(gracz);
}
grand snow
#

log before/after to see what the rotation changes to or attach a debugger and see what happens @echo copper

echo copper
grand snow
burnt vapor
dreamy gull
#

That's fair

#

I don't care anymore either

burnt vapor
#

šŸ¤

fossil drum
# echo copper urm... i have never done this...

Just FYI, you can get the same EulerAngle rotation by doing other rotations.
So your the value that you actually set with ANGLE on the Z axis and -180 on the Y is the same rotation as -180 0 -45.
So even if you don't set the X, Unity can simplify it to that itself.

echo copper
#

anyone?

#

maaaaaan...

languid spire
#

that is not what @fossil drum said

echo copper
languid spire
#

what is not to understand? -180 0 -45. is not 180 0 -45.

echo copper
#

what should i do... i am really sorry if i am too annoying, but how to fix directions?

tiny wind
#

how do I put the scale of an object into the code?

grand snow
#

or you do it in a different order.
Quaternion.Identity -> rotate y for left/right dir -> do slope x/z rotation

rough lynx
stray stump
tiny wind
#

how do I do this? im making it so that the if statement activates when the scale is that

#

this doesnt work, i just found out

visual linden
#

Alternatively, you can use Vector3.one, which is a shorthand

timber tide
#

you're doing an inline assignment

tiny wind
visual linden
#

Single = is an assignment

burnt vapor
timber tide
#

I wonder why that is throwing an error anyway. Does that not work in c#

tiny wind
#

oh, did not notice, alr thanks

visual linden
burnt vapor
#

But that was not the intention here obviously

#

And if it did, it would have to return a boolean somehow

rancid tinsel
#

any idea why a script component might disable itself at runtime, despite there being no code telling it to?

burnt vapor
rancid tinsel
burnt vapor
#

No, I mean you look for the keyword enabled

#

Because setting this disables components

rancid tinsel
#

i get over 100 different results because of a package ive got

#

let me limit it

astral falcon
#

You rather should look into other scripts that probably do something GetComponentInChildren or so and enable/disable them

rough lynx
#

If your packages aren't in separate solutions you can also ctrl + shift + f and search your entire solution

rancid tinsel
#

the thing is i dont think ive added anything that enables/disables yet

#

those are the only instances of "enabled" in the entire solution

teal viper
rancid tinsel
teal viper
rancid tinsel
#

ok seems that was it!

#

thank you

teal viper
#

Always pay attention to the errors in the console. They would often be the cause of whatever issues you might have or at least be related to them.

echo copper
#

can i... ask the same question again..? like... WHY IM TRYING TO ROTATE Y ROTATION, BUT IT ROTATES X ROTATION, IDK WHY

#

like. if i rotate: transform.rotation = Quaternion.Euler(new Vector3(0, 180, 0)); it rotates y rotation

eternal falconBOT
echo copper
#

sry

#

if ANGLE = 0, he rotates x rotation, not y as it not supposed to be

#

but here, he rotates y rotation as it supposed to be

teal viper
#

You don't ever rotate around Y axis. Well aside from setting it to 180 degrees in the first snippet.

echo copper
teal viper
eternal falconBOT
#

:teacher: Unity Learn ↗

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

teal viper
#

Because it sounds like you're missing some basics.

echo copper
teal viper
#

Well, then you didn't learn properly. You should be able to rotate an object after a week or 2.

#

Assuming you learn properly

willow shoal
#

i have big problem because he everytime switch this to this after destroy : /

rancid tinsel
#

any idea why this never gets to the last line? no error, application still working I'm super confused

#

it does the if statement clearly because I get the "Number of words" debug

#

but then just ignores the last line

burnt vapor
teal viper
rancid tinsel
#

the "added to dictionary" one at the end

#

but both of them

teal viper
rancid tinsel
#

i also added a debug after the last line and that didnt go through either

burnt vapor
#

I suggest you put a log above PopulateTrie to verify

teal viper
rancid tinsel
willow shoal
#

when my block spawn he change player form file to hierarchy

teal viper
willow shoal
#

and i cant spawn 3rd time

rancid tinsel
burnt vapor
willow shoal
#

my player stuck

burnt vapor
#

And also, share PopulateTrie please

rancid tinsel
teal viper
# rancid tinsel yes

Try restarting the IDE, or even the editor too. Sometimes code changes are not registered.

rancid tinsel
teal viper
rancid tinsel
rancid tinsel
teal viper
#

It doesn't seem like threads are involved either

teal viper
rancid tinsel
#

yes

teal viper
#

Namely, the last Debug.Log that you added.

rancid tinsel
#

i restarted both

#

and i can see changes in the asset previews

teal viper
#

Well, at these point use the debugger and step through the code.

rancid tinsel
#

also putting a debug before it doesnt work

languid spire
rancid tinsel
#

really weird

rancid tinsel
languid spire
#

no it is not

rancid tinsel
#

pretty sure Trie is just another name for a Prefix Tree at least thats what we were taught

teal viper
rancid tinsel
#

there are different tabs on here, first one is the WordLoader

#

second WordSearchManager

#

and then the Trie

teal viper
rancid tinsel
#

im only using one at the moment

swift elbow
rancid tinsel
#

but good idea

rancid tinsel
#

or eastern european actually not french

teal viper
rancid tinsel
#

actually i think its just pronounced Try

#

and i made it up

swift elbow
#

Make up your mind bro

teal viper
#

That's probably what's going on. And I recommend starting using the debugger, as that would make such issues solvable in a minute.

rancid tinsel
teal viper
rancid tinsel
#

the debug statements

teal viper
rancid tinsel
#

wdym

teal viper
#

It calls the index one.

#

And it doesn't have any extra lines at the bottom

rancid tinsel
#

oh my god

#

🤦

teal viper
#

My advice: learn to use the debugger.

rancid tinsel
#

yes that was the issue 😭

#

thanks for the help, I actually can't believe that's what it was

burnt vapor
#

Well, as long as you understand that code doesn't magically stop

#

Either it blocks, blocks in a multithreaded context, threw an exception or never compiled to begin with

#

Most can be spotted quite easily since something will visibly break

languid spire
rancid tinsel
visual linden
#

Well, technically it is, it's just not a very good implementation.
DRY and all that

hexed terrace
#

well, yes, that is an overload.. the signatures are correct.
However, you shouldnt have duplicate code inside the methods

jaunty bay
#

guys my unity just crashed, and stupidly me, i forcely closed it, n i lost 24h+ of progress. anyone knows if theres anyway i can get a recovery from that?

languid spire
#

what is there to force close if the app crashed?

visual linden
#

They lost 24h+ of work, no need to interrogate them on the circumstances when it's irrelevant finishyourgame šŸ˜…

teal viper
languid spire
#

It's actually very relevant

naive pawn
#

how do you go 24hr on a single scene without ever saving

visual linden
#

Well, true in a sense. I've a hard time imagining someone not at least saving the scene

naive pawn
#

also how do you get unity to crash and then force close it

burnt vapor
jaunty bay
feral moon
burnt vapor
#

Can we get a "Time to download Git" sticker in this server? Seems more and more relevant each day

jaunty bay
#

but ty anyway! i found 0.bak in temp folder

languid spire
#

so not a crash, a hang, quite different

naive pawn
jaunty bay
burnt vapor
#

As your experience grows you'll learn to save every minute which will prevent these issues

#

And as you reach this point additional experience will teach you to save twice, three times in a row just in case the first one didn't work well enough

jaunty bay
#

my laptop is so slow tht it takes 5 sec to save my project

#

so yea, i should still do that tho šŸ˜…

naive pawn
#

the bottleneck would probably be with the disk specifically

visual linden
tiny wind
languid spire
#

someone who doesn' save their work for 24+ hours is hardly likely to do both saving and a git commit

compact stag
#

hey guys! i was looking to make a platformer, i was wondering how would i be able to tell in which ground my player would be stepping in? as i want to make a special effect depending on what the player is stepping on

should i make a script and apply to every ground, then use a onCollisionEnter to check if the ground's tag or name is something in specific? or is there a better way?

visual linden
burnt vapor
#

And pointless. Github Desktop is free and works perfectly

visual linden
#

Like WinRAR free

burnt vapor
#

They should definitely clarify that then

#

This suggests free trial for me at best

hexed terrace
naive pawn
#

free trial for a period of 1 eternity

burnt vapor
#

Sure

hexed terrace
#

fork is for devs who need to do more than push/ pull

naive pawn
#

i mean don't ides kinda have good integration already

burnt vapor
#

What exactly is there to Fork that would make Github Desktop the worse option then?

#

I also think calling it something for beginners is silly. I have been using it since it got released

hexed terrace
#

more advanced options for whatever you need to do with git

#

dont take offence at that.. it wasnt an insult to you personally

burnt vapor
#

No I get that. It's just that I am looking for actual differences but Google doesn't list that many

#

If Git-fork isn't paywalled then I obviously take it back. It just seemed to have that or a trial version

#

Deifnitely looks a lot better than Github Desktop

hexed terrace
#

they're not going to advertise on their site that you can use it indefinitely without paying

#

Ive used it for... 5 or 6 years without paying.. pops up occasionally to buy it

#

Learned about it because of vertx mentioning it - and tbh I should prob pay for it, used it for so long

burnt vapor
#

I'm definitely going to give it a look

night raptor
#

Do you really think 6 years is enough to evaluate a software? Give it 10 at least

visual linden
languid spire
bitter apex
#

I'm instantiating a bunch of objects with

Vector3 position = new Vector3((x * gapSize) + 0.5f, (y * gapSize) + 0.5f, 0);
                GameObject tile = Instantiate(prefabTile, position, quaternion.identity);   
                tile.name = $"tile_{x}_{y}";
                tile.transform.parent = TileHolder.transform;```
and it only runs for the first tile, and not any following tiles, because of a nullreference exception
tiny wind
teal viper
naive pawn
naive pawn
#

also, shouldn't it be Quaternion.identity

languid spire
#

thats Unity.Mathematics

naive pawn
#

also would help to show the looping part of the code so all the context is included

bitter apex
#
for (int x = 0; x < objectWidth; x++)
        {
            for (int y = 0; y < objectHeight; y++)
            {
                Vector3 position = new Vector3((x * gapSize) + 0.5f, (y * gapSize) + 0.5f, 0);
                GameObject tile = Instantiate(prefabTile, position, quaternion.identity);   
                tile.name = $"tile_{x}_{y}";
                tile.transform.parent = TileHolder.transform;
            }
        }```
languid spire
#

so, tile holder is null

bitter apex
#

TileHolder is a GameObject i have assigned in the inspector

languid spire
#

bet?

naive pawn
runic lance
naive pawn
#

ah ok

hexed terrace
#

according to the docs it's a capital Q

night raptor
#

That's what I thought, but UnityEngine.Quaterion should be still used if mathematics are not in use

runic lance
#

of course it would be better to use the Quaternion already, but at least there's nothing wrong there šŸ¤·ā€ā™‚ļø

naive pawn
hexed terrace
#

it wouldn't even be compiling if what's there now wasn't ok

bitter apex
# languid spire so, tile holder is null

okay nevermind my bad, thank you. It seemed to work for the first tile I was instantiating but not past that, I just changed it from assigning in the inspector to actually specifying the object in the script, works fine.

#

problem is sorted, and quaternion.identity works fine for the purpose i want it to

night raptor
naive pawn
swift elbow
#

Can anyone share some knowledge on how gameObj.find works and why it's so inefficient? I imagine that it doesn't use a simple for loop because I've never heard of for loops being inefficient but I can't think of what else it could do to achieve this result

bitter apex
#

I was intentionally using the Unity.Mathematics one but I'm not sure if that's a good thing lol. I'll just change it to the UnityEngine one instead then.

feral moon
hexed terrace
naive pawn
swift elbow
night raptor
swift crag
swift crag
#
for (int i = 0; i < 100000000; ++i) {
  Debug.Log("AAAAAAAAAAA");
}
wintry quarry
swift crag
#

I would actually not worry much about the slowness of Find, tbh

naive pawn
wintry quarry
#

For loops are slow when they go over a lot of items.

swift crag
#

It has much worse correctness problems

#

In fact, this is almost always true

#

GetComponentInChildren is really nasty because it's sensitive to adding and removing components in your hierarchy

night raptor
#

And when you use Find everywhere and your scene grows, you will quickly get to the N^2 territory which might start being a performance issue too

swift crag
#

It is also a bit slow, possibly

#

But the main problem is that it can wind up finding the completely wrong component

naive pawn
#

rename an object? you're fucked
typo the object name in the hierarchy/inspector? you're fucked
typo the object name in Find? you're fucked
the above, for any object in the hierarchy of the target? you're fucked

swift crag
#

I die a bit when I see someone doing GameObject.Find("Foo (Clone)")

#

IMO, names should exist solely to make it easier for you, the human being, to identify things

#

Names (and, more generally, paths) can change

naive pawn
#

to summarize the performance concern; it's not egregious, computers are fast, but it could be so, so much faster with other methods
it searches and does string comparison, both relatively expensive steps for the given task
direct references remove both steps, and they're generally clearer and provide a direct semantic/mental link, so they're generally the much better option

night raptor
charred spoke
swift crag
naive pawn
#

i mean probably not too hard to do actually

swift crag
#

oh, I'm thinking about the paths in animation clips

tiny wind
#

ive been trying for a while, nothings happening

naive pawn
swift crag
#

Names are a very...flexible(?) option

naive pawn
#

though that's not really part of the interface is it

naive pawn
#

how's that different?

swift crag
#

Several places in Unity let you turn a string into some other kind of identifier

charred spoke
#

By several places I think it's animators and shaders

swift crag
#

Animator.StringToHash, for example, or Shader.PropertyToID

charred spoke
#

gotta make that code GC free

visual linden
#

NameToLayer I believe is a thing to

swift crag
#

Unity doesn't tend to use the full names of things internally -- they get turned into some fixed-sized piece of data

night raptor
#

Are string comparisons really that bad in general though (for logic sure, but for performance)? Most strings will differ on the couple few characters anyways

naive pawn
swift crag
#

Part of the problem is that the string has to be shipped off to Native Code Land

night raptor
burnt vapor
swift crag
#

Yeah, I would be less concerned if this was a simple string comparison in C#-land

burnt vapor
#

It also depends on your use case. Maybe you want to compare another way (i.e. hashcode)

tiny wind
swift elbow
swift elbow
naive pawn
compact stag
#

hey guys! i was looking to make a platformer, i was wondering how would i be able to tell in which ground my player would be stepping in? as i want to make a special effect depending on what the player is stepping on

should i make a script and apply to every ground, then use a onCollisionEnter to check if the ground's tag or name is something in specific? or is there a better way?

swift crag
hexed terrace
swift crag
#

Linear time can be awful

timber tide
#

singleton is the better solution to any find

swift elbow
#

I love singletons šŸ˜ I use 20 at once if I need to

swift crag
#

But, again -- I have much bigger correctness problems with using Find

#

The performance is a secondary concern

ivory bobcat
# night raptor That is one problem with strings in general but I don't think comparisons have t...

I read this a long time ago so I'm not sure if it's still relevant
https://discussions.unity.com/t/is-comparetag-better-than-gameobject-tag-performance-wise/33954/5

The key difference between tag and compareTag is that compareTag does not result in a heap allocation. In Unity, retrieving strings from game Objects will create a duplicate of the string, which will need to be garbage collected.

The source I found reports a ~27% increase in performance of compareTag(aString) vs. using gameObject.tag == ā€œaStringā€;

Source:
Unity 5 Game Optimization by Chris Dickinson

swift elbow
swift crag
naive pawn
#

it's relatively expensive, i guess, but that's generally not the cinch

#

it's generally better to avoid strings if you can, they're kinda fragile

#

unless you're doing something where strings can be typed like an enum, like in ts

ivory bobcat
#

Might be out of context as well. I was assuming they're attempting to access the tag property for comparison - I wasn't here for the whole discussion.

naive pawn
#

(the original question was about Find)

swift crag
#

But that's more of an issue with how most Unity properties result in a call into native code, which has to allocate memory to give you the result

timber tide
#

using literals is usually the best way about it but lot of features with unity still require that string comparison unfortunately

naive pawn
#

using literals? strings can also be literals wdym

timber tide
#

whoops I mean variables

swift crag
#

perhaps you mean using things like Animator.StringToHash

timber tide
#

godot people were saying that a lot of the string comparison is relatively fast

#

a lot of its features do use a lot of string comparisons

#

I generally just like the more type-safe nature and having the compiler know beforehand

night raptor
tiny wind
wintry quarry
night raptor
#

Often Find is even used for things that could be directly referenced otherwise (even drag and drop to a field in editor, singleton or something else)

timber tide
#

or instead of finding that object, let the object itself do some callback/subscribe when it is created

night raptor
#

Things like FindObjectsOfTypeAll in editor scripts I would say is totally acceptable but if the game logic relies on Finds, it is indicative of bad design choises

grand snow
#

If i load a scene that has a main manager class ill use FindObjectOfType() to get it initially but that's about it.
An alternative is to search the scene root objects for the component.

night raptor
visual linden
#

If performance isn't an issue, such as in Awake etc, I think it's perfectly acceptable using FindObjectByType. We've all got games to make, after all.

grand snow
#

It could but we wouldnt access or use it via this singleton static ref anyway

#

For the games that do this its only 1 call when the scene is loaded in additively and thats it

burnt vapor
#

Why cant you just use a static reference if there's a single manager? I don't see the issue

#

There's very little reason to use Findtype methods, if at all

grand snow
#

When potentially many people can work on a game its better to avoid stuff that can be miss used down the road

languid spire
night raptor
#

In this case I wouldn't really worry

grand snow
#

its not my choice who works on a project i just work on what im told by the PM

burnt vapor
night raptor
visual linden
#

Always assume someone is going to see your code, try to understand it, and build upon it, and then design it in a way that makes your intent abundantly clear and doesn't invite to misuse.

grand snow
#

šŸ˜† ha this chat

burnt vapor
#

If I want to use a manager, the first thing I'd probably do is check if there's an Instance property on it

#

Which is pretty common in .NET for default single instances btw

grand snow
#

ill end with this: i dont want the static field to exist so its not miss used when a pre existing system/design exists for other components to access said manager šŸ™

languid spire
burnt vapor
grand snow
#

no need to worry

burnt vapor
#

Sounds easier to me that you can access a singleton instance through a static property instead of having a badly coupled system using smelly Find methods

runic lance
#

if you're using DI extensively there's no need for singletons basically

#

neither Find methods

burnt vapor
#

Also that, a proper DI system should essentially replace everything in the end, and it will be easier to replace a singleton than a Find method

rotund garnet
#

https://www.youtube.com/watch?v=hKtbGYQVw08
I cant find any info on this, and I'm trying to make AI for my zombies. I want them to walk around obstacles using ray casting - how could i get something like the result in the video?
I do not wanna use the Unity AI system, because it seems like overkill, for just simple zombies in my case.

The main objective of this code sample is to explain how to write an AI for enemy player to detect and avoid obstacle easily using Physics.RayCast. You can find the tutorial here :

ā–¶ Play video
burnt vapor
#

Best case scenario there's a single provider providing registered instances based on the context. Either through a factory or as-is

timber tide
#

Singletons aren't truely static though which is why it's more preferable to use them if you're worried about misusing globals

grand snow
#

to be clear, 1 single find is used and all the rest is manually passed dependencies + inits without any finds.

#

its purely to "connect" the newly loaded scene to the loading service

burnt vapor
#

That's definitely a lot better than what I thought you had, yeah

grand snow
#

blah blah other stuff

#

I have refactored code by others in such games to remove Finds as i accept they are not reliable or good to use.

echo copper
#

my mistake was in other thing

timber tide
#

Keeping the game manager as the only singleton and doing service locator pattern is also another great idea if you don't want to bloat up a project static types

visual linden
#

Reason you don’t make your classes accessible by default is so that junior programmers will come to you asking how they can access it, and you tell them ā€œYou don’t. What exactly is it you’re wanting to do?ā€

burnt vapor
visual linden
#

If you're using it to access a class that you didn't write- you probably shouldn't be accessing it.

echo copper
#

Guys, how can I change object's position according to its parent's position?

visual linden
#

Whereas if it is a singleton or has a static reference, it invites you to access it

timber tide
echo copper
#

Okay, i will try it

wintry quarry
#

Binary search trees allow for O(logn) lookups

swift elbow
#

im kinda familiar with what O notation is and how it works but im having trouble visualizing how much of a difference this is. can you give a factor by how much slower O(logn) is to O(1)?

naive pawn
#

O(1) is 1 operation
O(logn) divides n until you're left with 1; however many times you divide is how many operations, what you divide by depends on the data type (but usually log_2 in the context of computing)
O(n) is n operations

swift elbow
#

that doesnt sound so bad...

naive pawn
#

this isn't how it plays out exactly, since big-O describes how fast it scales, so it leaves out constants and lesser-degree terms
iterating over a list once or twice are both O(n)

#

an example might make more sense actually

burnt vapor
#

Especially when code performs often these things matter

wintry quarry
#

So with a list that long, O(1) is 1,000,000 times faster theoretically

#

it all depends on the list length

#

in practice you probably have 100 or 200 GameObjects in the scene

timber tide
#

I've like 100k trees in one of my scenes

naive pawn
#

suppose 2 lists, one with 8 elements, another with 64 elements
an O(1) algorithm will take the same time for both (getting the length)
an O(logn) algorithm will take twice as long to do 64 than 8 (n-element binary tree)
an O(n) algorithm will take 8 times as long to do 64 than 8 (n-element list)
an O(n^2) algorithm will take 64 times as long (nxn grid/combinations)
an O(2^n) algorithm will take 72057594037927936 times as long (0-1 knapsack)
an O(n!) algorithm will take 3146997326038793752565312235495076408801228079725823219216316824782110720000000000000 times as long (permutation)

swift elbow
#

brother where did that factorial come from

#

or is this just an example for example's sake?

naive pawn
#

it's an example

runic lance
#

you can do a factorial it if you set your mind to it

naive pawn
#

O(n!) algorithms do exist, like permutations

i can't think of anything that isn't just a permutation in more words

wintry quarry
naive pawn
#

oh yeah, there's an algorithm to find the determinant of a matrix that's in factorial time

swift elbow
silk meteor
#

so im trying to make a pong copy, just to test my knowledge, and ive encountered one issue, im not changing the y axis, they are set through the rigid body, to give a more natural feeling, however, once it hits the ground, the y velocity is set to 0, is it possible to just invert it? so +8 becomes -8, and vice versa

naive pawn
#

uhh i don't think pong should have a "ground"

silk meteor
#

watch a pong video

swift elbow
#

thats entirely possible, yeah. depends on your setup

wintry quarry
naive pawn
#

maybe set your physics materials to 1 bounce

swift elbow
silk meteor
#

the floor is a floor

#

and so is the ceiling

swift elbow
#

im confused now

naive pawn
wintry quarry
naive pawn
silk meteor
naive pawn
#

yes

silk meteor
#

you bounce off the floor and ceiling

naive pawn
#

no, the ball does that

silk meteor
#

ok im just gonna crash out

naive pawn
#

you control a paddle, not the ball

silk meteor
#

i never said you control the ball

naive pawn
#

the ball is supposed to touch the walls

#

that's like, how it bounces

wintry quarry
#

ok this is clearly just a case of you guys using different terminology for walls and floors

swift elbow
#

wait are we talking about table tennis or virtual pong?

#

like against an AI

silk meteor
#

when did we start talking about table tennis wtf

naive pawn
swift elbow
#

idk chris mentioned paddles

naive pawn
#

pong has paddles

silk meteor
swift elbow
#

table tennis has paddles

silk meteor
#

obviously when im talking about pong and something moving on the x and y axis, its referring to the ball

#

maybe i misspoke but its still common sense

naive pawn
#

ok no the problem is people come here way too often talking about stuff with the wrong words so im not automatically assuming you're referring to that lol

#

saying the ball is the player makes it really confusing what you're actually talking about

silk meteor
#

well now we know DaveHangUp

naive pawn
#

are you saying the walls as in, the right/left edges of the screen, and floor/ceiling as the top/bottom edges of the screen

silk meteor
#

yes

#

in fairness it is a top down game not platformer

#

so thats mb

naive pawn
#

yeah so if you're doing physics i think you could just make everything bouncy without any friction or drag

wintry quarry
#

the physics engine is not designed to give perfect elastic collisions etc, and won't.

obsidian plaza
#

so this is my game im working on and i have a question on how i could improve the note hitting feedback in regards to the animations on the monster.

whenever i successfully attack, miss an attack, or dodge an attack, an animation is played corresponding to that on the monster. the issue is that it seems a bit jittery and doesnt always do the right animation when the gameplay starts to get faster.

ideally, attacking the enemy will cause it to scale down and being attacked will cause it to scale up but will always scale from its current scale so it doesnt look jittery. another thing is that once it is finished scaling, it needs to slowly return back to the original/normals scale. does this make sense and is there an easy way to do this?

cerulean badger
#

how do I make a 2d object clickable? I've searched in yt and most of the tutorials are for 3d and the 2d ones are just some mumbo jumbo or free assets that dont actually explain anything

wintry quarry
obsidian plaza
#

but maybe not the best way

wintry quarry
#

You need:

  • Event System in the scene
  • Physics Raycaster2D on your camera
  • Collider2D on the object
  • Script that implements IPointerDownHandler on the object (alternatively you could use the EventTrigger component, but I don't recommend that)
#

This is the best way

cerulean badger
gaunt sandal
cerulean badger
#

i mean part of the place where you walk in

hexed terrace
#

the environment

cerulean badger
#

yea

hexed terrace
#

Praetor has given you the answer

gaunt sandal
#

the one praetor is definitely an option, but i'm checking if there's a simpler method

wintry quarry
#

There are simpler ways, but the one I shared is the best because it will automatically give you appropriate interaction with UI elements and other objects that cover it

cerulean badger
#

ok then, ty

wintry quarry
#

As well as giving you the option to easily implement other interactions like OnPointerEnter, OnPointerExit, OnPointerUp, etc.

grand snow
#
  • add a physics raycaster to the camera and an event system to the scene
wintry quarry
grand snow
#

I just read the small reply bit šŸ˜‚
We need more threads

wintry quarry
#

imo every question should be a thread

#

I guess that would be the forum style discord channel though.

obsidian plaza
languid spire
gaunt sandal
wintry quarry
wintry quarry
#

Is it possible to make world space UI elements? Yeah of course but it's not necessary here

#

and it means a whole separate set of objects.

gaunt sandal
#

ah right he asked for making any 2d object clickable

smoky jungle
#

I hope someone can help because I have absolutly no clue how to work on this problem.

obsidian plaza
#

i was gonna possible change the position as well as scale but its probably not needed anyway

#

could use the same logic

queen adder
#

Hello

gaunt sandal
#

hello

languid spire
placid ferry
languid spire
#

you were also told how to post code which you have conviently ignored

hexed terrace
#

you were also shown how to share code, that wasn't one of the ways

placid ferry
languid spire
#

tough

hexed terrace
#

That's ChatGPT code innit

placid ferry
hexed terrace
#

surely you know whether you copied it from ChatGPT - all those comments scream "generated by AI"

languid spire
#

you mean copy/pasted, not learned

placid ferry
languid spire
#

ok so what does it do?

visual linden
#

What is the point of this arguing

placid ferry
placid ferry
echo copper
#

how to make children object not to follow parent object?

hexed terrace
wintry quarry
visual linden
#

Is it Mouse Look?

placid ferry
# visual linden Is it Mouse Look?

So with that code it allows me to lean left to right kinda like Rainbow 6, But I tried everything connected to that and it still does the jitter, but yes its something with the mouse look

burnt vapor
burnt vapor
#

If it's not the code, then what is?

placid ferry
#

What do you think im trying to figure out

#

Like hello?

burnt vapor
#

Is it obvious why getting your code from AI gives you very little knowledge on what it actually does? And now you end up with a bug that you are unable to solve yourself

placid ferry
#

its not from ai, thats what im tryna say?

#

I don't even have an account for ChatGPT

burnt vapor
#

It's very clearly from AI

#

//(You don't have to use the mouse buttons if you don't want to, you can do "Input.GetKey(KeyCode.Q)" for example)
Who are you talking to here?

crimson pike
#

Is using fixedupdate for movement updates similar to multiplying motion by time.delta in regular update calls?

naive pawn
#

they both have their own deltaTime

visual linden
#

Maybe we can pretend @placid ferry came on here just asking a very broad question, how to.. "implement leaning like in Rainbow 6"?
And we workshop it from there?

crimson pike
#

But both methods would make consistent movement independent of frame rate?

naive pawn
#

fixedupdate and update don't run on second intervals, if you need to convert per-time stuff to be used per frame/physics tick, the deltaTime converts from the per-second value to the per-frame/tick value

rich adder
visual linden
#

I think they mentioned it was from a youtube tutorial. Linking to it might be a good start too.

rich adder
#

there is too much thought in the comments to be AI

naive pawn
burnt vapor
crimson pike
#

Well I’m not using physics too much in this game

naive pawn
#

update is a change per frame
fixedupdate is a change per physics tick

naive pawn
#

just use deltaTime

crimson pike
#

Icic thanks

placid ferry
rich adder
rich adder
eternal falconBOT
polar acorn
#

Because the you in a week is a different person from the you now

visual linden
#

So if I understand it correctly,
in the video, you're trying to lean by pressing the lean key, but after it finishes leaning, it snaps back to center?

placid ferry
rich adder
visual linden
# placid ferry Yes

Sounds like your animator might have a transition back to your idle state that doesn't have its transition rule properly configured (so any time the lean animation finishes it automatically goes back to idle, when it should be waiting for you to release the lean key).

placid ferry
placid ferry
#

when leaning and on idle

#

if ur free I can call and show you

#

wait no you were right

#

Im super sorry abt that

visual linden
#

Fantastic :D So you think you're able to figure it out?

placid ferry
visual linden
#

I'd rather you didn't šŸ˜… But if it's animator setup stuff, we have #šŸƒā”ƒanimation and the people lurking there are probably a lot better at that stuff than I am.

placid ferry
visual linden
jaunty coyote
#
inventoryManager = transform.root.GetComponent<InventoryManager>();
inventoryManager.weaponName.text = gameObject.name;
inventoryManager.ammoDisplayList.gameObject.SetActive(false);
handAnimations = inventoryManager.handAnimations;
print(handAnimations.isActiveAndEnabled) ;
handAnimations.runtimeAnimatorController = animator;
#

Cannot update the runtime controller while the Animator is being evaluated.
UnityEngine.Animator:set_runtimeAnimatorController (UnityEngine.RuntimeAnimatorController)
Tablet:OnEnable () (at Assets/Code/Player/Controller/Items/Tablet/Tablet.cs:79) -> "handAnimations.runtimeAnimatorController = animator;"

#

Im making a weapon switch, works with all items, having same on enable code in them, yet this one tends to not work

wintry quarry
inland latch
#

hi i've got these 2 lines

        unspawnedMatch.transform.SetParent(null);```
but neither do anything? unspawnedmatch has a rigid body, a parent, and a reference, the code is running, i've debugged all this already. but iskinematic is true, and the parent is not null after running this. how come?
naive pawn
#

how exactly did you debug them?

obsidian plaza
naive pawn
#

are you looking at the right object?

lucid quiver
#

can u show the full script instead of just this snippet?

wintry quarry
inland latch
#

yes, every match that spawns is kept as a parent, there is no other objects it could be with the name that's being debugged

wintry quarry
inland latch
wintry quarry
#

you haven't shared enough context yet for us to help

storm cloud
#

Hey everyone, I am not sure if this is the right place to ask or not but did anyone ever experience the player skipping through the terrain and looking this?
I am basically using ThirdPersonController starter asset and I've changed the prefab the main issue here is that most of the times its working perfectly fine with all animations hence that is why I am very confused why this issue is occuring. Thank you

inland latch
#
    private void Start()
    {
        drawer = transform.Find("MatchBoxDrawer");
        spawnPositon = drawer.transform.Find("MatchstickSpawner");

        SpawnMatch();
        
    }

    private void SpawnMatch()
    {
        if (unspawnedMatch != null)
            Destroy(unspawnedMatch);

        unspawnedMatch = Instantiate(matchPrefab, spawnPositon);
        unspawnedMatch.GetComponent<XRGrabInteractable>().selectEntered.AddListener(OnMatchGrabbed);
        unspawnedMatch.transform.SetParent(drawer);

        Debug.Log("Match spawned");
    }

    private void OnMatchGrabbed(SelectEnterEventArgs args)
    {
        Debug.Log("Match grabbed detected");
        Debug.Log(unspawnedMatch.name);
        unspawnedMatch.GetComponent<Rigidbody>().isKinematic = false;
        unspawnedMatch.transform.SetParent(null);
        unspawnedMatch.layer = LayerMask.NameToLayer("Default");
        unspawnedMatch.GetComponent<XRGrabInteractable>().selectEntered.RemoveListener(OnMatchGrabbed);

        Debug.Log("QLJHKDFWSNLKJHFESR");
        Debug.Log(unspawnedMatch.GetComponent<Rigidbody>());

        unspawnedMatch = null;

        SpawnMatch();
    }
wintry quarry
#

put these where you have the QKJDLKFJLEKJR thing

inland latch
#

it's false

#

in code and in editor

wintry quarry
#

show us

#

ok then

#

it's working fine

#

so what's your question?

inland latch
#

wait not in editor

wintry quarry
#

Which object are you looking at?

#

The prefab?

lucid quiver
#

like is OnMatchGrabbed getting called ?

#

have u checked?

inland latch
#

well yes cus all the debug logs are running

#

there is 0 other objects with the same name in the hiearchy

wintry quarry
#

show - e.g. - the full unity editor with the object selected and the inspector with rigidbody showing kinematic true and the log in the console saying it is false

inland latch
#

what u wanna se?

wintry quarry
inland latch
#

this is literally gonna show what i told u mate

wintry quarry
#

Show it

inland latch
polar acorn
# inland latch

One screenshot, full unity window. Object selected, console visible

inland latch
#

literally why, is this a "i dont trust you" thing?

polar acorn
#

Yes

inland latch
#

i don't think it's that unreasonable to not wanna show my entire project mate

wintry quarry
#

I wante4d to see the full unity editor window

inland latch
#

if you don't know how to help then don't act like you can no need to act like im just lying

swift crag
wintry quarry
inland latch
#

i have showed you what you asked to see

wintry quarry
#

WE're not accusing you of lying

#

just being mistaken

wintry quarry
polar acorn
#

Also, combine the logs into one:

Debug.Log($"{unspawnedMatch.name}'s rigidbody is {unspawnedMatch.GetComponent<Rigidbody>()?.isKinematic}", unspawnedMatch);
wintry quarry
#

the whole point is I think you are looking at the inspector for the wrong object

naive pawn
polar acorn
inland latch
#

not really? people making private games is very common

naive pawn
#
Debug.Log($"{unspawnedMatch.name}'s rigidbody is {unspawnedMatch.GetComponent<Rigidbody>()?.isKinematic}", unspawnedMatch);
swift crag
swift crag
#

If you are unwilling to show us the information we need to help you, then we cannot help you.

inland latch
naive pawn
#

if you were you wouldn't be asking here šŸ’€

polar acorn
inland latch
#

mhm indie game devs making a game is impossible

naive pawn
#

that's not what we're talking about at all

polar acorn
#

I literally do have state secrets in my projects. I literally do 3D simulations for the department of energy. I can still send screenshots of an inspector with a game object name

#

So send it

swift crag
#

asking for a friend

polar acorn