#💻┃code-beginner

1 messages · Page 756 of 1

cosmic dagger
#

Oh, I see. Wouldn't the creation method have Init inside of it already?

rough granite
#

When the function call for a collision happens add an if statement for if the tag is player and or if the tag is say asteriod

tired python
#

cus otherwise even if the spaeceship collides with other 2d objects, it's gonna create the same effect cus it can't differentiate betwenn 2d objects

rough granite
tender mirage
#

You add a if statement inside the collision trigger to compare the collisions tag

cosmic dagger
#

This is a simple unity trigger or collision method that uses tags to check which object collided. I would definitely go over some introductory unity tutorials . . .

tired python
#

i just did one tutorial, and i am adding up stuff on the game i got out of that

tender mirage
#

Remember, it's never a waste of time to watch tutorials. it's only a waste if you don't feel like working on projects anymore

#

it can be quite a powerful tool

tired python
#

dunno where that came from...

maiden drum
# cosmic dagger Oh, I see. Wouldn't the creation method have `Init` inside of it already?

In my case it's easy to solve since i can just use inheritance and have the base method call init().

I was just wondering in the case of, for example a custom animation script that needs to have values defined in order to work properly. Such script can be created from multitude of sources, then i'd have to remember than i need to call Init() every time after addComponent / instantiate.

I was just wondering if there's a better unity pattern / technological solution (like forcing the creator to call init())

maiden drum
cosmic dagger
vital barn
#

The truth is, in complex cases, there can be many of them.

maiden drum
#

Yea i know, prefabs are a powerful tool. However, sometimes the creator (there may be a better term) will know what the values are

maiden drum
# vital barn You can call random in Awake

This works if the script is self-contained, if you require info from your creator, then it'd not work (for example a bullet needing the weapon that shot it to tell it how much damage it deals)

vital barn
cosmic dagger
rough granite
tired python
maiden drum
vital barn
rough granite
vital barn
rough granite
polar acorn
cosmic dagger
# tired python So u recommend me to look up stuff myself rather than ask here for guides?

Yes and no. You always want to try/test out what you want to do first. Then if you run into issues, or problems, that's where we can help. If you don't know where to start, then we can also point you to the right direction. For example, you should look up: check tag trigger method unity. This will help you check for certain objects colliding with each other . . .

maiden drum
tired python
cosmic dagger
tired python
#

I thought u guys had a list of guides hidden somewhere

cosmic dagger
#

Nope, but the core/beginner stuff are in the pinned messages . . .

#

People will store specific links they like in bookmarks, but everyone does that . . .

maiden drum
#

I found it extremely helpful when trying to learn how to write shaders, there is practically 0 good resources there

vital barn
#

All guides are a retelling of documentation

low copper
#

I'm basically learning 90% of my stuff from youtube

cosmic dagger
arctic arch
#

Is this correct or do I have the axis swapped again?

foreach(KeyValuePair<Vector3, Terrain> t in terrainTiles)
{
    t.Value.SetNeighbors(
        terrainTiles.GetValueOrDefault(t.Key + new Vector3(terrain.terrainData.size.x, 0, 0)),
        terrainTiles.GetValueOrDefault(t.Key + new Vector3(0, 0, terrain.terrainData.size.z)),
        terrainTiles.GetValueOrDefault(t.Key + new Vector3(-terrain.terrainData.size.x, 0, 0)),
        terrainTiles.GetValueOrDefault(t.Key + new Vector3(0, 0, -terrain.terrainData.size.z))
    );
}```
cosmic dagger
#

YouTube University is highly related. Mixed reviews: yes, bad teachers: yes, but you'll find gems everywhere. It's like any other school . . .

sour fulcrum
maiden drum
wintry quarry
rough granite
sour fulcrum
arctic arch
maiden drum
# sour fulcrum There's plenty of fantastic resources on shaders

Found iit very hard to find. Some of them are like "yeah you just put this, idk why" and others are using old api.
Especially because you have hlsl + unity's own api that they bury under 5 feet of documentation and change it once in a blue moon

They're good for learning to do common things, but not api / functions. For that i found chatgpt to be way more helpful instead of digging in the documentation

arctic arch
maiden drum
#

However, they're very good to learn the basics of how gpu and shaders work

rough granite
wintry quarry
maiden drum
sour fulcrum
#

and a lot of stuff via shadergraph can be done very quickly in code

#

like any visual scripting

arctic arch
#

That has nothing to do with my question whatsoever to be exact

polar dust
vital barn
rough granite
wintry quarry
sour fulcrum
arctic arch
#

How does my code matter when I literally ask is +x assigned as left correct or false

low copper
#

I'm having trouble with storing state data for a puzzle I am building....so I have a bunch of cubes on the screen (Cube_0_0 -> Cube_1_7). Each one has a material (0,1 is fine...or "red"/blue") which has to change, a size (which doesn't change) and a position (0-15). I started with seperate arrays for teh values but that wasn't working. Now I'm trying to get a dictionary working but maybe that isn't a good idea...I don't know. I just know, when a person clicks I have a cube GameObject to work with to do the movements/material changes and I've been trying to base things off name (Cube_0_0)....however I can't figure out how to get/set data with a string as an index. Any suggestions would be appreciated

wintry quarry
#

looks like you have some of them backwards (+x and -x)

maiden drum
rough granite
scarlet pasture
#

hey whicht are the best way to move a NPC in 2d Games? or whicht options do i have and whitch would u recommend me?`Rigidbody, velocity Change... i dont know maye CharacterController, Lerp, MoveThoward etc...

scarlet pasture
rough granite
wintry quarry
scarlet pasture
#

yeah this is why i also said "what would u recommend"

wintry quarry
#

Fire Emblem enemies will move differently from Goombas

scarlet pasture
#

or what options do i have?

wintry quarry
arctic arch
scarlet pasture
#

a basic Spoider that walks, Attack and have a Distrance Shoot mechanic

tired python
wintry quarry
#

that doesn't really narrow anything down

vital barn
maiden drum
scarlet pasture
#

okay, so what options do i have?

#

to do somthing like that

polar dust
tired python
rough granite
wintry quarry
vital barn
low copper
maiden drum
vital barn
#

Not 3d a mean asset

rough granite
polar dust
vital barn
maiden drum
rough granite
tired python
scarlet pasture
#

lets say i dont wannt to use NavMash what else are ways to achive the NPC Movement

maiden drum
naive pawn
#

@arctic arch @rough granite this might be of interest to you

arctic arch
polar dust
scarlet pasture
scarlet pasture
#

i want to code but, so i can learn alot

naive pawn
zinc cedar
#

Hey guys, I have a small problem.
When I type things like Rigidbody, GameObject, or Destroy in Visual Studio, IntelliSense doesn’t show any suggestions or autocomplete.
Other C# stuff works fine, but Unity-specific classes don’t appear.
Does anyone know how to fix this?

naive pawn
#

!ide

radiant voidBOT
naive pawn
#

@zinc cedar ^

vital barn
scarlet pasture
#

not using Unity engine

naive pawn
#

