#💻┃code-beginner

1 messages · Page 622 of 1

last radish
#

any ideas as what to do nav?

rich adder
last radish
#

yep

#

changed the child of mazecell from being a quad to a plane

rich adder
#

and the minimum region area is probably too big

#

just noticed you scaled the floor at 0.1

last radish
#

okay so ill try to just add in a big plane somewhere and see if that bakes

rich adder
#

yeah try that first

last radish
#

it is baked but very wierdly

#

its above the plane

#

why is this happening first of all, and also if we get the offset fixed, i might just add in a plane that is inline with the small planes, and just not bake the small ones

#

i know its ineffcient but idc im very timepressured for this

rich adder
#

hmm yeah something is odd

sand mesa
#

welp I locked myself out of both of them

rich adder
last radish
sand mesa
#
 if (Input.GetMouseButtonDown(1) && notWonYet) // right click
 {
     if (hourHandCol == Physics2D.OverlapPoint(mousePos, 3, -0.5f))```
last radish
#

i swear baking should be straightforward

rich adder
#

normally it is lol

sand mesa
#

layer 3 is the hourhand layer

last radish
#

do you have any clues on what to do next?

rich adder
#

trying to think on what it could be , normally works fine out the box lol

last radish
#

how do i bake before runtime?

#

liek just baking the plane without running

rich adder
last radish
#

so i assing a nav surface to the plane and bake?

rich adder
#

mines not even baking regular cubes now notlikethis wtf is happening

#

either that or my gizmos aint showing lol

rich adder
#

all the collection is done according to the Object Collection dropdown

last radish
#

i managed to bake it

#

good news the capsule did move

#

bad news

sand mesa
#

oh

last radish
#

whateever this is

sand mesa
#

i found the problem

#

both hands were on the same z coord

last radish
#

yes please! one baked prism on a plane!

rich adder
rich adder
#

especially child objects

rich adder
# last radish what does that mean

with Center mode you're not seeing the true orgin of the object but a Center version of it.. So it may not always reflect where the exact pivot is

last radish
#

how do i turn that off

rich adder
sand mesa
#

thats why the hour hand is working when the minute hand doesnt

rich adder
#

but if you already made all your tiles to match Center than you probably want to keep it for that or switch it as you go

sand mesa
last radish
#

i think ill keep it, im really not trying to touch anything unecessary im scared everything will brake atp

#

i actually have no clue what to do

last radish
#

even with the normal baking random triangles are popping up that stop my enemy from moving

sand mesa
#

so how do I get the code to ignore the z positions..

#

one second

last radish
#

it may be hard to see

rich adder
#

hmm . you can control which objects get baked / wich area

#

actually now I think of it, it could be other layers

last radish
#

you see that lighter coloured blue right?

#

that is going up and its like a really big 3d triangle

rich adder
#

yeah because it baked something at a higher plane

#

so its trying to connect with a slope

last radish
#

yeah but there isnt anything there though

rich adder
#

try putting the Use Geometry to Colliders

last radish
#

still bakes wierdly

rich adder
last radish
#

thats the "target"

#

my bad i didnt know it was there because the "enemy" stood on it completely

rich adder
#

over here is there something? maybe invisible collider?

#

ahh..shit..I gotta run out for like an hour or so' ill be back a bit later.

last radish
#

nope dont think so

rich adder
#

dw there is others around here who know

#

probably more than me

last radish
#

thank you so much though

rich adder
#

Ill try to think of something though

last radish
#

oh damn alr ill try that

sand mesa
#

i think i found the most DUMBEST way to solve it

#

change the position of the sprites

#

whenever I left click

last radish
#

ok, so if anyone else could help with this i would highly appreciate it, how does one bake walls into navmesh that spawn after runtime?

#

i am generating a maze, and i need zombies walking around, and i have done the floor, so they do go towards the target, however they still go straight at the tarbet thrgouh walls

hushed hinge
#

yet how would everyone think when they play it?

rich adder
last radish
#

Yeah but i tried implementing a script similiar to the one at the start, and they did not bake

#

like the floor(plane) is baked because i baked it before runtime but the walls no

rich adder
#

if its not baking its somehow not detecting the walls

rich adder
#

they're supposed to bake them together

#

the walls. / obstacle provide the "negative" space to be subtracted from the NavMesh

last radish
#

hmm yeah i understand

#

but what am i meant to do

rich adder
#

hold on lets make a thread so we don't flood

mortal ginkgo
#

i'm making a top down roguelike
so far i have a player character that moves and can attack an enemy and kill it
but the attack can't turn
how do i make it turn to the direction of the mouse?

last radish
rich adder
mortal ginkgo
rich adder
rich adder
last radish
#

i am generating a maze, and i need

mortal ginkgo
rich adder
#

usually every frame

#

Update

mortal ginkgo
#

ok thanks

sand mesa
#

I FIXED IT!

rich adder
# sand mesa

whats with the handle moving up and down though

sand mesa
#

ez; MouseUp and MouseDown

#

  Vector3 mousePos = myCam.ViewportToWorldPoint(Input.mousePosition);
  if (Input.GetMouseButtonDown(0))
  {
      transform.position = new Vector3(transform.position.x, transform.position.y, -1);
  }
  if (Input.GetMouseButtonUp(0))
  {
      transform.position = new Vector3(transform.position.x, transform.position.y, 0);
  }```
rich adder
#

why

sand mesa
#

once I figured out the z position of the images were whats causing the override

rich adder
#

why not just put them in seperate layers then each one gets their own raycast + filter of that layer

sand mesa
#

I thought — just made it clear what it is you're moving

#

and make it move closer to the cam whenever you move it

#

and it functions, which is the most importaint bit

rich adder
#

yeah this goes beack to being a depth issue

last radish
#

nav btw i added in a few things into the thread if you want to read it

rich adder
#

I replied there you never replied lol

last radish
#

i created two sorry

#

the first one was a bit misleading in name

rich adder
#

ok

rich adder
mortal ginkgo
#

nope

rich adder
#

means dont blindly copy verbatim

mortal ginkgo
#

this is code beginner channel

#

don't expect for us to know things

rich adder
#

well the word example is pretty common even outside of code

mortal ginkgo
#

never heard of it

steel smelt
#

@mortal ginkgo Beginners vary, assuming you know how to declare a variable wasn't unreasonable

rich adder
#

how

mortal ginkgo
#

english is not my first language

rich adder
mortal ginkgo
#

so uuh

#

can you explain it like i'm a baby?

#

(the code that is)

steel smelt
#

@mortal ginkgo Have you studied cartesian planes?

rich adder
steel smelt
#

@mortal ginkgo If you don't know what cartesian planes are, I don't think anyone's going to be able to provide you with a basis for understanding the operation. So maybe just memorize that normalizing the output of (vector b - vector a) will give you a direction from a to b

mortal ginkgo
#

i just wanna know how to make my attack turn to my cursor 😭

rich adder
mortal ginkgo
#

i will learn by seeing how it works

#

so show me

rich adder
#

I showed you

steel smelt
#

@mortal ginkgo Look up cartesian planes, do you remember that from high school?

rich adder
#

(b-a).normalized

#

thats your direction

#

how you apply that its up to you

mortal ginkgo
rich adder
#

for example transform.right = (b-a).normalized will turn towards that direction

mortal ginkgo
rich adder
#

I already gave you code

steel smelt
#

Oof

rich adder
#

there is not much more to it

#

it does not teach you anything by copy and paste, you should at very least undserstand what you're copying on How it works the way it does..

rich adder
#

and thats why I showed it to you

#

you have to create the variables yourself

mortal ginkgo
#

how do i get the mouse position

rich adder
#

if you dont know how to create / declare variables, then you're doing too much already and take a step back

rich adder
#

magic 💫

mortal ginkgo
#

probably shouldn't be sarcastic when talking to a dum dum

undone dragon
rich adder
#

its not sarcasm its actually amazing

#

I wish I had these tools growing up

#

note how most will show two, MousePosition which is only a screen point, and MOUSE WORLD position which is in the world

mortal ginkgo
gleaming bridge
#

Guys, just got a quick question when it comes to an inventory system in 3D
Should you be instantiating a selected item from your inventory every time you select it and destroy it after selecting another or should you turn it off until you select it again, basically making it invisible

rich adder
gleaming bridge
rich adder
# gleaming bridge could you explain why?

Dectivation only consumes resource when you create the item, after that its pretty much loaded in memory
the other one you need to create space in memory, then destroy releasing memory then create space in memory and so on

#

those computations arent free

#

they're pretty tiny though its probably being over the top

grand snow
undone dragon
grand snow
#

if your blender mat does more more complex stuff than just use the principled node then it wont export the mat properly

fierce jetty
#

Is there a better place for resources for smoother animations between my character states? All my animation fire correctly but it is really choppy. Maybe because they are just place holder animations from Mixamo but wondering if anyone has found some really good tutorials?

fierce jetty
untold shore
#

Hey yall, having some trouble figuring out how to exactly do something.
Currently attempting to figure out dictionaries, and one of things I wanted to have is whenever a button is pressed, itll move onto the next dictionary log (theyre ints, each moving upwards.)
Basically:

public void TimemakerTutorialDialogues()
    {
        sentencesaying = TimemakerDialoguePreGame[1];
    }

Then on button click, sentencesaying would equal TimemakerDialoguePreGame[2].
Is that possible?
Please @ me if you respond, thanks!

wintry quarry
wintry quarry
#

Dictionary doesn't make a lot of sense if your keys are just a consecutive series of integers - that's just an array/list

#

with any of these - you would just have a variable like int currentDialogueIndex; and do currentDialogueIndex++ when you want to move to the next one

#

and access the text with MyDialogues[currentDialogueIndex]

untold shore
#

Ohh that would be a lot better, Ill try that out. Thank yall!

rich adder
#

maybe a video of issue wouldn't hurt

unborn kayak
#

mmmm
is that good way to get data from script that are not MonoBehaviour?

rich adder
#

but thats how you instatiate it to be accessed sure

wintry quarry
unborn kayak
#

I thought I was getting data from namespace
Thank you yall

wintry quarry
#

they don't contain any data

unborn kayak
#

Good to know

rich adder
#

basically its like "Categories" that those classes belong to , so they can be separated (so classes with same name dont cause Already Defined error)

polar acorn
#

Code folders

ionic zephyr
#

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.Edge.WakeUp () (at <e6407ce49b2b4392b94de9c9c789a955>:0)
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List1[T] inEdges, System.Collections.Generic.List1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at <e6407ce49b2b4392b94de9c9c789a955>:0)
UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at <e6407ce49b2b4392b94de9c9c789a955>:0)
UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at <e6407ce49b2b4392b94de9c9c789a955>:0)
UnityEditor.Graphs.Graph.WakeUp () (at <e6407ce49b2b4392b94de9c9c789a955>:0)
UnityEditor.Graphs.Graph.OnEnable () (at <e6407ce49b2b4392b94de9c9c789a955>:0)