they are. that's just a sign that the IDE is unconfigured

maiden drum
#

either:

  • implement your own a* with a limited depth if you're using tiles, but at that point just use a navmesh.
  • raycast a circle around you and figure out which paths are not blocked, good for "random" movement.

Just know that anything else other than implementing a pathfinding algorithm / using a navmesh won't be able to effectively bypass walls @scarlet pasture

scarlet pasture
naive pawn
#

MonoBehaviour is from UnityEngine, for example.

arctic arch
naive pawn
scarlet pasture
maiden drum
scarlet pasture
#

also restart the editor can also helps. i somthimes have the same problem

vital barn
#

Dont use VSCode pls

scarlet pasture
#

why?

#

i used it

vital barn
#

VS2022 is better

scarlet pasture
#

but why?

rough granite
#

visual studio community is just better for c#

scarlet pasture
polar dust
#

Rider is even better

maiden drum
#

all the cool boys use EMACS

vital barn
#

NeoVim is better than Rider

rough granite
polar dust
#

Us programmers love arguing about which IDE is best 😅

tired python
#

Notepad++ is king

maiden drum
tired python
vital barn
#

It took me a week to set up NeoVim.

tired python
#

like sometimes to go from one line to the other I need to press my arrow keys like hell

naive pawn
vast comet
#

thanks

scarlet pasture
sour fulcrum
naive pawn
#

i.. unironically do code in notepad sometimes

#

even for unity projects

#

well, textedit, basically the equivalent on mac

vital barn
sour fulcrum
#

are you getting paid by the hour? 😛

maiden drum
# tired python I wanna know more abt that, I don't rly use macros

Just start with defualt vim. It's not for everyone.
Essentially when you become proficient in vim sometimes you'll wish you could do something that you always do faster, hence macros.

I personally struggled a lot with following which mode i'm in. And some of it's default settings are just not that intuitive for me

rough granite
naive pawn
maiden drum
sour fulcrum
maiden drum
naive pawn
sour fulcrum
#

idk man just nicer in general 😄

naive pawn
#

im not using it in the context of large systems. intellisense and ide checking isn't really necessary

#

it's a more simplified view

grand snow
#

Its not essential but man it really helps

naive pawn
#

vim tools sometimes help too

naive pawn
rough granite
sour fulcrum
#

i have java assignments for uni rn and i wanna die

maiden drum
grand snow
#

In languages im very comfortable with i can write without aid but it really depends

maiden drum
#

I make too many typos to write without autocomoplete

maiden drum
rough granite
tired python
#

Ctrl c v

polar dust
#

Every IDE has it's own feel, most of whether X is good, is down to how you respond to using it.

Id say just test drive every IDE and you will find one that you like the most

maiden drum
#

Try punched cards. Best ide\

vital barn
cosmic dagger
maiden drum
#

unity kids complain about their IDE.
Real chads open up a game in IDA pro and create their own game via lobotimizing another

vital barn
#

IDA pro can rewrite assembly?

naive pawn
maiden drum
naive pawn
#

but yeah ive done that with discord/notes on my phone quite a few times too ngl

hot wadi
#

I have a short question: Do all coroutine yield commands force them to continue in AFTER Update() when the yield condition is fulfilled.
For example, this one only continues after the async operation is done and after Update():

{
    Vector3 offScreenSpawn = new Vector3(-100, -100, -100);
    AsyncOperationHandle segmentOp = _trackSegmentRef.InstantiateAsync(offScreenSpawn, Quaternion.identity);
    yield return segmentOp;
}```
cosmic dagger
#

I was fond of VSCode because creating snippets are easy (when I found out about them) . . .

vital barn
naive pawn
cosmic dagger
maiden drum
naive pawn
maiden drum
#

that actually got me questioning, how does unity schedule it's coroutines? is it a separate thread/worker threads or the main?

naive pawn
#

it's all on the main thread

#

otherwise unity APIs wouldn't work - they aren't synchronized

cosmic dagger
#

only main thread . . .

maiden drum
#

so only burst can really multithread

naive pawn
#

oh you can multithread all you want

#

you just can't use unity apis in other threads

cosmic dagger
#

after all Fixed Update/Update calls . . .

hot wadi
maiden drum
grand snow
#

or you use entities which is made with threading in mind

maiden drum
#

How does memory managment work in unity?
Do parallel jobs that use managed memory make requests to the main thread or do they do their own thing?

naive pawn
maiden drum
#

probably, just a question that came into my mind when reading the previous discussion

grand snow
urban ocean
#

hi guys! once I'm logged in the Unity learn site, where do i have to click for the actual courses?

slender nymph
#

Not really a code question. but you can access the pathways from the big "Pathways" button at the top. otherwise you can browse individual tutorials using the big "Browse" button at the top. You can also see your learning progress using the big "My Learning" button at the top. You can also search the site using the convenient "Search" bar at the top.

urban ocean
#

btw where can I ask those kinds of questions? Ik they aren't much about coding and I don't wanna mistake topic anymore!

slender nymph
urban ocean
#

tyy

vital barn
scarlet pasture
#

hey does sombody know why vscode formats the code wrong. it only happens when i make a swich logic

naive pawn
#

what do you mean by "wrong"

rocky canyon
#

what you mean? howso is it wrong?

naive pawn
#

perhaps show what you're talking about

naive pawn
rocky canyon
#

lol.. lazy answer

naive pawn
#

we do not need IDE elitism here

vital barn
#

Ok

scarlet pasture
#

like that

naive pawn
#

what's the difference you actually care about here

#

the break being in the block vs outside?

scarlet pasture
#

the break

polar acorn
#

they're formatted the same

rocky canyon
#

am i tripping or isnt that the exact same?

#

follow the brackets

naive pawn
#

yeah that's the same formatting. the break being outside isn't exactly a formatting thing

#

it is a style thing - just not formatting

polar acorn
#

There's no difference in how these are behaving, they're doing the exact same thing

scarlet pasture
#

but why does it looks extremly wrong when i start to code it but if i finish it it regenratet hiself

polar acorn
#

It can't know you're done writing a clause until you actually finish it

scarlet pasture
#

ahhhh so its a normal think, i thought its because of the color extanasion

#

other quastion can i make my Code editor only in Italic

#

i like that alot

#

not only syntax. Eveything

polar acorn
#

That sounds horrible

scarlet pasture
#

what no it sounds amazingf

#

i wanted that so bad bud i cant find a extansion for that

naive pawn
#

that wouldn't be an extension, would just be a font set via a theme

scarlet pasture
#

so i can do that

#

nice i will research that

weak cedar
#

Is it the general convention to have multiple canvases instead of having multiple disabled gameobjects under one canvas?

scarlet pasture
#

Italics-all-themes

#

the name of it

polar acorn
# weak cedar Is it the general convention to have multiple canvases instead of having multipl...

In general, more canvases is better. Whenever something on a canvas changes, the whole canvas gets repainted, so having a lot on one canvas can actually compound into some significant performance loss. For performance reasons, the ideal UI has a canvas for every individual element, but that gets unwieldy really fast. So, try to strike a balance between having sensible groupings for your own sanity and not putting all your eggs in too few baskets.

rocky canyon
#
    "textMateRules": [
        {
            "scope": [
                "comment",
                "string",
                "keyword",
                "variable",
                "entity.name.type",
                "entity.name.function",
                "constant",
                "storage",
                "support",
                "markup"
            ],
            "settings": {
                "fontStyle": "italic"
            }
        }
    ]
}```
#