#

help please!

rich adder
#

restart Unity, usually fixes it

#

some window, layout , tab got messed up drawing

ionic zephyr
#

and could that make my game scenes not pass to each other?

rich adder
#

normally this should not affect anything in the runtime

#

UnityEditor isnt a thing during Build

#

this error is probably as old as unity lol

#

I usued to get it a lot with having the animator docked with other windows but that was back in 2019

#

if it keeps happening after you restart unity, you can try Resetting your layout or, perhaps delete library folder and rebuild all cache

small sandal
#

can someone help me on the first screen shot i get a error telling me to use "IXRSelectInteractable" so i switch XRBaseInteractable with "IXRSelectInteractable". but then i get a error telling me that "IXRSelectInteractable" Does not contain a definition for "CompareTag." Im using the new XR Interaction Toolkit and Unity 6.

wintry quarry
small sandal
wintry quarry
#

alright well since the latter is an interface there's no guarantee it's a Component with CompareTag

#

so you can do something like:

return base.CanSelect(interactable) && interactable is Component c && c.CompareTag(TargetTag)```
mortal ginkgo
#

how should i start learning unity (2d) other than "! learn"

rich adder
small sandal
pure drift
#

!code

eternal falconBOT
pure drift
#

https://paste.myst.rs/n6ckbbzm when trying to split asteroids should i try to do it in the bullet script or the asteroid script im not sure how to go about this right now. from what i see it could possibly make more sense in the asteroid script but im not 100 percent sure

proud fossil
#

asteroid one

wintry quarry
#

both, basically.

The bullet script should do something like call a function on the asteroid script. That function would split the asteroid

polar acorn
eternal falconBOT
pure drift
#

ohh ok thank you i was wondering if i should have seperate prefabs for each of the smaller asteroids i want to spawn with 3 different scriptable objects because im kinda not sure about this

last radish
#

Hey guys, for some reason this code i got off of a youtube video is not working for me at all(i cant move and i can only move my camera up and down). Is this something wrong on my end pr is the code just outdated? https://pastebin.com/RXZ1dXgw

polar acorn
wintry quarry
#

Also your console window when you're running the game

#

Almost certainly you made a mistake.

atomic sierra
#

so I'm getting this error TransientArtifactProvider::IsTransientArtifact call is not allowed when transient artifacts are getting updated

And i searched it up and i saw that it may just be a bug in unity 6

I assumed that was the case for me as well, since everything in my project seems to be working fine

#

I was just wondering how I could remove this error from appearing? because its kind of annoying

last radish
#

this is the inspector of the capsule, also there is nothing in terminal

#

right

#

ignore everything

#

turns out its meant to be assigned to the parent object not the capsule

#

anyways im falling through the ground why is that?

rich adder
#

either ground doesnt have collider or your player is already starting inside / below ground collider

last radish
#

the floor has a mesh collider and my character is a few feet above the ground

#

it seems to be a different problem sorry

#

either my character teleports into the ground, or onto the roof when it is played, depending on how high or low i put him

rich adder
#

do you have any other scripts besides the Player one

last radish
#

nope, well not on the object

#

i tried lowering the size of the character controller radius as it was quite big, and now i just teleport to being stuck to the roof

rich adder
last radish
rich adder
#

there's your issue

#

wait where is the other components now..

last radish
#

on the parent

rich adder
#

anyway you should not have any other collider for the body besides CC

#

CC is already a collider

last radish
#

is cc capsule collider or character controller

rich adder
#

Character Controller , sorry

last radish
#

oh okie dokie

#

thank you

rich adder
#

btw for event Character Controller can detect triggers for OnTriggerEnter

#

OnCollisionEnter doesnt work for CC

ember sphinx
#

Quick question? How do I add these things for my scripted code?

rich adder
#

wdym "these things"

ember sphinx
#

But still

wintry quarry
#

still what? Use your words.

rich adder
# ember sphinx But still

I'm gonna take a wild shot in the dark and assume your PlayerMovement or another script has some sort of compile error and cannot finish compiling so those fields won't show up yet

#

other than that you haven't given us much info to work with lol

last radish
#

My player can see through walls, i.e, player camera is clipping through the walls. How can i fix this?

#

looks like this (im looking into a corner and those are walls on the left and right

hallow rock
#

hat need some help on this deal

#

NotConfiguredClientException: Unity VCS client is not correctly configured for the current user: Client config file C:\Users\Monke\AppData\Local\plastic4\client.conf not found. Please execute 'cm configure' to perform a text mode configuration or 'plastic --configure' for graphical mode.

rich ice
rich adder
#

near/far clipping

#

near is probably what you want to fix

last radish
hallow rock
#

what does this mean?

rich adder
hallow rock
#

it’s from my friend.

#

so idk.

rich adder
#

tell your friend to take a screenshot like a normal person

hallow rock
#

do you know what this means though?

#

NotConfiguredClientException: Unity VCS client is not correctly configured for the current user: Client config file C:\Users\Monke\AppData\Local\plastic4\client.conf not found. Please execute 'cm configure' to perform a text mode configuration or 'plastic --configure' for graphical mode.

rich adder
#

this is different from what you shown above

hallow rock
#

yeah, i’m here for 2 errors.

rich adder
#

are you usig UVC ?

hallow rock
#

nope.

rich adder
hallow rock
#

he is not using UVC.

#

okay.

#

he’s also asking what package.

#

as a start point.

rich adder
#

Version Control

#

its in the package manager

hallow rock
#

remove that.

rich adder
#

yes

hallow rock
rich adder
#

sounds like an issue with photon

hallow rock
rich adder
#

I dont work with photon so i havent a clue

rich adder
hallow rock
#

mhm. so delete that version control menu)

hallow rock
rich adder
hallow rock
#

delete that?

#

okay.

rich adder
#

you can remove it

hallow rock
#

where can I find support for photon?

rich adder
hallow rock
#

nevermind.

hallow rock
rich adder
#

should be...Unless you have some asset somehow trying to access UVC for whatever reason

rich adder
neon forum
#

how would I be able to create a directory to store and read files from? Would I create a filepath as a string and then use Directory to create a directory?
And then if that is correct how would I create a new .json file? Like what would be the best way to go about this if I want my game to store player-created grid-maps

rich adder
neon forum
#

It's less about the code and more about how I should go about this? Should I store this stuff in the game itself or should I make a folder outside the game to holde json files free for the player to observe?

rich adder
#

its not about the code only..

#

its the info I sent

neon forum
#

oh, I only read the code stuff and kinda overlooked the other text, lol

neon forum
#

okay I got it able to create it, but can you not convert a dict to a json and write it to a file? it comes out empty

rich adder
#

Unity doesn't serialize Dictionaries

#

thats why Newtonsoft was suggested

neon forum
#

ahhhhhhhhh I used the wrong json

rich adder
#

but you shouldn't just be saving a dictionary alone

#

you ideally want a SaveData object (struct or class)
mark it as System.Serializable

#

if you want to display Dictionary values in the inspector too you'd need a custom dictionary asset or use 2 structs

sour fulcrum
#

Does the SerializedDict from the rendering package show up in inspector somewhat nicely or is it just for data serialisation

rich adder
#

Does it? I haven't tried it but can give it a try

sour fulcrum
#

No clue!

neon forum
#

how do I invoke JsonConvert? I have added the package, do I have to use a 'using' at the top of the file?

sour fulcrum
#

I’ve always used ayellowpaper’s solution on the asset store

neon forum
#

is it just newtonsoft?

rich adder
#

put the class the IDE should suggest it

#

also I sent the docs

neon forum
#

ok I got it working

#

well I got it working but I have a new error now that seems odd. Is that a memory value?

rich adder
#

wait are you using rigidbody property in MB ?

neon forum
#

in MB?

rich adder
#

MonoBehaviour

neon forum
#

I either can't view monobehavior or it doesn't have it

rich adder
#

check the stack trace of the error

neon forum
#

it's trying to get rigibody from the gameobject tile, but I never gave the tile prefab a rigidbody

teal viper
#

Share the error details.

neon forum
#

the "it" in question is a SerializedJson string serializedJson = JsonConvert.SerializeObject(tileStorage, Formatting.Indented, new JsonSerializerSettings() { ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore });

teal viper
#

Are you trying to serialize a MonoBehaviour?

neon forum
#

I don't think so, a monobehavior is a component, so it would be visible on the gameobject on the editor, right?

teal viper
neon forum
#

ok

teal viper
#

Or rather the whole script.

neon forum
#

gotcha

#

I'm trying to serialize a dict whose key match pair is a vector2d of it's x,y location and a game obj

teal viper
#

don't try to serialize a GameObject.

#

Or any unity object for that matter.

rich adder
#

tileStorage is the Dictionary i think..oh wait thats another script nvm..

neon forum
#

is it too much data and breaks the game?

#

breaks the serializer*?

teal viper
#

Yes. It's not just the amount of data but where and how it's stored.

neon forum
#

I just want to know to get a better understanding of unity

wintry quarry
#

mostly the problem is you don't have a way to serialize it properly

#

also yes it's not clear which bits you actually want to serialize

#

for example stuff like instance IDs are useless to be serialized.

rich adder
neon forum
#

would it be better to just have an enum property that describes each obj and store that in the dict instead?

#

so would having it as a class be better for saving it all?

#

or would it help readability or does it help the serializer serialize it?

rich adder
#

in the long run it will benefit you to have it all in one spot imo

neon forum
#

that makes sense, having it split would probably be for the better instead of hiding away in the grid manager

#

Is there a way for a script to reference another script without having to have a SerializedField Script of it?

rich adder
#

SerializedField is an attribute not really directly related to referencing

#

it just exposes private variables in the inspector, same as public would

#

so you mean Inspector refrences vs something else

#

generally at runtime you use GetComponent,or another form of DI instead of inspector

neon forum
#

Sorry, referencing was the wrong word, I think. I want to call methods from another script, but I feel like SerializeField-ing the script in a script would start making things messy

rich adder
#

referencing is correct

#

SerializeField doesnt control references though just want to make it clear.

#

it just helps you assign it inside the inspector

#

linking in the inspector is a like form of Dependency Injection in its own right
assigning a reference is just
MyCoolScript coolScript =
accessing is
coolScript.Whatever

scarlet skiff
rich adder
#

havent looked yet hold on

neon forum
wintry quarry
#

so your computer is 100% correct

#

you can't store .666 in an integer variable

neon forum
#

honeycomb is an int not a float

rich adder
#

yup int division

neon forum
#

honeycombAmount

scarlet skiff
#

bro... im gonna crash out

#

thanks..

#

so i assume i just float(x/y)

neon forum
#

well you CAN but you won't get you want

wintry quarry
#

or x / (float)y

neon forum
#

putting the x/y in parenthesis makes the division happen first, THEN cast to float

wintry quarry
#

yeah you'll just get 0 again that way

neon forum
#

PEMDAS or something

scarlet skiff
#

ngl i spent way too long on this 💔

neon forum
#

same

rich adder
#

happens to the best of us

neon forum
#

I think I've made 3 stupid mistakes that were just "this thing isn't enabled bozo"

#

and this has only been less than a week into development

teal viper
scarlet skiff
#

"so 2/3 could NOT POSSIBLY be 0...." didnt know int devision was a thing

neon forum
rich adder
teal viper
rich adder
#

if you got 1.6 then its going to be 1 not 2

teal viper
# neon forum ah, got it

Instances/types/classes is a core aspect of object oriented programming, so you probably should make sure you understand it correctly before proceeding.

neon forum
#

I do, I just completely forgot about that concept

worthy tundra
#

i have the weirdest problem.
somehow the children of an empty object are changing the pivot OF THE PARENT

worthy tundra
wintry quarry
rich adder
#

ahh Center Pivot strikes again

wintry quarry
#

you need to be in pivot mode if you want to see the actual pivot location

#

Center mode takes the average of all the children

rich adder
#

Very good for rotating all the objects together, almost useless for everything else.
Thanks for setting it as default unity UnityChanLOL

wintry quarry
#

yeah It's super annoying that Center is the default

worthy tundra
mighty cosmos
#

i have a question how hard is it to do inverse kinematics?

teal viper
mighty cosmos
#

well, i do not want to use any kind of assests and atm i'm just trying to do IK on a box with 4 legs to see how it works and whatnot. so from scratch ig

rich adder
#

yikes. Why re-invent the wheel

#

unity has Animation Rigging package w IK

wintry quarry
teal viper
#

But yeah, implementing from scratch can be quite difficult

mighty cosmos
mighty cosmos
wintry quarry
#

I mean, do you manufacture a drill from scratch when you put up shelves?

Are you making a game or are you making an IK system?

rich adder
teal viper
wintry quarry
#

There's a difference between using tools and doing asset flips

mighty cosmos
teal viper
rich adder
#

Animator already has some of it built in, the Animation Rigging package extends that and has neat features

mighty cosmos
#

i see i'll take a look at my options from scratch and that as well. if i'm able to get a grasp of what is going on when doing it from start might as well learn if not i'll use those thanks

polar dust
#

in my own project, ive grabbed a number of free assets, knowing they are temporary. but its been enough to instantly make the game start to feel more like a real game

restive lantern
#

Hi, I am not sure what I did but after updating some packages my unity game log is now being filled with this error message:```
(Filename: currently not available on il2cpp Line: -1)

NullReferenceException: Object reference not set to an instance of an object.

(Filename: currently not available on il2cpp Line: -1)

NullReferenceException: Object reference not set to an instance of an object.

(Filename: currently not available on il2cpp Line: -1)

NullReferenceException: Object reference not set to an instance of an object.

(Filename: currently not available on il2cpp Line: -1)

NullReferenceException: Object reference not set to an instance of an object.

#

This only happens with release builds, not debug builds.

teal viper
restive lantern
#

Can I get a stacktrace?

teal viper
restive lantern
#

Heh... if at least this would happen in debug builds

teal viper
#

Is there no option to output debug symbols in a release build?🤔

restive lantern
#

But apparently that's not enough for a stacktrace

teal viper
#

Ok, then try attaching the debugger to the process.

restive lantern
#

Ohhhhh

restive lantern
#

And even that top frame only shows up by address, no source information.

teal viper
mellow zenith
#

hey all, im following this tutorial
https://www.youtube.com/watch?v=l0emsAHIBjU&list=PLcRSafycjWFepsLiAHxxi8D_5GGvu6arf

and get this weird bug when I try to run it, ive fully resterted the project and did the steps from scratch, any ideas on what the problem is?

the code I am using is from https://github.com/SunnyValleyStudio/Grid-Placement-System-Unity-2022