then you can keep any theme you're already using (i think for the most part)

rocky canyon
analog drift
#

heyyy, so i tryed to make movement in 2d and this is the code for left and right but my player does not move

naive pawn
#

!code

radiant voidBOT
naive pawn
#

post it properly please ^

#

and again, do you have any errors or warnings?

analog drift
#

here

naive pawn
#

!input

radiant voidBOT
# naive pawn !input
How to Set Input

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

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

analog drift
#

??? where now

vital barn
analog drift
vital barn
#

Also unity will restart after change

analog drift
#

thanks for info

#

LETS GOOOOOO IT WORKS

rocky canyon
#

EZ

scarlet pasture
#

hey can sombody pls help me, i use this Gizmos and want t change the color the green when the enemy is on the Ground; ``` private void OnDrawGizmos()
{
if (!useGizmos || RayCastOrigin == null) return;
{
var c = Color.white;
if (isGrounded == false)
{
c = Color.red;
}
else if (isGrounded)
{
c = Color.green;
}
Gizmos.color = c;
Vector3 start = RayCastOrigin.transform.position;
Vector3 end = start + Vector3.down * GroundCheckDistance;

        Gizmos.DrawLine(start, end);
    }
}```
#

for me its lookin really good and i cant find the problem there

naive pawn
#

have you tried logging some relevant values

analog drift
naive pawn
#

-# btw, that could be simplified to if (!isGrounded) ... else ... rather than the else if, or even mroe so into a ternary

naive pawn
radiant voidBOT
naive pawn
#

and do share the error please, we aren't psychic

scarlet pasture
#

okay i can make a tenery operator for this u right

vital barn
scarlet pasture
#

bro i understand sorry i just forgett that

analog drift
scarlet pasture
#

wait does OnDrawGizmos updates himself even?

#

does the if even runned?

#

maybe i need to put it inside of onvalidade

naive pawn
#

well, that would be easily checkable with a few Debug.Logs

vital barn
naive pawn
analog drift
scarlet pasture
#

my bad bro forget to check that out first

vital barn
#

if (!Grounded) and if (Grounded)

naive pawn
#

also, configure your ide

#

!ide

radiant voidBOT
naive pawn
#

@analog drift ^

slender nymph
analog drift
#

brb gtg eat

scarlet pasture
#

it worked

#

the gizmo only gets green if its on runtime

#

i thought i can use it even in the editor

#

for that case i need onValidate right?

charred monolith
scarlet pasture
#

2d Metroid Venia

naive pawn
scarlet pasture
#

what do u mean?

#

did i somthing wrong

naive pawn
#

OnValidate isn't for drawing gizmos

scarlet pasture
#

ahh i didnt understand u correctly, i thought u are angry at me haah

naive pawn
scarlet pasture
#

so what exactly can i do for this case? do u have a recommendation

scarlet pasture
naive pawn
scarlet pasture
#

thanks g

naive pawn
#

what exactly are you using this for? it kinda seems like you'd want Debug stuff for this rather than Gizmos

scarlet pasture
#

i wanted to see is the Enemy Grounded

#

and...

naive pawn
#

that's for checking if you're in the editor (vs a build), not for checking if you're in edit mode (vs playmode)

scarlet pasture
#

i wanted to learn more about Gizmos

scarlet pasture
#

not in the game runtime

naive pawn
#

that's still in the editor

#

just play mode instead of edit mode

scarlet pasture
#

its would look cool i think

naive pawn
#

ok no you're misunderstanding

scarlet pasture
#

again?

#

dayumn

naive pawn
#

gizmos only exist in the editor

#

the "runtime" you're describing is edit mode vs play mode

#

#if UNITY_EDITOR won't change anything, you've been in the editor the entire time, even in "runtime" (play mode)

scarlet pasture
#

at this point i just test it out on play mode gang 🥀

naive pawn
#

not sure if you can see stuff drawn by Debug in edit mode, but if you can, that'd probably be the solution

scarlet pasture
#

sure

analog drift
scarlet pasture
#

hey im not sure if this is okay to post it here but can sombody maybe tell me what this is? i have this along time

scarlet pasture
analog drift
vital barn
scarlet pasture
analog drift
#

i got error

scarlet pasture
naive pawn
#

there's an else there that doesn't have an if

naive pawn
# radiant void

configure your ide first. ^
this is a necessary step. @analog drift

analog drift
scarlet pasture
slender nymph
#

it's only showing basic c# syntax errors. it is not fully configured

naive pawn
analog drift
#

but now 2 error

naive pawn
#

yeah that's not how you were supposed to fix it

analog drift
polar acorn
#

What is the condition you are intending to invert

naive pawn
#

@analog drift clearly you don't understand c# enough to fix the basic issues at this point. don't do random things hoping that'll work, that'll just waste a ton of your time.

firstly, configure your ide.

then, go look at what the tutorial is doing more closely.

analog drift
#

what is a IDE (lol)

polar acorn
radiant voidBOT
naive pawn
#

one of the above in the list

#

looks like vscode

analog drift
#

Visual studio code

naive pawn
#

(note that visual studio code is not the same as visual studio)

#

click the vscode link above and go through configuring your ide

analog drift
naive pawn
#

completely different apps that microsoft named similarly for some reason. blame microsoft

polar acorn
naive pawn
vital barn
analog drift
#

@naive pawn

#

what now @naive pawn

naive pawn
#

ive given you instructions already

#

please don't excessively ping random people

analog drift
#

oki dokey

#

sry

rocky canyon
# analog drift but now 2 error

fix ur ide
but basically you have:

if(condition)
{
  DoThing();
  
  else if
  {
    DoOtherThing();
  }
}```
when it should be something like:
```cs
if(condition)
{
  DoThing();
}
else if(anotherCondition)
{
  DoOtherThing();
}
else
{
   // Neither Condition was met.. run else
}

or with a basic if/else like:

if(condition)
{
  DoThing();
}
else
{
  DoOtherThing();
}```
every opening bracket `{` must have a closing bracket `}`
and they must be locating in the correct place..
*pay more attention to the tutorial*
capitalization matters.. `Transform` is not the same as `transform`
also the structure / syntax of the code must be correct

having an IDE and configured will help greatly with these issues..
naive pawn
# radiant void

again, configure your ide. there are instructions here. click the link corresponding to your ide

rocky canyon
#

with the IDE ^ it'll tell you like here

#

comments are misleading (sorry)
b/c you can also use the if to check if a condition is false..
if(condition == false) or if(!condition)
and then the top portion would be if false and the second part would be the else true

vital barn
#

It's probably worth trying to make neovim friends with unity

rocky canyon
#

lol.. ngl, not sure how useful it is but coding inside the PowerShell looks pretty cool 😄

analog drift
#

oki dokey i fixed it (you fixed it) (lol)

rocky canyon
#

just jot down a note to urself..
and get that ide configured 😉

vital barn
analog drift
rocky canyon
#

b/c its toggling between the two conditions u wrote out

naive pawn
#

have you configured your ide or not

#

if so, share code - and do so properly this time

#

if not, go configure your ide

#

it is a requirement to get help here

analog drift
#

but what do i do with it

naive pawn
#

configure it

analog drift
#

how

naive pawn
#

if only there were instructions that have been given to you multiple times

analog drift
#

ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

#

sry i am so dumb

#

oki dokey yup had it configured from the beninging

naive pawn
#

it was not configured in the beginning

#

what color is Input

analog drift
#

lemme check

#

light blue

naive pawn
#

it's not configured

analog drift
#

awwwww man

naive pawn
#

have you installed .net with the install tool

analog drift
#

i thought its the extension

naive pawn
#

there are additional steps afterwards

analog drift
naive pawn
#

you've installed the .net install tool, correct?

analog drift
#

lemme check

#

pls remind me that the name of the .net file is

#

send me a screene

#

im sooo sry i am so dumb

rocky canyon
analog drift
#

OKI DOKEY

#

sry caps

#

oki dokey

#

lemme check

#

yup

#

got it

vital barn
naive pawn
#

and have you actually installed .net using it

#

command palette > install .net

analog drift
naive pawn
#

ctrl + shift + p

analog drift
#

it is downloading

#

Downloading .NET version(s) 9.0.306-global~x64 ............

#

lol why so many dots

#

Downloading .NET version(s) 9.0.306-global~x64 ..........................................

#

lol

naive pawn
#

it's the progress bar

tender mirage
#

I need some help here. i'm using contacts to check if the player hit the ground and not the wall to properly set the state

but then this causes a bug where oncollision enter and exit trigger at the exact time when they're suppose to trigger like different sides of the same coin.

private void OnCollisionEnter2D(Collision2D collision)
{
    //Get contact point
    Vector2 contactPos = collision.GetContact(0).normal;

    //If player touches ground
    if (contactPos == Vector2.up)
    {
        //Fire event
        playerEnterGround.Invoke();

        isGrounded = true;
    }

    //Kill speed if hitting wall
    if (contactPos == Vector2.right)
    {
        blockedDirection = "Left";
    }
    else if (contactPos == Vector2.left)
    {
        blockedDirection = "Right";
    }


}


private void OnCollisionExit2D(Collision2D collision)
{

    print("collisionExit triggered");

    //Fire event
    playerLeaveGround.Invoke();

    blockedDirection = "None";

    isGrounded = false;
    
}
naive pawn
#

would you ever be on top of the wall? if not, perhaps consider making that a different layer

tender mirage
#

Layer?

naive pawn
#

also, you shouldn't use magic strings. do you need blockedDirection in general? dynamic rigidbodies can handle that on their own

tender mirage
naive pawn
# tender mirage Layer?

physics layers, to define the wall and ground as separate layers
then you can use a layermask to check if you collided with the ground

#

you can reduce or remove friction to solve that

tender mirage
naive pawn
tender mirage
#

Yeah, the inbuilt tilesets can have some limitations, so i've heard.

#

but it can also be pretty powerful

#

if used correctly.

naive pawn
#

in the past when ive been working in 2d sidescroller contexts with tilesets, ive just used a cast for the ground check

analog drift
#

why taking so long to install

tender mirage
#

yeah, sadly i havn't gotten into raycast yet, although that should definitely be in my todo list.

analog drift
#

lol dead chat

naive pawn
#

yeah we do not need this spam

analog drift
#

lol

polar acorn
analog drift
#

nooooooooooooooooooooooo

naive pawn
#

ok, what is the actual error

#

do you want help or not

analog drift
#

ok

rich adder
#

show the full error

analog drift
#

just a sec

rich adder
#

does that "tool" ever work ?

#

just download the exe manually lol

naive pawn
#

so sounds like your internet wasn't able to download it within 10 minutes?

naive pawn
analog drift
#

should i try again

polar acorn
# analog drift

Pretty sure you can click the box with the red X and see the full error

naive pawn
#

it's saying there was a pop-up prompting you to install .net, did you get that

naive pawn
#

or if your internet isn't super good such that you'd expect an install to take more than 10 minutes, then increase the timeout as the output says

analog drift
naive pawn
#

i guess that's just because it doesn't have .net

rich adder
naive pawn
#

you couldve just.. said whatever you were going to say without making me wait

analog drift
naive pawn
#

in settings, search ".net install timeout" and increase the value, it's in seconds

analog drift
#

oki dokey

#

oki dokey i put 1 hour

naive pawn
#

doesn't seem like a code issue to me

rough granite
#

Yeah id ask in a proper channel but im not seeing this "jitterish"

rich adder
#

mipmap or antialiasing issues

analog drift
#

oki dokey @naive pawn i got it installed now what

rocky canyon
# analog drift why my eyes do this

For flipping your sprite or scaling your graphics, you don’t need to overcomplicate it as a beginner..
Simply say:

  • if input is right → face right FlipToFaceRight();
  • if input is left → face left FlipToFaceLeft();

The issue with using a single Flip() method is that it usually tracks the last direction internally and only flips when the direction changes. that way if youre already facing the way youre moving it wont flip the wrong direction.. this will add extra steps and make the if condition more complex than they need to be (especially for beginners)..

and this is where you're issue is likely coming from... with that setup you need to Flip only when its a new direction which means you actually have (2) conditions for each state... (so if ur already facing left and go to move left.. it shouldn't Flip)
in your case you'd just need to iron out that logic or 👇

  • A simpler approach is to use two separate methods: FlipToFaceRight() and FlipToFaceLeft(). This keeps the logic straightforward and easier to understand as a beginner..

when ur input is left <- you FlipToFaceLeft(); this would work regardless if you are already facing left or if you are facing right

example code to match video clip 👇 https://paste.myst.rs/2gktd930

lusty tulip
#

Hello! I'm unsure if my question falls into code or perhaps render? So redirect me if needed I'm understanding.
I'm attempting to make a cute little 2D game just something I can play idly on my desktop the issue I am having is I'm trying to follow code monkeys tutorial for a transparent background, however, for some reason despite doing the script and changing the camera alpha to black - 0 and some other player related settings. It still appears black and in full screen mode (I've changed the settings to fullscreen windowed and nothing came of that either so unsure.)

rich adder
lusty tulip
#
  • As a note, I've never touched anything like this before so I'm a total beginner with zero clue what half of this stuff means. But I love bitting off more then I can chew so I'll suffer. x'D
lusty tulip
analog drift
rich adder
analog drift
naive pawn
#

let it load for a sec, you should see stuff highlighted correctly now

lusty tulip
analog drift
#

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

rocky canyon
# rocky canyon For flipping your sprite or scaling your graphics, you don’t need to overcomplic...

if u want to keep the way u have just make sure to log the values and stuff you are reading and using... and make sure the logic makes sense

        if (moveInput > 0 && isFacingLeft) // our input says right, but we're facing left soo go ahead and flip

        if(moveInput < 0 && isFacingRight) // our input says left, but we're facing right soo go ahead and flip

        if(moveInput > 0 && isFacingRight) // our input says right, but we're already facing right soo don't flip anything

        if(moveInput < 0 && isFacingLeft) // our input says left, but we're already facing left soo don't flip anything
analog drift
#

ITS BIUTIFULLL

naive pawn
#

there we go

rocky canyon
#

using his conditionals yea

rich adder
scarlet pasture
#

i do it lika that

#

itsthe samne

rocky canyon
#

if ur moving right and facing left -> flip right
if ur moving right and already facing right -> flip right for the hell of it

lusty tulip
analog drift
naive pawn
#

man, try to pay some attention to the chat

naive pawn
#

spawn's been giving you a ton of advice on the flipping

#

i mean, you were told to configure your IDE, with pings, several times before you noticed 😂

rocky canyon
analog drift
#

oooo sry

#

didn't see that

#

mb

rocky canyon
#

take a bit of time to read thru it.. check out teh video.. check out the script sample i gave.. and the comments

lusty tulip
#

Knowing me, my adhd brain is just going brr and I'm missing something obvious lol

rocky canyon
#

also Log the heck out of ur script..
when those conditions run.. log code u can read in the console to make sure its doing what u expect it to be doing

#

my guess is ur simply not updating the facingRight boolean once u do end up facing right..

should go like

{
    Flip();
    facingRight = true;
}```
naive pawn
#