In this Unity 3D tutorial start creating a Grid Building System. First we will use Grid component to calculate a cell position for our mouse pointer position to use it in our placement system. Next we will expend the system with a custom grid shader and an object placement and removal system. At the end of this tutorial you will have a grid plac...

▶ Play video
GitHub

How to create a grid placement system in Unity 2022 - SunnyValleyStudio/Grid-Placement-System-Unity-2022

wintry quarry
#

I have not looked at your code or your tutorial but that's a super common pitfall people have with this kind of system and it results in exactly this kind of behavior

mellow zenith
#

its just weird that I followed the tutorial step by step and get this and he doesnt

wintry quarry
#

He did something different

#

with the collider on the preview object

#

or its layer

#

and the layermask if applicable

#

just make sure your ray is ignoring the placed object

#

and don't forget basic debugging skills like Debug.Log to print which object your raycast is hitting

#

Is the preview object even supposed to have a collider?

mellow zenith
#

u a smart man

#

this has taken me like a week

#

it was bc i was using a box collider

#

i think

#

on my prefab object

ember sphinx
#

So it says i have a "Assets\birdJump.cs(6,37): error CS1002: ; expected" but i put a semicolon on the exact line of code

mellow zenith
wintry quarry
#

right now it's not showing you your errors

#

(and yes you have a very obvious error that should be highlighted here)

mellow zenith
wintry quarry
#

Don't just do random stuff you don't understand

tribal token
#

im planning on making a cutscene on my 3d game similar to genshin where the camera pans around, and when it comes to the dialogue the player would have to press a key or click something to skip, how should i approach that? should i use a timeline?

shell orchid
grand badger
grand badger
grand badger
wintry quarry
#

make sure it doesn't have any extra listeners

#

Also make sure you assigned the correct button to the startGameButton variable in the inspector

tribal token
nimble apex
#
Sprite[] cards = { p_card1.GetComponent<Image>().sprite....};```

if i change cards[0] , it will change the actual instance referred right?
wintry quarry
nimble apex
#

nice

#

because previously the code was something like

p_card1.GetComponent<Image>().sprite = ....;
p_card2.GetComponent<Image>().sprite = ....;
p_card3.GetComponent<Image>().sprite = ....;```
#

i couldnt stand it

wintry quarry
#

any time you have "numbered" variables, you should be using an array or a list instead

#

just do:

public Image[] cardImages;``` directly
grand badger
tribal token
grand badger
#

Well first decide on how much of the built in tools you’ll keep.

#

If you want to keep standard “Animation” assets, you’ll need a “CutsceneManager” and a “Cutscene : ScriptableObject”

#

For absolute control, assuming you’re indeed a beginner, I recommend to just make “Cutscene” a MonoBehaviour that completely takes over the scene’s behaviour, and can reference anything that’s needed

nimble apex
grand badger
nimble apex
#

-> before

element[0].get("c1");
element[1].get("c2");
element[2].get("c3");
....```

-> after
```cs
Sprite[] sprites =
{
    c_Holdem[0].GetComponent<Image>().sprite,
    c_Holdem[1].GetComponent<Image>().sprite,
    c_Holdem[2].GetComponent<Image>().sprite,
    c_Holdem[3].GetComponent<Image>().sprite,
    c_Holdem[4].GetComponent<Image>().sprite
};

for (int i = 0; i < 5; i++)
{
    sprites[i] = cardSprites.GetCard($"c{i++}");
}```
tribal token
eternal needle
nimble apex
#

yeah i just bandaided them all

#

oh damn

eternal needle
#

nvm on my last part

nimble apex
#

yeah

#

imma little brainded now 😭

nimble apex
grand badger
#

ye. And this time it’ll at least work lol

#

I++ tho

eternal needle
#

i do really question why you need to pass a string$"c{i++}" instead of an int

grand badger
#

You might wanna sleep xD

nimble apex
eternal needle
#

also yea that i++ is gonna mess up the index, this will skip over values

nimble apex
#

the data of "which poker" we get is "C1 , S2 ,SA , H2.... etc"

grand badger
#

Issue is you’re increasing “I” which is used by the for loop

nimble apex
#

only data that will parse from server

#

so everytime when we receive the info, we need to do conversion

eternal needle
#

or use an enum, just something representing whatever C, S, H is and then the number

nimble apex
#

so, instead of letting server team rewrite the parsing, i gonna do the conversion in a better manner

#

hold on

#

if u wanna see the hellish conversion before

#

after i rewrite the whole thing

nimble apex
#

instead of making 52 items list, i gonna do serialized object

eternal needle
#

well im suddenly happier that I dont have to work with any of those codes

nimble apex
#

then u gotta think of a way to bandaid it

#

at least make it looks nicer

#

parsing faulty datatype is another thing, they even reference static utility objects with dynamic approach

#

which i need to rewrite also

#

like cards, 4 suits 13 cards each right? it wont change, its constant

they made an empty object on manager class, stored references of all the tokens, cards thats immutable, and load them all into managers during initialization

#

and ignore that object after its loaded, just let it stay there

eternal needle
nimble apex
#

yeah, normal unity app dev team

#

the "normal" is very subjective here🤓 ☝️

eternal needle
#

welp im at a loss. if it works it works i guess, the outcome of producing quantity over quality

nimble apex
#

however, because the boss , or the client is nice as hell, they still willing to sponsor us and give us money to sustain

#

thats why we dont have any products but still able to live for decadesUnityChanThumbsUp

grand badger
#

kyubey your code still has a bug

nimble apex
#

no way😭

#

oh that one

nimble apex
# grand badger kyubey your code still has a bug
AllCards cards = CommonHeaderController.Instance.g_HistoryCardSprites;
for (int i = 0; i < 3; i++)
{
    int j = i++;
    c_ThreePokerCard.c_CardFrame[i].GetComponent<Image>().sprite = cards.GetCard($"c{j}");
}```
#

ty 👍

eternal needle
nimble apex
#

frame[0] , query is "c1"
frame[1] , query is "c2"....etc

#

so c{i++} while frame[i]

#

wut

eternal needle
#

but really just dont use ++, its confusing here for anyone. just do j = i+1

nimble apex
#

ok 😭

grand badger
#

Try going for simple code instead of edgy lol

#

For example even your variable naming is edgy

#

Some are prepended with c while others with g

nimble apex
#

i didnt name those object they are previous curses

#

😭

#

i will never name something with prefixes

#
private int _number, m_number //nope
private GameObject c_xxxxx , a_xxxx, m_xxxx //nope```

```cs
private int number //yes
private GameObject xxxxx , <class/system>_xxxxx //yes```
native widget
#

Is it true that unity does not have code stripping?

charred spoke
#

No

topaz mortar
#

If I build my project, does Unity automatically filter out all the Debug.Log messages?
Or do I have to manually remove all of them for production?

keen dew
#

Debug.Log calls stay in builds

mortal ginkgo
#

i'm making a top down roguelike. so far i have a character that moves and attacks (melee) in one direction and enemies that die
how do i make the attack follow the direction of the player?

chrome apex
#

Wait, does trigger inside another trigger work? Suprisingly, google gives 0 results

#

for 2 on trigger stays

topaz mortar
robust harness
#

Off the top of my head id create an enum and set it to whatever the last input was (if the player pressed "W" then the enum would be forward for example) and then put the attack direction based on whatever the enum is, but i bet theres a better solution then that

naive pawn
nimble apex
#

i want to have half static field for my poker card objects , mostly references to gameobjects
i know SO can do that , but the problem is 3 out of 54 cards (4 suits 13 cards + 2 joker cards) will be changed during runtime, on initialization stage

#

is SO still fine for that? cuz u shouldnt change content inside it?

teal viper
nimble apex
#

aight , ty 👍

topaz mortar
#

For a 2d top-down game with 4 (8) directional movement, if I set up my player GO with a Dynamic RigidBody2D and my monsters also with a Dynamic RigidBody2D but select IsTrigger on the Collider2D.
This should prevent my player & monster from ever pushing eachother?
But I can still use forces to move them manually? For example some monsters might push the player back. Sword swings will knock some monsters back, ...
How flexible and future proof is this setup?
Or is there a setup that offer much more flexiblity? I'm ok with doing some up-front work to get everything working, I'm looking for long term performance and flexibility. It's a multiplayer game.

surreal minnow
#

How can I split a mesh along a plane? Trying to find examples online but I can't find what I am looking for

restive lantern
restive lantern
teal viper
restive lantern
teal viper
restive lantern
#

I'll grab a screenshot when I am on my PC

#

Just woke up 😅

sand moss
#

Hi, I have been working on instant games facebook. Does someone has experience with it. I want to know how if there is sdk for it as there is a documentation for it but I am not able to find a way to instan it.

bitter apex
#

is there a way to get which ui button has been pressed? I'm struggling to word what I want, but when I press a button I want that button that has been pressed to be used in a script. Right now, I have about 6 different buttons which all do (roughly) the same thing, but in a different way. I can't pass through parameters into a method using an OnClick() event, so I need another way to get that button in the code.

bitter apex
#

Nevermind, I think I have figured it out

restive lantern
#

@teal viper I have decided to try another debugger, and indeed this one tells me more:cs Thread 1 "014c" received signal SIGABRT, Aborted. 0x00006fffff3fcfc7 in RaiseException () from kernelbase.dll gdb> bt #0 0x00006fffff3fcfc7 in RaiseException () from kernelbase.dll #1 0x00006ffff4429bfc in WriteZStream () from GameAssembly.dll gdb> Now the question is, what is WriteZStream?

#

Yes I have searched Google, but didn't find a real answer

#

Apparently it is a somewhat common problem though but none of the solutions I could find really matches

austere crypt
#
public void DestroyTree(TreeData treeData)
{
    var treeInstancesToRemove = new List<TreeInstance>(terrainData.treeInstances);
    Debug.Log(treeInstancesToRemove.Count);
    treeInstancesToRemove.RemoveAt(treeData.index);
    Debug.Log(treeInstancesToRemove.Count);
    terrainData.SetTreeInstances(treeInstancesToRemove.ToArray(), false);

    Vector3 tempCoord = treeData.position;


    float[,] heights = terrainData.GetHeights((int) tempCoord.x, (int)tempCoord.x, 1, 1);
    terrainData.SetHeights((int)tempCoord.x, (int)tempCoord.y, heights); 
}

trying to remove tree but not working

verbal dome
austere crypt
#

Yep

restive lantern
verbal dome
# austere crypt Yep

I don't see why it wouldn't work then. Just to test, try terrainData.treeInstances = ... instead of terrainData.SetTreeInstances(...)

#

Also make sure you are referencing the correct terraindata

teal viper
restive lantern
hexed terrace
#

why would you move a non-code question to a code channel?

obtuse sluice
#

cuz u guys are busy with AI sht talking

hexed terrace
#

right, so move to an art channel? don't just shove it in somewhere it doesn't belong

topaz mortar
hexed terrace
#

or there ☝️

obtuse sluice
#

sorry AI bro

#

im moving

topaz mortar
#

people would rather tell you to go ask in another channel than actually help 😅

obtuse sluice
#

so thought maybe here someone knows

hexed terrace
#

That's the whole point of the channels.. ask in the correct place where people with the knowledge can congregate.

grand badger
keen needle
#

!code

eternal falconBOT
austere crypt
#

There is any way to destroy or update tree Collider in terrain except turning off/on terraincollider after destroying trees in runtime

mortal ginkgo
#

i'm making a top down roguelike. so far i have a character that moves and attacks (melee) in one direction and enemies that die
how do i make the attack follow the direction of the player?

timber tide
mortal ginkgo
#

oh thanks

mortal ginkgo
timber tide
# austere crypt There is any way to destroy or update tree Collider in terrain except turning of...

So basically the whole terrain is built of one collider, ground and trees included. Destroying the trees requires a complete rebuild of the mesh collider, so the idea is you destroy as much trees in that frame then tell the terrain to rebuild. This could be somewhat taxing if you aren't chunking the terrain that much, but otherwise you could just populate it without the brushes. Oh, I think painting with detailed meshes would work too

timber tide
#

or attack or whatever choice of weapon

mortal ginkgo
#

ok thanks