(i mean, it might be done inside Flip)

rich adder
# lusty tulip

alright the DXGI flip seems unchecked which should be ok..
and where did you place the script, which gameobject

naive pawn
#

can't say without seeing the full code there

rocky canyon
#

possibly.. was just a guess tho..
clearly the conditional is fighting itself tho

lusty tulip
shell sorrel
#

it gets way simpler if you just ditch flip and just always apply the correct scale when facing that way

#

instead of ending up in cases where you could flip at the wrong time

rocky canyon
#

^ true story

rocky canyon
#

facing right = +1 on the x
facing left = -1 on the x

#

ez pz.. no way to screw it up

rich adder
lusty tulip
naive pawn
#

make sure to save

analog drift
#

ahhhhhhhhhhh😩 ima just make the face not look lef tor right but to the player

naive pawn
#

it's not that complicated mate

#

if you're following a tutorial, just make sure to follow it accurately

lusty tulip
#

..>3> making me anxious to input my characters

#

lol

scarlet pasture
#

hey do sombody know why my enemy dont move to the player? if (useMovement) { Vector2 newPos = rb.linearVelocity + DistanceToPlayer * MoveSpeed * Time.fixedDeltaTime; rb.MovePosition(newPos); }

rich adder
# lusty tulip

could you try this

[DllImport("User32.dll", CharSet = CharSet.Unicode)]
public static extern int MessageBox(IntPtr hwd, string lpText, string lpCaption, int uType);```

in start
```cs
int result = MessageBox(IntPtr.Zero, "Hello! World", "My Message ", 0);```

just incase here is the full script that works for me
<https://paste.mod.gg/rrbaovtlfdrc/0>
naive pawn
#

choose one or the other, not both

scarlet pasture
#
        {
            Vector2 newPos = rb.position + DistanceToPlayer * MoveSpeed * Time.fixedDeltaTime;
            rb.MovePosition(newPos);
        }```u mean i should use this
naive pawn
#

DistanceToPlayer also doesn't make sense to be there

naive pawn
#

nowhere in my message did i mention position

scarlet pasture
#

u mean the distance check?

naive pawn
#

you gotta stop extrapolating, man

scarlet pasture
#

extra what?

naive pawn
#

i didn't mention rb.position at all, yet somehow you assumed that i was telling you to use that

#

you should stop making those random assumptions

scarlet pasture
#

bro i just thought that this would bne the problem

naive pawn
#

the problem is most likely using velocity and MovePosition together

#

how are you mainly moving the enemy? with velocity or MovePosition?

scarlet pasture
#

with MovePositiom

naive pawn
#

alright then let's go with that

#

what is DistanceToPlayer supposed to be

#

that should not have a bearing on the movement - only the direction should be accounted for

scarlet pasture
#

its the distance between the player and enemy so i can stop him

naive pawn
#

it's a float?

#

that would be invalid

scarlet pasture
#

the logic for the stop i need tu make in a if, but currently i only want to know why he is not moving

scarlet pasture
naive pawn
rich adder
scarlet pasture
#

i used this

#

delta

naive pawn
scarlet pasture
#

my code snipped

rich adder
scarlet pasture
#

also the variabel

naive pawn
#

it's the right value, just named incorrectly, then

scarlet pasture
#

i mean i can name it how i cant

#

want

#

but i get what u mean

naive pawn
#

doesn't make it correct

scarlet pasture
#

yeah

naive pawn
#

words mean things

rocky canyon
# naive pawn it's not that complicated mate

they're moving too fast.. simply put..

but i do not know how to code movement and ive tryed to add movement for 3 day's now..

they ignored the Learn suggestions went straight to a tutorial I posted (trying to give them a basic one)

then very shortly after they had issues from that tutorial just b/c the syntax and stuff was poorly copied

scarlet pasture
#

for me it makes sense

#

the words

naive pawn
rocky canyon
#

they'll have to slow down, get serious to progress

naive pawn
#

you'll just be confusing yourself

scarlet pasture
#

DistanceTo..

naive pawn
#

see the issue?

scarlet pasture
#

not really tbh

#

what is a better name?

naive pawn
#

you're naming 2 vastly different things, the same thing

scarlet pasture
#

hmmm u right

naive pawn
scarlet pasture
#

ahhhh directionTo..

naive pawn
scarlet pasture
#

whould that make more sense?

naive pawn
#

yeah

scarlet pasture
#

okay, i understand what u mean

lusty tulip
#

can you show your camera setting real

scarlet pasture
#

and the Enemy movement should now function, i will test it out

naive pawn
scarlet pasture
#

do u mean me?

#

if yes i did debuged the current speed of the enemy and isallowed to move. it works

rocky canyon
# scarlet pasture ahhhh directionTo..

here's a little snippet that may be useful to you

  • Vector -> (points from a -b) (has magnitude and direction)
  • Distance -> (taking the magnitude strips out the direction leaving only the distance)
  • Direction -> (normalizing strips out the distance leaving only the direction)