mortal ginkgo
timber tide
mortal ginkgo
#

thanks

burnt vapor
#

@mortal ginkgo

hexed terrace
verbal dome
#

It might also be .right or .up if it's 2D

timber tide
#

oh yeah true. I never consider 2D :)

mortal ginkgo
#

so uuh

#

i feel dumb but i feel proud cuz i tried

#

it's a weird feeling

#
// using UnityEditor.Experimental.GraphView;
using UnityEngine;

public class PlayerAttack1 : MonoBehaviour
{
    [SerializeField] private Animator anim;
    [SerializeField] private float meleeSpeed;
    [SerializeField] private float damage;
    [SerializeField] private Rigidbody2D Player; // <--- added this

    float timeUntilMelee;


    private void Update()
    {
        if (timeUntilMelee <= 0f)
        {
            if (Input.GetMouseButtonDown(0))
            {
                anim.SetTrigger("Attack1");
                timeUntilMelee = meleeSpeed;

            }

        }
        else
        {
            timeUntilMelee -= Time.deltaTime;
        }

        anim.transform.rotation = Player.transform.rotation; // <--- and added this
        


    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Enemy")
        {
            other.GetComponent<EnemyScript>().TakeDamage(damage);
            Debug.Log("Enemy hit");

        }


    }



}
mortal ginkgo
runic lance
#

you should first !learn the basics, otherwise you're never going to be able to progress with this

eternal falconBOT
#

:teacher: Unity Learn ↗

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

runic lance
#

this is not a question of being dumb, you're totally capable of learning 👍
but it doesn't help to come here every few hours asking for someone to fix your issue

runic lance
#

we're more than happy to help, but you must also put some effort

steel smelt
mortal ginkgo
#

i need more stimulation and idk why that is

hexed terrace
#

today's world of instant gratification in small bite sized content

mortal ginkgo
#

i just need to also be asking

mortal ginkgo
fickle plume
eternal falconBOT
#

:teacher: Unity Learn ↗

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

modest dust
fickle plume
mortal ginkgo
#

couldn't

modest dust
#

Because?

fickle plume
#

Pathways course is on rails. You just have to watch/read lessons and follow interactive parts. It's impossible to fail that. "I tried" here means literally "I was too lazy to follow basic instructions"

mortal ginkgo
# modest dust Because?

i just couldn't get myslef to finish it
it's like something is phisically pulling me back and my chest tightens

#

i WANT to

#

it's just painful

fickle plume
#

You don't even have to remember everything, the point of courses is to make you aware of information, so you know what is possible. Programming does not require you to learn everything right away. Just to know how to use learning resources and know where to lookup stuff.

modest dust
#

It will be pretty hard for you to turn this into a job if you can't even finish a single course.
It's interactive, no one tells you to read 400 pages of documents to learn anything straight away, it's one of the best things a beginner can have. You watch a video and follow along, learning basic info about the engine, how to use it, where to find more. I struggle to find anything painful about it.

scarlet skiff
#

the script on the dragonfly object. why wont it register collision?

mortal ginkgo
modest dust
#

Just sit down, focus, and learn, there is no other way, complaining won't fix anything

#

You command your body

mortal ginkgo
modest dust
#

The best way to get yourself into doing something is.. to just do it. Your brain will quite quickly focus at the task at hand once you focus and start spending some time on it.

steel smelt
#

Yesterday in a discussion, @mortal ginkgo mentioned being in high school. There's the reality that they might not currently have a very strong base to link new concepts to, making some of the learn stuff overwhelming. We've all done that at some point, tried to learn something interesting only to realize we were missing too many pieces to currently understand it.

The only problem here carbs is that people believe you're not meeting them halfway. Saying you don't want to put in the work whilst expecting others to do it for you feels disrespectful to the community and the time that people have spent learning.

steep whale
#

im very tired. I rewrote my PlayerMovement and im getting these, I dont understand why. I dont have a duplicate script, I only have 2 scripts, PlayerMovement and ThirdPersonCamera

Assets\Script\PlayerMovement.cs(5,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'PlayerMovement'
Assets\Script\PlayerMovement.cs(22,18): error CS0111: Type 'PlayerMovement' already defines a member called 'Update' with the same parameter types


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

public class PlayerMovement : MonoBehaviour
{
    [Header("Movement")]
    public float moveSpeed;
    public Transform orientation;
    float horizontalInput;
    float verticalInput;
    Vector3 moveDirection;
    Rigidbody rb;

    private void Start()
    {
        rb = GetComponent<Rigidbody>();
        rb.freezeRotation = true;

    }

    private void Update()
    {
        MyInput();
    }

    private void FixedUpdate()
    {
        MovePlayer();
    }

    private void MyInput()
    {
        horizontalInput = Input.GetAxisRaw("Horizontal");
        verticalInput = Input.GetAxisRaw("Vertical");

    }
    private void MovePlayer()
    {
        // callculate movement direction
        moveDirection = orientation.forward * verticalInput + orientation.right * horizontalInput;
        rb.AddForce(moveDirection.normalized * moveSpeed * 10f, ForceMode.Force);
    }
}
prime lodge
#

why this doesnt work?

scarlet skiff
ripe shard
keen cargo
prime lodge
ripe shard
steep whale
steel smelt
#

@prime lodge Look at the signature in your IDE

verbal dome
#

Even if you put the correct arguments into Set, it won't work here
You are modifying a property (eulerAngles) of a property (rotation) as a copy

fickle plume
# mortal ginkgo my body says your chest is now tight and hurts now

If you don't figure out how to get into "work" mode, you'll have much more problems later.

Generally you don't overexert yourself, do plenty of breaks to not create negative feedback. Some people use music to get into work mode. Keeping routine with specific time helps a lot. Switching off external distractions like socials, including discord.

mortal ginkgo
scarlet skiff
#

the script on the dragonfly object. why wont it register collision?

keen cargo
wintry quarry
steep whale
# mortal ginkgo and it makes me wanna cry when someone says "have you tried trying?" when my che...

nothing worth having comes easy. i find game dev, especially when youre shooting for concepts that are at parity with what inspired you to attempt to create in the first place, will lead you down a path that will be full of obstacles that you must get through by paying pain. what does pain look like? usually frustration and wasting time. the objects relent, iteration demands perfection, but your cost is staying with it even when you want to tear your own head off

wintry quarry
keen cargo
#

yea script files can be a bit sneaky

steep whale
keen cargo
#

because that has to be some kind of duplicate file or instance somewhere

wintry quarry
steep whale
wintry quarry
#

It can also be in the ThirdPersonController script

#

like you might have just defined the class in that script as well

steep whale
# wintry quarry It can also be in the ThirdPersonController script

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

public class ThirdPersonCamera : MonoBehaviour
{
    [Header("References")]
    public Transform orientation;
    public Transform player;
    public Transform playerObject;
    public Rigidbody rb;

    public float rotationSpeed;

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

    }

    private void Update()
    {
        //rotation orientation
        Vector3 viewDir = player.position - new Vector3(transform.position.x, player.position.y, player.position.z);
        orientation.forward = viewDir.normalized;

        // rotate player object
        float horizontalInput = Input.GetAxis("Horizontal");
        float verticalInput = Input.GetAxis("Vertical");
        Vector3 inputDir = orientation.forward * verticalInput + orientation.right * horizontalInput;

        if (inputDir != Vector3.zero)
            playerObject.forward = Vector3.Slerp(playerObject.forward, inputDir.normalized, Time.deltaTime * rotationSpeed);
    }
}
wintry quarry
#

Just serach for PlayerMovement in your IDE

keen cargo
#

stupid question, but you've tried restarting unity too right? sometimes the compiler thinks multiple instances are running at the same time

steep whale
#

._.

keen cargo
#

ok this is quite weird

steep whale
#

fuck i found it

#

theres a script for movement in this asset pack

#

die die die, i will kill

keen cargo
#

ohh lmaooo

steep whale
#

thank you everyone, love you @keen cargo @wintry quarry

keen cargo
scarlet skiff
keen cargo
#

though also i wouldn't call collisions off of object names

#

it's better to do it off of tags or layers even

scarlet skiff
#

i know but im looking for a specific singular object here so

#

dont wanna make a tag for just this one object, makes it harder in the end

verbal dome
#

Put a debug.log in the ontriggerenter method to see if it even runs in the first place

steep whale
# scarlet skiff anyone?

my best advice is to sub to GPT and feed your code to the o3-mini-high model for your particular problem. it's not great at creating its own code but it is pretty good at spotting errors in logic

scarlet skiff
#

as long as i rename every pinecone i spawn to exactly "pinecone", which takes just one line of code, i should be fine

scarlet skiff
steep whale
steep whale
scarlet skiff
#

i tried with the bing ai, im feeding it chatgpt plus rn... lets see

verbal dome
scarlet skiff
#

usually it just asks me "hey have you made sure u attached the right tags or layers" as if the image doesnt clearly show that yes, i did

wintry quarry
#

you want trasnform.rotation = Quaternion.Euler(0, 50, 0);

scarlet skiff
wintry quarry
#

you're calling Set on a copy of the quaternion. Also that's not how quaternions work even if that syntax was correct.

prime lodge
wintry quarry
#

Set works this way:

Quaternion x;
x.Set(0, 0, 0, 1);
transform.rotation = x;```
#

Set modifies a Quaternion in-place. You're calling it on a copy of the object's rotation which then gets discarded.

#

So your code does nothing

verbal dome
wintry quarry
#

You also are trying to plug euler angle rotations into a Quaternion's xyzw fields which is not how they work

verbal dome
#

That looks less smelly to me, yeah

modest dust
# mortal ginkgo my body says your chest is now tight and hurts now

You can always go on a break, play some music, relax, keep a routine of daily 30-60 minutes of learning with frequent breaks, completing the course step by step. Gamedev is something a lot of people go into because they like it, so in most cases learning something new should be a fun experience or challenge... not something that makes your chest explode. So try and make it enjoyable. Learning about the source of why exactly it's so 'painful' could also help.

scarlet skiff
#

but yea detection still wotn work

verbal dome
#

So did you confirm that ontriggerenter is even getting called?

keen cargo
#

put a debug in the beginning of the ontriggerenter function

timber tide
#

if something doesnt work then your first instinct should be to log it to the console

verbal dome
#

The method might not trigger if you are moving the object(s) via transform instead of via rigidbody

#

Or messed with the physics2D layer matrix

keen cargo
#

another thing is that the object may have an infinitely small collider, so you may want to check that the colliders add up too

scarlet skiff
verbal dome
#

Log the object you are colliding with

#
Debug.Log("Trigger entered: " + collision.gameObject.name, collision.gameObject);```
#

This logs the name and also lets you highlight the object when you click on the log once (second argument)

scarlet skiff
#

i think its becuase of this:
only one of them has the script, but idk why it would only specifically ignroe the one im going for

#

im tryna get the parent

verbal dome
#

Was gonna ask if any children are involved

scarlet skiff
#

maybe i should do a get parent

verbal dome
#

What components does the parent have and what does the child have?

scarlet skiff
#

child is trigger col, parent normal col + pinecone script + rb

#

and parent has items layer, child doesnt

#

its so player can walk through an item when they have full inv, and pick it up otherwise, thats why i needed the trig col

verbal dome
#

collision.gameObject might reference the child because it has the collider. I forget how exactly it works in 2D with trigger colliders

scarlet skiff
#

but also needed a normal col to collide with the ground

scarlet skiff
#

i guess, ill just have to get parent

verbal dome
#

You would know if you just... logged it

soft creek
#

hi, i have a question. How i can chance the string of a Text Mesh Pro to a int?

verbal dome
#

You aren't storing a score in a text mesh pro are you?

#

Or is it an input field?

soft creek
verbal dome
#

Probably int.TryParse

soft creek
#

i use it, but it return to me 0

verbal dome
#

Show your !code

eternal falconBOT
slim charm
#

Is hirong people from this server against tos?

verbal dome
eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

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

slim charm
verbal dome
#

It's a bot command. Read what the bot said

soft creek
#

the problem are in the line 26 -33

verbal dome
#

Do you have an inputfield?

#

Reference that instead, and do inputField.text

soft creek
#

yes

soft creek
verbal dome
#

There's a case where the text object has an extra invisible symbol at the end, this might be causing the issue

last radish
#

Is there any way to turn off/manipulate all lights in a scene using scripts? I want to periodically flicker and then turn all lights off in the scene

ripe shard
last radish
#

is there not any way to find them in code? i,e, if i tag them all as a light, or something like that?

verbal dome
#

Sure, but you might as well add a component to them and avoid the FindX methods.

ripe shard
verbal dome
#

Add to list in OnEnable, remove from list in OnDisable

#

Or Start & OnDestroy

steel smelt
#

@last radish Can also have an event driven approach. Make a custom component for your lights. Make a power class with OnPowerOn OnPowerOff events and let lights handle themselves

scarlet skiff
#

was it continuous that was more effecient in detecting? like even if thigns are going fast etc

wintry quarry
#

it's more accurate

#

it's less efficient.

scarlet skiff
#

but welp, either way collision didnt wanna work

#

i give up

#

unless i pause the game and place the object inside the other one myself, it doesnt want to detect the collision

upper night
#

anyone able to help with using Resources.LoadAll<Texture2D>(cardsPath);

#

its not loading the textures in the path the cardsPath is "Assets/Resources/Sprites/Cards/Faces"

#

and in the script its set too " public string cardsPath = "Sprites/Cards/Faces";"

#

all objects in the folder are texture2d set to sprite2d and ui

#

i have also tryedResources.LoadAll<Sprite>(cardsPath);

upper night
vernal bison
#

can anyone help w this? i have no idea what to do

eternal falconBOT
scarlet skiff
rich adder
#

also that flip chain is crazy...

scarlet skiff
#

the items are quite small tho

rich adder
#

oh yeah that might be an issue..

scarlet skiff
#

it works so

rich adder
#

it works but its pretty flimsy , wouldnt GetComponentInParent do fine ?

scarlet skiff
#

its on the parents parent

rich adder
#

it can reach up there

#

unless there was another in the child of that parent

#

GetComponentInParent / GetComponentInChildren just does recursion up/down

scarlet skiff
#

so gameObject.transform.parent.GetComponentInParent<SpriteFlip>() ?

scarlet skiff
rich adder
#

even gameObject.GetComponentInParent would do

#

it stops once it hits one if any component

scarlet skiff
#

so goes up a parent, checks, goes up a parent again, checks again, etc

rich adder
#

yup thats recursion

scarlet skiff
#

well i keep it mind

#

but before i change any scripts i wanna solve the two issues i got

rich adder
#

how small are they scaled ?

#

Unity doesnt really like small/big physics objects

scarlet skiff
rich adder
#

oh .5 should not be too bad..

scarlet skiff
#

the rectangular gizmo is the typical camera size when u starta a new project

rich adder
#

I thought it was something like 0.06.
your current size afaik shouldn't be issue

#

what are you using to detect collision ?

#

or you mean just in general, not code

scarlet skiff
#