void Start()
{
    Vector2 a = new Vector2(0, 1);
    Vector2 b = new Vector2(2, 3);

    Vector2 vectorTo = b - a;
    Debug.Log("VectorTo (direction + distance): " + vectorTo); // (2, 2)

    float distanceTo = vectorTo.magnitude;
    Debug.Log("DistanceTo (magnitude only): " + distanceTo); // ~2.828

    Vector2 directionTo = vectorTo.normalized;
    Debug.Log("DirectionTo (normalized direction): " + directionTo); // (0.707, 0.707)
}``` little cheat-sheet that helps spot the differences between them, i used something like this for a while before i started knowing it by heart
rocky canyon
#

yessir

scarlet pasture
#

does sombody knows why my [Header] somtimes dont work?

polar acorn
#

You've put the header on isGrounded and then told it not to draw isGrounded

grand badger
cosmic dagger
#

You must place the header on a field that is drawn (serialized) in the inspector . . .

grand badger
#

so, basically, when you do [Header(..)] public bool someField;, Unity will consider the header when it has to draw that field

scarlet pasture
#

so i need to change the "IsGrounded" with somthing thats actually using [SerializeField], and not a [HideInInspektor]

polar acorn
rocky canyon
scarlet pasture
rocky canyon
#

che chada 👍

scarlet pasture
#

thanks

grand badger
#

how many seconds for float maxvalue

The maximum value for a standard 32-bit single-precision float is approximately (3.4\times 10^{38}) seconds.
To put this number into perspective: This is far greater than the estimated age of the universe, which is roughly (4.3\times 10^{17}) seconds.

#

oh wow!

#

that has to be inaccurate, right?

rocky canyon
#

math checks out 👍

grand badger
#

so, assuming the universe is made with 32-bit architecture, we have quite long way to go

polar acorn
slender nymph
# grand badger that has to be inaccurate, right?

the only inaccuracy is implying a float can accurately count through each of those seconds. with it needing to represent all of the individual numbers with only 32 bits there will be inaccuracies. but otherwise yeah the math is correct there

rocky canyon
grand badger
#

Unity calculates time as double anyway ^^ we can get Time.timeAsDouble or something

grand badger
slender nymph
rocky canyon
#

im just reading it to be reading it.. (i'll never need to calculate to such extremes)

rocky canyon
grand badger
#

well, technically, precision would likely start be getting within the ns range within the 9h

#

for ms range where it actually matters, we shouldn't have an issue until much later -- maybe months

rocky canyon
#

neat 🙂 lol

#

@grand badger u just doing a thought experiment.. or you got some really crazy timers planned out?

grand badger
#

my humor is exhausted since 2h ago which is the timepoint I typed something really really funny :p

#

I just didn't wanna run out of milisecond precision with a Time.time approach for an idle game -- it just needs to support multiple days of uptime

#

so was considering whether I should refactor that early instead of building more stuff on it.. but seems it's safe to keep ^^

#

Hm actually, screw that -- I'll just switch to double ^^

scarlet pasture
#

Hey, can sombody help me. Currently my Spider Spits at the Player but at the wrong time. he is only allowed to Spit if he is in idel or None (none is jus 1 frame or somthing long). but the DebugError is fired consitenty. Did i do somthing wrong with my if Check? => ``` private void Update()
{
DetectDistanceToPlayer();
if (distanceToPlayer <= SpiderCombatSystemRef.startBiteDistance) //Nah
{
SpiderCombatSystemRef.currentAttackMode = SpiderCombatSystem.AState.Bite;
return; //To make sure nothing other triggers
}
else if (distanceToPlayer >= SpiderCombatSystemRef.startSpitDistance && (spiderBrainScriptRef.currentState == SpiderBrain.BrainState.Idle || spiderBrainScriptRef.currentState == SpiderBrain.BrainState.None)) //Fern
{
Debug.LogError("Ich bin in Spit Mode!");
SpiderCombatSystemRef.currentAttackMode = SpiderCombatSystem.AState.Spit;
return; //To make sure nothing other triggers
}
}

#

if the AState is => Spit the Combat Script handles that. it also working perfectly finde, i build there a Switch case. But i dont know why the Method is firing Consitenty. i thought about also making a MAX Distancte.

#

in my MovementScript it also changes the States correctly bewteen, NONE => IDLE => WALK

polar acorn
scarlet pasture
#

if needed i can post the Spiders Movement Code!

scarlet pasture
#

give me a sec

scarlet pasture
#

even i maked sure that all Statesments are not true in the if check

#

i thought about a boolien flag just for this case but i really want to understant what i make false here

polar acorn
slender nymph
#

consider logging the current value of each condition you are checking to find out which is true

polar acorn
#

You should log the values of them to see which condition is true

scarlet pasture
#

i mean i do have a Inspekor field that tells me the current State

scarlet pasture
#

hmmm, i definetly do somthing wrong. i dont think unity can make "somthing wrong"

#

i wish i would know, but we all can say the problem need to be i "SpiderBrain"?

polar acorn
scarlet pasture
#

what do u mean? boxfriend

slender nymph
#

did you read what those messages said?

scarlet pasture
#

thank u no

#

i didnt saw it

#

but i logged alot

slender nymph
#

where

scarlet pasture
#

i delete them, i only allow one Debug per time so its dont get messy

#

i debuged the current state

#

and if the enemy was near a boolien flag that says true

polar acorn
slender nymph
#

did you know that you can put more than a single piece of information into a log message?

scarlet pasture
#

i also have a inspektor field that says the current State

scarlet pasture
#

didnt now that

#

what is the syntax

#

i wat to learn that

#

just a "+"?

rocky canyon
#
     public void LoadFromDisk()
        {
            if (File.Exists(savePath))
            {
                string json = File.ReadAllText(savePath);
                saveData = JsonUtility.FromJson<SaveData>(json);
                // → is it possible that the saveData could be null here?
                // → or fail somehow? considering using a Try/Catch although I never have before
            }
            else
            {
                // stim: no save data || rflex: create immediately with Defaults
                saveData = new SaveData();
                SaveToDisk();
            }
        }```
❔ looking for some advice from those experienced with load/save systems
im not trying to make something revolutionary or anything but someone pointed out 
"what if the JsonUtility fails at reading/assigning my `saveData` var".... 👀
#

i mean.. i didn't know thats a possibility.. but now im curious if i should have some type of failsafe or something

polar acorn
scarlet pasture
#

i logged whicht current state the enemy has and is the player near/far away

#

enaugh

scarlet pasture
#

i loged the distacne check with a invoke method every 0.3f sec

#

and the currentstate every time if its changed

#

i printed the current state if it chenge it and is not what it was befor

slender nymph
#

log the useful information at the time you check it

polar acorn
#

How about you log the values inside the condition that you are checking

scarlet pasture
#

i did, currentState is one of them

scarlet pasture
slender nymph
#

then do it now and show the information

scarlet pasture
#

slow?

#

what do u mean the invoke method?

slender nymph
#

i mean show the fucking logs

scarlet pasture
#

dayumn chill

polar acorn
#

just show the code for where you put the log and what it printed

scarlet pasture
#

like i said befor, i print one think, if i think that i "dont" need them anymore i delete them

#

i can write it again?

#

okay?

slender nymph
#

that is literally what we are telling you to do. please actually pay attention to what people are telling you if you want to get your issue resolved

scarlet pasture
#

what did i do wrong again, i listen to u

slender nymph
#

if you were actually listening, then show the logs

polar acorn
#

and show the code

#

and what it prints

scarlet pasture
#

okay i will code it again

#

i did the currentState public in the inspektor so u can also see it better what i mean because my englisch skills are hella chopped

#

here u can see the currentState

#

i also can make it for the Distance check if needed#

slender nymph
#

can you actually try logging useful information like we've been telling you this entire time

polar acorn
slender nymph
#

stop using the inspector to debug the info, log the info when you actually check it

scarlet pasture
#

okay wait

#

i can debug them also no problem

#

one sec

polar acorn
scarlet pasture
#

why?

polar acorn
#

that's why we've been saying log it

polar acorn
scarlet pasture
#

okay, yeah u right

polar acorn
#

Log the value at the time you want to know it

scarlet pasture
#

i debug them wait

polar acorn
#

so you don't just guess

scarlet pasture
#

the logs with the exact time

slender nymph
#

log the values when you are checking them for your if statement. these logs you are currently showing are entirely useless

polar acorn
# scarlet pasture

I don't know what the time is for. Which of these logs is the one that's inside the if condition you're checking?

scarlet pasture
#

guys one quastion

#

whould that be fixable if i say in the method return if its the false state

#

if he is in Walk return

#

would fix that tbh

slender nymph
#

how about you actually do what we asked and log the relevant info instead of trying random shit

scarlet pasture
#

dayumn bro

#

dont be so angy at me

#

chill out

slender nymph
#

at this point, since you refuse to do anything we are trying to actually get you to do, i am just going to assume you are trolling.

polar acorn
#

If you're not going to actually do any of the things we ask what's the point in asking

scarlet pasture
#

bro i dont know the code of the debugs

#

this is the problem

#

i dont now the syntax of it

polar acorn
#

inside the if statement

slender nymph
scarlet pasture
slender nymph
#

there isn't some magical special syntax that only applies when we ask you to do something. it's still just logging information, you just need to log the relevant information in the correct place like we've asked you to half a dozen times now

scarlet pasture
#

u mean that am i correct?

polar acorn
scarlet pasture
#

okay wait

#

WTF

#

no logwarning??

slender nymph
#

you need to actually save your code and re-enter play mode

polar acorn
#

So, it's never running at all

slender nymph
#

then congrats. your else-if statement is never true

scarlet pasture
scarlet pasture
polar acorn
slender nymph
#

if those logs never run, then it isn't this code that is assigning that state

scarlet pasture
#

but bro why does that one Debug fired even i clearly said u only allowed to shoot if u Atack Mode is "Spit"

#

this is so confusying

slender nymph
#

presumably some other code is causing it

polar acorn
#

If it's logging that one, then it's calling PerformSpitAttack. The logs you put are somewhere else, and that code is never running

scarlet pasture
#

but this is the only line where the states chaged to Spit

#

anyways. i now what to do now, but this was actually very hard to understand for me

#

thanks u two

polar acorn
unique spear
#

I have a problem - the red dot is supposed to look where it's going but as seen on the video it is blocked by something
here's the code:

{
    Vector3 rawDir = target - transform.position;
    float sqrMag = rawDir.sqrMagnitude;

    if (sqrMag < 0.0001f)
        return;

    Vector3 direction = rawDir.normalized;

    float targetAngle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;

    float zAngle = targetAngle - 90f;

    Quaternion toRotation = Quaternion.Euler(0f, 0f, zAngle);
    transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, rotateSpeed * Time.deltaTime);

    transform.position += direction * enemy.speed * Time.deltaTime;
}```

(the function is also in charge of moving the red dot)
radiant voidBOT
wintry quarry
#

How is this behavior differing from your expectations?

#

Does this red dot object happen to have a Rigidbody2D on it or something?

wintry quarry
#

If so, you are doing this all wrong.

You should never directly modify the position or rotation of a Transform directly when you have a Rigidbody2D

#

You need to move and rotate via the Rigidbody

unique spear
#

oh ok, i'll try that

wintry quarry
#

The weirdness you're seeing is because the object is colliding with the wall which is imparting an angular velocity on the object. So you are fighting that natural rotation every frame

unique spear
drowsy flare
#

What's the correct way to work with directions in unity? I've been using Vector2.MoveTowards and similar, but now I want to move an object in the direction of another object and past it.

grand snow
#

well if you have a normalised direction you can use that instead of MoveTowards()

drowsy flare
rough granite
slender nymph
#

that's still fighting against the rigidbody unless you are just using the navmesh for the pathfinding and doing the actual movement with the rigidbody

rough granite
slender nymph
#

note that NavMeshAgent is a specific component and the NavMesh is the actual navigation mesh. you are referring to using a NavMeshAgent, which wouldn't be needed if you were just getting paths from the navmesh

rough granite
#

Using the agent

#

Or well was but have switched to a completely different system and was curious about it

gray cobalt
#

Hello, i have a rigidbody(player) that has movement and jumping fine with script ,now when i collide with another collider(house for example) if i force it too much it goes into the box collider where could be the problem?this happens when i jump hold w it goes slowly into the collider

charred monolith
slender nymph
#

and ideally the rigidbody/collider(s) involved

gray cobalt
slender nymph
#

!code

radiant voidBOT
rich adder
#

MovePosition is gonna phase right through everything

rough granite
rough granite
rich adder
#

thats not gonna help here at all on kinematic

#

if its not set to kinematic, then don't use .MovePosition

rough granite
#

Also feel like theres the problem with using deltatime in the rigidbody no?

rich adder
#

normally yes, on MovePosition is fine (assuming its kinematic)

slender nymph
#

we can tell that this rigidbody is not kinematic on account of it using forces for jumping

rich adder
#

true true. then MovePosition is the wrong function completely

rough granite
rich adder
#

the non-kinematic is probably wats causing some collisions to work, but not completely because of MovePosition

gray cobalt
keen fiber
#

Im using this for my player detection:

Vector3 rayDirection = player.position - transform.position;
rayDirection.Normalize();

bool playerSeen =
  Physics.Raycast(transform.position, rayDirection, out RaycastHit hit, detectionRange) &&
  hit.collider.CompareTag("Player") &&
  Vector3.Dot(transform.forward, rayDirection) > Mathf.Cos(60f * Mathf.Deg2Rad);

It seems like it works, but I'd like to know if there's a better way to do this or if this is fine on its own.

rich adder
#

if it works its fine

warm escarp
#

Every time i start a animation this model enter in the ground, how i make him to stay in the T-pose?

grim sorrel
#

why don't I have "OnDrag" event ?

vital otter
#

Never used it tho, so take it with a grain of salt

grim sorrel
vital otter
grim sorrel
#

apparently I have to activate something but idk what

grim sorrel
#

that we can move

#

2D

#

and I want to move our camera with the middle mouse

vital otter
#

Oh, idk then. Maybe its either an interface or it has a parameter?

grim sorrel
#

for now it's this but I can't use OnDrag

rich adder
#

OnDrag is meant for eventSystem

grim sorrel
#

oh

rich adder
#

and it only works on UI items unless the Physics Raycaster is used on camera

slender nymph
#