im more worried about a different issue. i changed items to be picked on on ontriggerstay2d instead of on enter, and it picks up items as soon as there is free inventory in space, unlike before u had to exit col then enter again, which is what i want.

btu then when i disabled the items layers from interacting with each other, somehow i have to exit collision before entering again for me to be able to pick up items

scarlet skiff
rich adder
scarlet skiff
#

no i mean Stay started acting like Enter

scarlet skiff
rich adder
#

ohh so its not detecting if you stay in the trigger?

scarlet skiff
#

yes, but i have to stand still too for it to not detect

#

but i want it to detect even if im standing still

rich adder
#

You know what I would do tbh. Forget all this trigger stuff and just use an Overlap

#

that always works reliably

scarlet skiff
#

that could work for the firts issue, but for item pick ups i need the range to be exacty the size of the trigger collider i have rn

rich adder
#

you can still use a collider for sizing purposes

#

eg Collider2D hit = Physics2D.OverlapCircle(pos, circleCollider.radius, layerMask );

#

if(hit.TryGetComponent(out SomeComponent comp))
comp.Stuff

vernal bison
rich adder
surreal minnow
#

I am doing a boolean operation to subtract a mesh from another mesh. The issue is if I use two meshes that already exist in the game, the inside faces are fine. But if I use prefabs then the inside faces are gone:

#

Anyone that might know why?

rich adder
#

you realize, there are 3

vernal bison
#

visual studio manually

scarlet skiff
rich adder
vernal bison
#

yes

rich adder
rich adder
#

then pass it the colliders size

surreal minnow
#

I looked around and someone said it could be because of backface culling

rich adder
surreal minnow
#

It could also be that it is all done in one frame (right after the cube is Instantiated)

surreal minnow
rich adder
#

no idea then sry

surreal minnow
#

Do you know how I can disable backface culling?

rich adder
#

the MeshRenderer i think has two render modes

verbal dome
#

^Either that, or your material has double sided enabled

#

Or the mesh actually has triangles on both sides

surreal minnow
#

If I look inside the mesh I dont see the face

verbal dome
#

Then it is culled

#

Do you want to see the face?

surreal minnow
#

Yup

surreal minnow
#

Dynamic occlusion?

verbal dome
surreal minnow
verbal dome
#

All I can say is look for errors/warning in the console when you do the operation

rich adder
#

I think they are using the API in probuilder to do the Boolean function

verbal dome
#

Better show some code in that case

rich adder
verbal dome
rich adder
#

I know it has some functions you can do at runtime but honestly dont know if boolean is one of them lol

surreal minnow
#

There is no API, i just forked some CSG script from probuilder. I will show what I am doing

rich adder
#

oww

#

ah the api doesnt even have boolean in it.
I only remember using the basic combine mesh tools

surreal minnow
#

It is under some experimental testing section

rich adder
#

ohh yea I know where it is , I meant if there was anything in the API of it

rich adder
#

are the meshes ur doing Unity primitives or are they also probuilder meshes?

surreal minnow
#

They are the default unity cubes

#

cube1 is just a default unity cube that "helps" perform the boolean operation so I just move it in the place where I want it to cut off from CurrentCube

CurrentCube.transform.position = new Vector3(x, CurrentLevel, 0);
cube1.transform.position = new Vector3(0, CurrentLevel, 0);

cubeCutter.PerformCutting(cube1, CurrentCube);
public void PerformCutting(GameObject cube1, GameObject cube2)
        {
            Model resultModel = UnityEngine.ProBuilder.Csg.CSG.Perform(UnityEngine.ProBuilder.Csg.CSG.BooleanOp.Subtraction, cube1, cube2);
            Mesh resultMesh = (Mesh)resultModel;
            GameObject resultObject = new GameObject("ResultMesh");

            MeshFilter meshFilter = resultObject.AddComponent<MeshFilter>();
            meshFilter.mesh = resultMesh;

            MeshRenderer meshRenderer = resultObject.AddComponent<MeshRenderer>();
            meshRenderer.material = new Material(Shader.Find("Standard"));
        }
surreal minnow
#

The only difference are the things I mentioned earlier. The broken ones are instantiated prefabs (same ones as the working one) and it all happens the same frame

#

¯_(ツ)_/¯

topaz bridge
#

Why does Unity automatically switch to a newly created camera, even though there is another camera tagged MainCamera 🗿

restive lantern
#

Does setting UnityEngine.AudioSource.resource automatically set UnityEngine.AudioSource.clip?

hollow ether
#

can anyone solve this issue for me pls?

lost hull
#

Hello, what is the easiest way to stop clicks from going through UI?

wintry quarry
#

Don't do adhoc Raycasts

#

You can put IPointerDownHandler on your game world objects too, so long as they have colliders and you have a Physics Raycaster in the scene

hallow rock
#

hey.

#

So i’m so confused on which one i should choose for voice chat.

#

anyone got tips?

earnest wind
#

and u use chat for normal text chat, and also u can do stuff like inviting people to rooms and stuff like that

hallow rock
#

OperationResponse 230: ReturnCode: 32767 (ApplicationNotFound) Parameters 0 Server: NameServer Address bs.photonengine.io:5058 Unity.Engine.Debug:LogError (object)

earnest wind
acoustic belfry
#

hi, i been trying to harness the methods of my enemy using animation events...But i feel like i did something really wrong
!paste

#

i mean cuz the enemy just patrols, and then when sights the player it stops...and stays like that...like a dork

deft lintel
#

guys i need help plz
so im doing this silly main menu for design class in school ive done it smooth and all and its just works fantastic with mouse. but now im trying to implement controller support and it just keeps highlighting the buttons when i start the game like that and i do not understand why, im going insane 😭 ive asked deepseek and even that gave up so you guys are my last resort. i have put the play button as first selected in the event system and i script too. (also yeah the scripts are really ai generated ill admit just because im too lazy to write them in this project and want to get it over with and we arent gonna get graded for it anyway, dont judge lol)

grand snow
deft lintel
grand snow
#

manual or custom navigation stuff? weird that it cycles through the buttons like that

frigid sequoia
#

I am telling this guy that his next NavMeshAgent position is its current one, it's normal that the squares are showing it wants to move down or should I be using something else????

deft lintel
#

if like thats what you mean

grand snow
#

yea. all i can think of is the animator is miss configured so its going through states 🤔

deft lintel
#

hm okay, ill take a better look

grand snow
#

i guess also check your controller is not going wacko, windows and i think steam has a tester

deft lintel
#

i actually dont even have it connected atm, im using the arrow keys :(

grand snow
#

new input system? you want input to be key down not key held for navigation

deft lintel
grand snow
#

then you must have done something else wrong. use a prefab instead for your buttons to keep them a consistent size. is the animation using scale to change size?

#

i presume the issue is the play button staying large?

deft lintel
#

yeah the animation is using scale is to change size and rotation. but the play button is supposed to be bigger, that is its normal state

grand snow
#

then im not actually sure what your problem is then, the buttons not staying large once highlighted?

#

if is this then you should observe the animator (select in inspector and open animator window) on a button in playmode to see what its doing different between mouse and keyboard/controller.

deft lintel
cosmic dagger
#

When the game starts, each button is highlighted in a downward pattern (one after the other) as if the down key is being held . . .

ashen frigate
#

hello can i get help with this code ?

#

for some reason it entered confirm func even tho im not pressing click

cosmic dagger
ashen frigate
#

yea cuz im checking if players select there characters

cosmic dagger
#

Okay, but that's why it's constantly being called. Update runs every frame . . .

ashen frigate
#

i mean i get log even if its if (!hasClicked || !allPlayersSelected)

#

it should enter the else only if they both true