your issue isn't that you don't "have" OnDrag, your issue is that you aren't declaring a body for the method

grim sorrel
#

I just started 2 days ago idk wtf am I doing

slender nymph
#

you're copying this code from a tutorial, yes?

grim sorrel
#

I'm trying to understand with it

#

but I'm blocked with the OnDrag system and the guy just doesn't explain how can I get it

slender nymph
#

pay better attention to the tutorial. you aren't being "blocked", you copied it wrong

grim sorrel
#

I just checked the comments other guys are saying the same things

slender nymph
#

link the tutorial

grim sorrel
#

someone said this

grim sorrel
# slender nymph link the tutorial

A simple way to drag your camera in Unity 2D using the New Input System.

In case you want to know more about how to set up the new Input System, I have a video here: https://youtu.be/WNV9l04s8t4

Let me know if you need help with anything!

The script: https://github.com/chonkgames/Drag-Move-a-Camera-in-Unity-2D/blob/main/CameraDrag.cs

► Sub...

▶ Play video
slender nymph
dreamy scarab
#

There is any way to check via scripting if editor is playing by editor tag?

currently im using if(Application.isPlaying) to check if the editor is playing
and i know i can filter final build / editor build with #UNITY_EDITOR on the script...
but there is a #UNITY_ISPLAYING tag?

slender nymph
rich adder
#

oh thats not even the OnDrag from UI... thats a custom Action

slender nymph
dreamy scarab
#

ok

#

tks

grim sorrel
polar acorn
slender nymph
# grim sorrel thanks I'll pay more attention next time

you should also consider learning the basics of the language. there are beginner c# courses pinned in this channel, start with those so you understand how to actually write a method. that way, when someone immediately points out your issue, it doesn't take several more minutes of back and forth (and then pointing you back to the tutorial you are copying from) to actually fix it

vital otter
vital otter
grim sorrel
#

oh ok

rich adder
slender nymph
rich adder
#

fiddling in the IDE alone will do nothing

#

basic c# / unity courses will go a long way

vital otter
rich adder
slender nymph
#

this has already been answered, you should have actually read the responses to you

gray cobalt
#

@rich adder using linearvelocity instead of position solved it thank you !

calm cargo
#

Hey guys, how do people who take C# and OpenGL courses learn the Unity API? I'm learning C# in a course.

radiant voidBOT
rich adder
#

& 👇

radiant voidBOT
tired python
cosmic dagger
tired python
#

@cosmic dagger

tired python
#

one of them apparently did not change

cosmic dagger
#

Yeah, if it bounced off then I'd think it wasn't set . . .

uncut tide
#

And I using only poligone collider

#

it a prototype for all that object they have a Three script ONE for the merge one for the comportement and the last one is about the physics jelly

#

and plus the softbody

rough granite
uncut tide
#

so I will wait someone how can give me a valuable advice

rough granite
uncut tide
#

I write here because I know my probleme is note from physics but from one of the three scripts and the video is for to see the resultes of all that three script

#

and I can`t provide any code because no one answer or ask me for if someone ask it will be a pleasure

rough granite
rough granite
#

Just remember for code use a code site

#

!code

radiant voidBOT
uncut tide
#

never mind next time I will write prompt to explain every Detaille's of the issues in my prototype and send it with code too

#

as you can see am new here so I said it before don`t take it bad if I ask stupide question

uncut tide
restive linden
#

Running into an issue where my mouse is not accurate. Everything is perfect in editor but in game my mouse hovering is not accurate. Code below and an image.


// Handle clicks
if (Input.GetMouseButtonDown(0)) // Left click
{
    ray = mainCamera.ScreenPointToRay(Input.mousePosition);
    if (Physics.Raycast(ray, out hit))
    {
        Vector2Int gridPos = GridManager.Instance.WorldToGrid(hit.point);

        // ONLY allow movement to valid tiles
        Tile tile = GridManager.Instance.GetTileAt(gridPos);
        if (tile != null)
        {
            player.MoveTo(gridPos.x, gridPos.y);
            Debug.Log($"Moving to {gridPos}");
        }
        else
        {
            Debug.Log($"Invalid tile position: {gridPos}");
        }
    }
}
#

I move my mouse slightly left anddddd

ivory bobcat
#

If the mouse position and logs are correct then it's likely something to do with GridManager.Instance.GetTileAt

restive linden
#

Should I have it debug show my mouse position like the raycast?

naive pawn
#

!code

radiant voidBOT
restive linden
#

future reference:

From FloorToInt() to use RoundToInt()
plush nacelle
restive linden
#

Nah I'm going to keep it pretty small

plush nacelle
#

using collider

restive linden
#

It's working perfect after that swap

plush nacelle
#

nice

analog drift
#

im back🤣

analog drift
#

LOL dead chat for 1hour+

#

lololol

#

heyy so i am having trouble with my jump system for my platformer (2D) so pls help

fickle plume
#

!ask

radiant voidBOT
# fickle plume !ask

:thinking: Asking Questions

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

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

analog drift
#

!ask

radiant voidBOT
# analog drift !ask

:thinking: Asking Questions

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

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

fickle plume
# analog drift !ask

Yes, this is how bot commands work. Was something unclear the first time it was used?

analog drift
#

so cool

fickle plume
# analog drift heyy hows this

You need to actually read what the bot message says. You still explain nothing about the problem. And this is a code channel, if you have problem with the code, post it.

analog drift
#

oh i do not have a problem

#

just asking how the textures look

#

1-10

warped sierra
#

done 😄

fickle plume
fickle plume
warped sierra
#

yeah sorry xd

#

I'm trying to update to the f2 version

vernal pulsar
#

whats the best practice for accessing children of a prefab? surely its not .Find() with a magic string, but I can't seem to find a better alternative :p

keen dew
#

Make a field and drag the child into it in the inspector

vernal pulsar
#

it wont let me for prefabs

naive pawn
#

serialized references whenever possible

vernal pulsar
#

it only lets me drag if I make an instance of the prefab in the hirearchy

naive pawn
vernal pulsar
#

instantiating the prefab and accessing its children to populate fields and stuff

#

tmp, sprites

#

all that

naive pawn
#

open the prefab and assign the references in prefab mode

#

wait, are you trying to get the references in an object that isn't the prefab?

vernal pulsar
#

ye

keen dew
#

Make fields on a script in the prefab and then access them through that script when you instantiate

vernal pulsar
#

ahhh

#

of course lol

#

that makes more sense yeah

naive pawn
#

and use the "main" script of the prefab as the type of the serialized field you use to instantiate, that way you don't have to do GetComponent later

#

(rather than GameObject)

paper delta
#

im lowkey just about to learn C# how long does it usually take im also wondering where i start cause i have no idea im just going off of unity documentation i dont even know what to click or start on give some tips

paper delta
#

i do know what publics and privates are

#

and a bit understanding of floats

#

well no

#

no floats

#

only public and private

#

i know that youtube tutorials are not the way at all

#

i never understand those either

timber tide
#

https://www.w3schools.com/cs/index.php
Do all that before touching anything unity