#💻┃code-beginner

1 messages · Page 741 of 1

limber turtle
#

aron's a* doesn't work with platformers, i think. unless you mean just using them for the more intelligent flying enemies in which case yeah that should be doable

hexed terrace
#

I don't see why the genre matters.

#

grounded enemies, going left and right.. why would they need path finding?

limber turtle
#

fair enough

#

all i would need to make them do is jump at walls or ledges

#

that's if i even want them to jump

#

hollow knight got away with it, right?

hexed terrace
#

no idea

limber turtle
#

hollow knight enemies are very stupid outside of the bosses and big enemies

#

some of them just kinda walk or run at you

#

not much else

#

some of them don't even do that, they just act like mario enemies

#

i'll get on with aron's a* for now then

#

since flying enemies need to actually know what the hell they're doing

kind cave
#

I was never this hopeless, I had push notifications but now it no longer works and I still don't know why... In logcat it throws java internal error and then it hangs. I tried to re-upload google-services.json and checked settings several times but still nothing

grand snow
#

i presume this is firebase?

kind cave
grand snow
#

These are 2 different things

#

the unity package lets you schedule notifications locally, firebase lets you push notifications over the internet

kind cave
grand snow
#

Oh the unity cloud one?

kind cave
grand snow
#

strange, why do they do it via firebase when you can just use firebase for this to begin with...

#

Make sure that external dep manager is working correctly and if using proguard then you need custom user rules to prevent issues

kind cave
kind cave
limber turtle
#

if i'm making a grid graph for a roguelike game with multiple rooms like tboi, should i have the grid encompass the whole area where rooms could possibly generate or should i change the grid based on where my rooms are located during generation?

#

i feel like the former would be far easier but the latter would possibly be more useful

rocky canyon
#

tough call then

#

i like my grids to extend out into the fog of war

#

but its just all about what u plan for ur game.. make it easier on urself if u can

limber turtle
#

alright

#

i think my rooms should be generated as units on a 6x6 grid so i should just be able to multiply out for the width i want

#

but i haven't even gotten to generation yet so i could just make sure i know what i'm doing with the one room

kind cave
# grand snow Whats the error it gives?

Here. 2025.09.27 16:10:07.257 6261 6362 Error Unity at com.unity.androidnotifications.UnityNotificationManager.initialize(UnityNotificationManager.java:106)

grand snow
#

How unhelpful 😂

kind cave
#

Wait, that was not full, sorry. ```2025.09.27 16:10:07.257 6261 6362 Error Unity at com.unity.androidnotifications.UnityNotificationManager.initialize(UnityNotificationManager.java:106)
2025.09.27 16:10:07.257 6261 6362 Error Unity at com.unity.androidnotifications.UnityNotificationManager.getNotificationManagerImpl(UnityNotificationManager.java:129)
2025.09.27 16:10:07.257 6261 6362 Error Unity at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
2025.09.27 16:10:07.257 6261 6362 Error Unity at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, System.Span`1[T] args) [0x00000] in <00000000000000000000000000000000>:0
2025.09.27 16:10:07.257 6261 6362 Error Unity at UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.IntPtr methodID, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0
2025.09.27 16:10:07.257 6261 6362 Error Unity at Unity.Notifications.Android.AndroidNotificationCenter.Initialize () [0x00000] in <00000000000000000000000000000000>:0
2025.09.27 16:10:07.257 6261 6362 Error Unity at Unity.Notifications

grand snow
kind cave
#

Yeah, it's a logcat error

#

So I also don't know where the issue is

#

I tried lowering the version from 4.0.2 to 4.0.1, we will see what happens now

patent kite
#

Sorry if this is the inckrrect tab to place this but Im working on a horde AI system but im pretty unskilled and unknowledgable in the grand scheme of game design. Is there any AI experts willing to DM me to go over what ive built? I want to know if what i have is original and feasible or if I just rediscovered old tech that isn't used for some reason. Currently, in my unoptimized state, I can have 200 capsule enemies on the map and fully active with a dip to 45fps. None of them have a behavior tree or a FSM on them. I think its a clever system but I am very far from an expert. Barely even a hobbyist. I just want to know if what I have is worth pursuing before I push to optimize it and try to make it better.

limber turtle
rocky canyon
#

nah i typically just grab the vector of the tile

limber turtle
#

oh

rocky canyon
#

i dont actually use th tilemap system so anything related to that im unsure of sorry

limber turtle
#

i don't know how to do that, i've only just started using aron granberg's a* solution

fading barn
#

It's a weird question but is it ok to use chatgpt for making unity scripts? Or should I code everything myself. As long as I know what scripts are doing is it ok for me to use LLMs to generate code to speed up development process as a solo developer. Or is chatgpt bad for optimized code/ steals code from open source projects so is wrong to use?

limber turtle
#

learning the code for yourself is both far more satisfying and lets you do far more later on

rocky canyon
#

its great as as tool..
i wouldn't have it generate code for u tho

limber turtle
#

skipping out on that for what boils down to something that googles simple solutions to what it thinks you're trying to do isn't a good idea

rocky canyon
#

use it to brainstorm..
learn of concepts and terminology
maybe have it refactor ur own code..
but i wouldnt trust its hallucinations

hot wadi
#

Use AI to learn, and develop your own skills

limber turtle
#

besides, if it gets anything wrong then it would probably just self destruct

rocky canyon
#

1 little bity mistake will just get worse and worse unless u hold its hand

polar acorn
#

If you're going to need to learn the things well enough to fact check it why not just cut out the middleman and use that knowledge to just make it correct without consulting the spam oracle?

rocky canyon
#

if u learn how a chatbot actually works its almost incredible it can build any script

fading barn
polar acorn
#

there's not really a way around that

#

Or at least hire someone who knows the physics

limber turtle
#

chatgpt can be used as a tool to learn, but never to do in this case

hot wadi
rocky canyon
fading barn
polar acorn
#

You're gonna need the knowledge at some point

rocky canyon
fading barn
rocky canyon
#

umopapisdn

hot wadi
#

There is a better way, buy a flight sim license from the store

#

Technically just the engine, if u want to skip the hard part

#

Nothing is free

fading barn
#

Asset store?

hot wadi
#

Yes

fading barn
#

Wdym license isn't asset store item called an asset

#

Are you referring to any specific asset?

fading barn
hot wadi
#

Every asset has a license

fading barn
#

Oh

#

Didn't knew that

#

I am a solo dev

hot wadi
#

As am I

#

U should also study copyright law if u want to pulish ur games

#

Just the surface stuff

rocky canyon
hot wadi
#

So u don't get in trouble

fading barn
rocky canyon
#

for copyright stuff just pay attention to the Licensing you have for the assets

#

if it doesn't have a license don't use it.. just to be safe simple as that

fading barn
# hot wadi So u don't get in trouble

Yeah I need to learn that like how to make something generic like a car that is inspired in design from a real world car but isn't a direct copy and looks different. For eg cars in gta games. How do I make it in a way that I wouldn't get sued from the car manufacturer

#

Infernus car in gta looks like Lamborghini for eg but doesn't infringe copyright for eg

rocky canyon
#

don't make any money 😉

#

a. they only care if u start making money
b. or, you somehow tarnish their brand / hurt their sales

#

all about that money 🤑

hot wadi
#

For instance, u can simply not put the logo of the brand in the model. They would likely notice the similarity but they probably don't care, except Nintendo

rocky canyon
#

but yea that would be something u should look up if ur making a car game..
and any of ur models have a "Likeness" to popular car brands

#

something to watch out for 👀

fading barn
limber turtle
#

is anyone here experienced with using aron granberg's a* project

#

the beginner's guide is telling me to use "Follower Entity" but it's just not there

rocky canyon
#

ive experienced it as in checking out its example scenes

rocky canyon
#

it may not show up in the Add Component menu if its in a namespace for example

#

would be like Pathfinding.FollowerEntity

limber turtle
#

idk what i'm looking at

rocky canyon
#

if its called Follower Entity that'd be the class and filename as well

#

use Pathfinding when u look for it

limber turtle
rocky canyon
#

last i checked they're all inside that namespace
using Pathfinding;

limber turtle
#

this is what i'm looking at

rocky canyon
#

ohh are u using ECS?

limber turtle
#

i think so?

#

i haven't seen any prompt telling me to install it yet

#

so i just assume it's installed already

rocky canyon
#

ohh, im not familiar with it..

#

throws me off a bit

#

i don't know much about it but i can install it and see if i can find it.. until someone else helps..

#

.. ¯_(ツ)_/¯

limber turtle
#

it's saying this, i tried looking for ecs in the package manager window but i didn't find anything

rocky canyon
fading barn
#

Is ecs only useful in games that have huge amounts of gameobjects to manage

limber turtle
#

thank you

rocky canyon
#

ive never used ECS

#

to me it gives me anxiety just thinking about it

rocky canyon
fading barn
#

Would a walking sim benefit from ecs

rocky canyon
#

from what little i know

slender nymph
#

You do not need to know anything about ECS to be able to use it.

rocky canyon
#

but then again no clue lol

rocky canyon
#

he was talkin to Robaster i believe

slender nymph
#

that is in regards to the follower entity component. it says that right on the page that was linked

fading barn
limber turtle
#

idk how to make unity navigation work

slender nymph
limber turtle
#

i've never really used it before

fading barn
limber turtle
#

i just have my pronouns set to that on discord bc i'm dumb

fading barn
#

They/them

limber turtle
#

i hardly know anything

slender nymph
hot wadi
#

Tell us what u are to do and may be we can offer a simpler solution

fading barn
limber turtle
slender nymph
limber turtle
#

if that was the case i'd have thought it would specify in the guide

#

it did for the graphs

languid pagoda
#

is there a method in unity that returns an array of GameObjects within a certain radius if they have a certain layer?

slender nymph
#

physics queries like OverlapSphere/Circle?

languid pagoda
#

OverlapSphere exactly what I was looking for

willow iron
#

Is there a way to make world space ui more convex? Like for an old CRT screen

polar acorn
tender onyx
#

I'm trying to cook up a Half-Life 1 styled FPS game and need a little help with the weapons system. You can pick guns up, they all fire, and do important gun stuff. Only problem is my method of equipping different guns involves and int to simply activate/deactivate children of my weapon manager. If the weapons are picked up in a different order, the key binds / selection order changes.

Is there a good way to assign each weapon a dedicated int so it's always in the same slot (Lists, Arrays, Etc)?

#

(Or give it a dedicated child position in the manager)

vale karma
#

nvmd. LayerMask was private

languid pagoda
#

like is the answer just to play with position and rotation of where the animation is played at until i get it where I want it? that doesn't seem correct

half notch
#

Hello, what is the best way in order to have a clean code, to have a player and some HUD (like health bar or something), going through differents scene (some different levels). I was thinking about DDOL which is kinda mandatory in my opinion, but I wanna know if using singletons is a good practice. (I precise that player and canvas will spawn each time the player start his game, to respawn where he was in the good scene)

cosmic quail
final depot
#

Why can I not get this to work, I'm trying to tip something over when it gets hit, and it just ain't working.

I've got a duck, it's a 2d sprite renderer with a rigidbody, and a box collider. The "hit" on the duck is registering fine, but my code to make it tip over essentially makes zero change to it's X rotation.

public void OnHit()
{
    
    rb.isKinematic = false;
    rb.angularVelocity = transform.right * Mathf.Deg2Rad * fallSpeed;

With the fallspeed set at 30 (should be 30 degrees per second, so 3 seconds to tip over)

I also tried using the add torque option, and it doesn't seem to do anything either

languid pagoda
final depot
#

It will happily spin on other axis if I don't constrain it, so I'm wondering if transform.right is the problem

half notch
sour fulcrum
#

singletons are fine

#

tbh

#

They are used very commonly

half notch
#

I'm developing a metroidvania game, so i think it can be ok to test code easily, because player can spawn where he rested for the last time

languid pagoda
sour fulcrum
#

no clue what your on about hot reload wise

#

and a overwelming majority of anyone coming into this channel is not unit testing

half notch
sour fulcrum
#

i know what hot reload is

languid pagoda
#

Yep

sour fulcrum
#

i dont know why they think singletons as a concept break it

languid pagoda
#

Then you should know hot reload breaks them

half notch
#

Yeah, but with singletons, when u reload, singleton is passed to null after reloading

sour fulcrum
#

so you use a getter that null checks?

half notch
#

yeah but if u need the singleton in the code u're currently writing, it won't work lol

sour fulcrum
#

no?

naive pawn
sour fulcrum
#

oh they mean like hot hot reload

#

fuck that

languid pagoda
#

or you could just stop being lazy and do it right instead of spending more time adding bandaids to fix the problem

sour fulcrum
#

people are making indie games here

half notch
#

I just asked for a clean structure code for this kind of stuff I wrote guys, chill x)

sour fulcrum
#

unity's biggest games use singletons

languid pagoda
#

That doesn't mean its the right way to do something

sour fulcrum
languid pagoda
#

he came in here specifically asking for the right way to do something

naive pawn
#

man what is going on lately...

#

it feels like so many chats are chaos lmao

half notch
sour fulcrum
#

I just think mentioning unit testing as a major factor in the context that this is code-beginner is just not really relevant to the extent the comment implies it might be

#

unit testing is great but like

naive pawn
#

singletons (both the c# and the unity kind) are not bad practice, singletons are just a pattern
misusing the pattern is bad practice, and some patterns are easy to accidentally misuse - singletons kinda fall into that category

languid pagoda
sour fulcrum
#

hot reloading breaks the features of the framework your using it in 😄

naive pawn
#

cool, but singletons aren't that...?

#

aren't necessarily that, anyways

sour fulcrum
#

also your kinda downplaying the value of that "convenience"

naive pawn
#

having a single static known reference to the only valid instance of a component/class isn't a "convenience" thing, i'd say

half notch
#

So if i understand well, singletons is not a bad practice, but if we can misuse, can you give me some advice to not fall in misusing the pattern? (sorry if that sentence is bad, i'm not really english 😭 )

runic lance
#

if you're not doing dependency injection and you're handling domain reloading (or lack of it), I don't see why the singletons would be bad

naive pawn
languid pagoda
#

They''re brittle and cause hidden dependencies, you can also wind up with stale data in editor because static fields dont reset between runs, they survive scene swaps as well which can be undesired. you cant replace an implementation without editing the callers I could go on and on

#

You can make a nice cleaner solution with interfaces/scriptable objects that have none of these problems

naive pawn
#

about your original question, i don't think a singleton really fits in there at all? the player can just manage itself

naive pawn
half notch
#

So for example i have my player with a playerhealth script, and a canvas (the entire object will be in DDOL), i can do PlayerHealthUI as a singleton, to call it like PlayerHealthUI.Instance.UpdateUI(healthValue); directly ?

naive pawn
#

if they're DDOL, why not just maintain a reference to it directly

#

what benefit is the singleton giving you

cosmic quail
naive pawn
#

that's.. not what the question is about

#

not sure why you're asking that

half notch
#

in my case, the player and the canvas is in DDOL

naive pawn
#

it's not even about referencing the player

half notch
#

so i can reeference directly ?

naive pawn
#

yeah

half notch
#

oh really, i didn't know that, that's crazy man

#

and if i load a new scene asynchronoously, it will work ?

#

like the reference won't disappear ?

naive pawn
#

yeah, the DDOL stuff is effectively in its own scene

languid pagoda
cosmic quail
half notch
#

yeah but generally I use singleton only if i can't use references

naive pawn
half notch
#

For example, a game manager script can be singleton, because drag a game manager everywhere can be a problem

naive pawn
#

for example in my project, my structure has "central" stuff in a central scene with a GameManager singleton (where the central scene is kept loaded, like DDOL)

#

the gamemanager then controls references to important objects like the player and the camera

#

there's a lot of ways to design it

half notch
#

Oooh i see, that's a nice point of view

#

And another question (yeah i have many, because i didn't see anything about this when I googled this), is it better to have multiple canvas with some objects in each, like one canvas for HUD, one canvas for pause menu, etc or have one canvas with everything

naive pawn
#

in terms of structure or performance?

half notch
#

performance, because structure might be quite the same i guess

naive pawn
#

iirc there's some stuff about dirtying canvases and batched draw calls in terms of performance, i don't really recall which is better

cosmic quail
#

yeah multiple canvases is good for performance, but you can have them all as a child of a parent canvas

#

because changing something within a canvas dirties everything else in that canvas

naive pawn
#

i personally have them in separate root canvases just to make it easy to modify them, but that's with my preferred editing style

half notch
#

U mean having one canvas component, and the children of this object are also canvases? i don't understand

naive pawn
#

your mileage may vary

cosmic quail
half notch
#

Yeah but having a canvas like this

Object (parent) -> Canvas component
- Object (child 1) -> canvas component
- Object (child 2) -> canvas component

The canvas component on the parent is useless no ?

cosmic quail
#

well keeping them separate actually requires you to set the settings for all of them, but the child canvas will inherit from the parent canvas, so it's easier to keep them all under one canvas i guess

half notch
naive pawn
#

just commit to the list!

- parent
  - child 1
  - child 2
half notch
#

Usually for my health part I wanted to use an event on playerhealth, and playerhealthUI listens to it on OnEnable() method , and unsubscribe from it on OnDisable() method. However, i don't think if it can works with DDOL

naive pawn
#

why not

cosmic quail
half notch
#

I've already seen some OnEnable() not working due to script order or some stuff like that

#

so since this problem i'm kinda not using those two methods

naive pawn
#

that sounds like a misdiagnosis

naive pawn
#

OnEnable will be called when an component gets enabled, including as part of its parent object getting activated

half notch
#

oh okay, yeah I was using OnEnable() method with SomeClass.Instance.OnAnCertainEvent += Method
and the instance is not created yet

#

I did that for the InputController in which i manage all of the inputs, so i put inputcontroller before all the scripts, and that fixed my problem

naive pawn
#

so OnEnable is working, it's the subscription that isn't

half notch
#

yeah yeah true, i didn't explain correctly mb

naive pawn
#

if it's a singleton, could you perhaps just make the event static

#

i don't recall if that's a thing you can do

half notch
#

huh yeah true

#

I kinda really like using some event handler

lunar coral
#

hi,I'm moving a door by script, a script I've made months ago that worked really well,it's basically rotating a"pivot" parent gameobject of the door that's in a good position, but this time I've simply exported the prefab of the door from a project and imported it into another project and now, when I try to open the door, the door moves,I can go thru, but the mesh doesn't,basically,I don't see the door move, but my player can go through it and collides with the part where the door should be when it's opened

dreamy scarab
#

hi again

#

i think its not really a beginners code question...
but how can i show a object type variable in the inspector?

rich adder
dreamy scarab
#

only with custom editor?

rich adder
#

they're all technically objects..

dreamy scarab
#

lower case object

rich adder
#

would you mind explaining the usecase ?

wintry quarry
polar acorn
#

What are you intending to actually use for this in the inspector?

dreamy scarab
#

not the class one the variable one

polar acorn
#

What kinds of things are you expecting to set this to?

naive pawn
#

but no, it's not a serializable type, unity won't serialize it

dreamy scarab
#

fck ._.

#

ok ok

wintry quarry
naive pawn
#

this sounds like an x/y problem

dreamy scarab
#

im doing a custom if else system for nodes on unity

naive pawn
#

you would probably have some base type that you've marked serializable for that, no?

dreamy scarab
#

ok, wait

polar acorn
#

Considering that you'd need an inspector equally capable of referencing "The enemy that's on the left side", "7", "False", and "The vague notion of a burrito", you'd need to have a pretty damned good idea for a UI for this to make a custom inspector

dreamy scarab
#

from the page i saw

#

im explaining things badly again

#

let me try again

naive pawn
#

take a second to collect your thoughts first

lunar coral
dreamy scarab
#

im making a date sim.

to make my other teamates lives easyer im also making a custom dialogue system with nodes.

the node system is tied with a scriptable object that have all characters data on it.

so every image, sounds are in this scriptable object and the node system has a quick acess to it, making it more easy to acess...

currently im making the characters savables (idk how to say it) stuffs... like how many times the player gives a flower to a character, if the player has done a X action with the character and so on...

from the idea of the game most of the variables are unique (not all characters have the same variables)... so thats why im making it this way

#

i was checking on the class insted of the node to see how the class i maded was show in the inspector

#

and its only displays the variable name

polar acorn
#

So, what kinds of things do you expect to set "value" to

dreamy scarab
polar acorn
#

Like, strings, numbers, etc. or are you going to have to refer to specific game objects

dreamy scarab
#

thats why im using object...
idk all the stuffs they want to place

#

/ store

#

/ save

#

from the node itself i can filter it and give it a proper field

polar acorn
#

You're not going to be able to design a system without first thinking about what kinds of data is going to pass through it

dreamy scarab
#

but i wanted a quick display on the inspector as well

languid pagoda
dreamy scarab
#

actualy no... but in some ways yes

#

all npcs have the same class

#

to dont fuck with the dialogue display

#

but i needed a independent variable storage

#

let me give a example

dreamy scarab
#

oh

#

let me give a shot

languid pagoda
#

I think thats what you're looking for

dreamy scarab
#

^-^

languid pagoda
#

just put public CustomDataContainer customData; in one of your scripts and check it out in the inspector

dreamy scarab
#

sorry for the delay, i had to made some ajustments, but i worked ^-^

#

tks

simple hawk
#

https://paste.mod.gg/jrriobfhxcbp/0

I was following a tutorial and came across a section where the guy made some code to make it so when the player hugs a wall and moves diagonally, they actually move (lines 36-60). I followed the code down to everything, but for some reason my charactter isnt moving, the input values and boolean are working but the character wont move, what did I do wrong?

languid pelican
#

Hi guys I don't know if that's the right channel to ask, but I am really trying hard to build my game but I am so bad at programming, does someone know how I can do a camera which works like the one in genshin impact ? I wouldlike to do a camera like this in my game

wintry quarry
#

what's with the #regions around your comments btw

#

And for god's sake don't write comments like this: //we need this method for the setbool code in playerAnimator, whenever it is run, it will return the value of the isWalking variable you're absolutely wasting your time

simple hawk
simple hawk
polar acorn
wintry quarry
# simple hawk How do u mean?

debugging is the process of using ddebugging tools such as log statements or a debugger to step through your code and see what's going wrong.

simple hawk
#

Oh, debug.log, mb, no idea why that confused me

wintry quarry
simple hawk
#

Ye, will need to do more research on that, debug.log is the only one I know

#

Thnx

summer wren
#

Anywhere I can talk about NodeJS and NetCode server handling? It involves a lot of C# Unity too xD
My project it is close. Just missing something and cannot pinpoint the issue.
Would appreciate very much if perhaps someone familiar with backend code could message about it, considering this may not be the correct channel to post in for backend coding.
It just relates a lot with my Unity project.
My issue is basically about NetCode Player synchronisation in Unity clients with NetCode.
Players they just forever go in the same direction from last input!
So one clicks D to move left and X+ forever

ripe shard
summer wren
ripe shard
#

Make a thread in #1390346492019212368 and see if anyone there can help you with the unity specifics of your issue.

ripe shard
summer wren
quiet hazel
#

How can I get a canvas Unity to adjust itself to the players screen so that if someone else is playing the game the UI is not all over the place?

wintry quarry
languid pagoda
#

Why is it sometimes the door/hand animations sync and other times they dont?

  var st = anim.GetCurrentAnimatorStateInfo(0);
  var nxt = anim.GetNextAnimatorStateInfo(0);

  // Ensure we’re in the target state
  int activeHash = st.shortNameHash;
  float t = st.normalizedTime;
  if (inTransition && nxt.shortNameHash == stateHash) { activeHash = nxt.shortNameHash; t = nxt.normalizedTime; }

  if (activeHash != stateHash) break; // left the state

  // Phase = 0..1 in the current loop
  float phase = t - Mathf.Floor(t);

  if(phase >= 0.08f)
  {
      vehicleAnimator.SetInteger("doorIDX", vehicle.entranceData[idx].index);
  }

  if(phase >= 0.55f)
  {
      vehicleAnimator.SetInteger("doorIDX", -1);
  }
wintry quarry
languid pagoda
wintry quarry
#

At worst you have a glue script that calls the abstract method

#

it can absolutely be done with an animation event

languid pagoda
#

It can but its going to be a pain in the ass. Is there a reason why my current code is providing inconsistent results? almost seems like its framerate dependant or something which doesn't seem correct cause all the code is doing is playing an animation on a different animator when the currentAnimation is at a certain time.

wintry quarry
#

you're trying to do things at specific points/times in the animation

#

but that's just not how frames work

#

this is precisely what animation events are for

wintry quarry
#

you're just starting it fresh whenever you see it

#

and since Unity doesn't have a fixed framerate, that's going to be at different points in the animation each time

#

you would need to pass in the actual animation progress and match it on the other animator

languid pagoda
#

I guess that is why I am surprised its framerate dependant

#

because its going off percentage completed not time.

#

oh wait I understand now. If animation is running at 30fps and its a 60 frame animation it will take 1 second to complete at 60 fps so the percentage complete is going to be wrong cause its using normalizedTime to calculate it.

granite cedar
#

I am new to Unity and I am working on a program for school where I need to add UI that appears on the camera view and shows the buttons for movement, could anyone help me with this? I cannot find any tutorial for it online, although i may not be searching the right thing. Thank you!

ivory bobcat
#

!collab

radiant voidBOT
# ivory bobcat !collab

: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**

wintry quarry
#

it's going to happen at a random point between them

#

so you will need to fast forward or rewind the other animation to sync with the point the animation is actually at when your frame happens

ivory bobcat
# ivory bobcat !collab

If you're needing help with something specifically, post the necessary information and question in one of the appropriate channels

languid pagoda
#

Thank you

shell orchid
#

for some reason when i walk on a slope it slows me down but i can still go up them. when i walk up terraign thats high it stops me. Is there any way to make the slopes be treated like flat ground. the tutorial i followed had the guy go up slopes just fine and i have everything he has applied https://pastebin.com/NVf7eMiC

vale karma
#

Is this a bug? idk why i cant enter anything into this scriptable objects char variable. Why will it let me to everything else but this one char entry?

winged ridge
vale karma
#

i changed it to a string and it seemed to fix things. Idk why it works in the last script im pulling it from but not in this one. weird

#

its not ai, handwritten. Im converting my project to Unity 6.2 and also upgrading some stuff and pulling it over is a bit difficult

winged ridge
#

It would be easier if each variable had a line, it may be a bug with char but odd if it is... If it works as a string and you are happy going forwards with that then do so. However if it's literally just for selecting states IE is state a do X then enum, that's what it's there for.
As for converting.. unless you went from pre 2022 to 6.2... a lot of your code should be fine

eternal needle
eternal needle
# winged ridge It would be easier if each variable had a line, it may be a bug with char but od...

it doesnt matter if its on one line, its the same. its just not a commonly used way of declaring variables but has been valid for a long time and in other languages too
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/declarations

You can declare multiple variables of the same type in one statement, as the following example shows:
string greeting;
int a, b, c;
List<double> xs;

#

trying it myself it also is a bug in 6.1 so its been there for a few months at least

winged ridge
#

I agree it doesn't matter, but for bug fixing and changing your code. It's easier if it's not and that's what I was saying.

eternal needle
#

<@&502884371011731486> spam

eternal needle
#

i dont see any posts online about this bug either so it really is worth reporting too

winged ridge
#

It seems an odd bug.. can they be attributed in the code itself and then show up in UI or as a debug log? Or is it just UI bug?

eternal needle
#

you can still assign the value in code yes. It seems that also allows you to change the value to another char but not actually remove the value (cant go from 'a' to ''). Anyways its up to unity to solve if they are merciful enough

#

im also making a bug report

winged ridge
#

If you can, don't forget the how to replicate part.. as obvious as it seems.. I work with buggy software daily and wish they had bug report features that allowed it

autumn osprey
#

hey, need some help with UI. i'm getting a null pointer with "object reference not set to an instance of an object." narrowed the issue down to the following lines of code:

        Text startText = startMenu.GetComponent<Text>(); //also tried GetComponentInChild
        startText.text = "text";

where startMenu is just

    public GameObject startMenu;

my goal is just to get access to the text object in here to edit it. what's wrong with the way i'm trying to assign it? getcomponentinchild is what most people are suggesting to use to pull a child out from what i can tell

eternal needle
#

unless you're using legacy text, that should likely be a text mesh pro component

autumn osprey
#

oh it's startText, sorry for not specifying

#

oh wow i just really did not comprehend text and textmeshpro were entirely separate from eachother 😭 thank you so much

#

okay nevermind it didn't fix anything

#

my bad on that one, i think i may have implemented it wrong but i do think it probably has something to do with this

#
        TextMeshPro startText = startMenu.GetComponentInChildren<TextMeshPro>();
``` is what i changed it to
keen dew
#

TMP_Text

autumn osprey
#

thank you both so much it's 100% working now

keen dew
#

You can also just have [SerializeField] private TMP_Text startText; and drag the text element there so you don't need GetComponent at all

autumn osprey
#

oh yeah this is fair, main reason i wanted to do this way is because i have a handful of different menus, and they will each have a lot of text that will need to be changed within them from this script. i would need to drag every individual objs in

unsure if this is the most efficient way to change the GUI and i would likely alter my approach if I needed this for anything larger scale, but GetComponents is saving my life atm

light cave
#

im dumb

#

how to check if a cube and a sphere touches eachother

#

i put the script on the cube

#
void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Basketball"))
        {
            //Reset the basketball position 
            GameObject basketball = GameObject.Find("Basketball");
            basketball.GetComponent<Rigidbody>().useGravity = false;
            basketball.GetComponent<Rigidbody>().velocity = Vector3.zero;
            basketball.transform.position = new Vector3(0, 1, 0);
            //Reset Score
            Bounce.score = 0;
            GameObject.Find("ScoreText").GetComponent<TMPro.TextMeshProUGUI>().text = "Score: " + Bounce.score;
        }
    }
    void Update()
    {
        OnTriggerEnter(GetComponent<Collider>());
    }
#

is this dumb chat

versed light
#

for graphics api you can render submeshes with different matrices is there a way to do that for mesh renderer or would i have to seperate the submesh to its own gameobject

naive pawn
light cave
naive pawn
#

you also don't need that OnTriggerEnter call in Update. that's not how messages work

#

is that supposed to be a deflection, or...

#

perhaps step back and take some time to get that understanding first, then

fiery marlin
#

Question, not sure if this is the correct place. I'm having trouble to wrap my head around a good/practical way of implementing a cutscene. Just to sketch the situation. There are 3 phases

  • Intro - Includes flickering of lights and spawns an NPC
  • Dialog - The player is shown text and needs to confirm to continue
  • Ending - npc goes away and a menu appears

How would you approach this?

Edit: I've looked at using a big timeline for all the phases with a pause or time machine (austin 2017 - A Terrible Kingdom (Scripting for Timeline)), having different timelines for each section or none for the dialog. Doing everything with scrips, etc etc. Kinda lost in the woods 🙈😂

hexed terrace
#

timeline(s) with signals

fiery marlin
#

What tutorial can you recommend for this approach? I'm worried of losing overview if the timeline becomes too divided.

hexed terrace
#

I haven't watched any timeline tutorials for years, so none come to mind. If you haven't touched them before then start with whatever !learn 👇 has

#

!learn

radiant voidBOT
hexed terrace
#

You'll want to find newer stuff, I think. Something from 2017 won't have signals - they didn't exist then

fiery marlin
#

Alright, thanks 🙏

full axle
#

Hey can someone help me with my assignment if you’re free

#

I really don’t understand collision with the coins or collision with the potions

naive pawn
full axle
naive pawn
#

those are gonna be quite specific to what code is already given to you

full axle
#

Isn’t that basic stuff

naive pawn
# full axle Isn’t that basic stuff

i mean, if you think they are, sure. but there are multiple ways to do them, so which method is appropriate depends on how your project is already structured. it sounds like you've already been given a project with some scaffolding, is that correct?

full axle
naive pawn
#

you don't have a script with an inventory system?

#

or an existing audiosource, stuff like that?

full axle
#

Nope

#

I can just get an audio file from online but not an audio source

naive pawn
full axle
naive pawn
#

have you tried googling just something like "how to play sound effect unity"

full axle
naive pawn
full axle
naive pawn
#

that wholly depends on how the inventory itself works

#

you aren't really giving us much info to work with

full axle
#

It’s supposed to start at 0

#

And whenever the player touches a potion it goes up by 1

naive pawn
#

so sounds like you have an UpdateData method that is supposed to handle that

full axle
naive pawn
#

...manage the inventory?

#

what else would i mean

full axle
#

How would I type that out

naive pawn
#

you call UpdateData, the method that it's telling you to call, with the appropriate parameters

#

i'm not over your shoulder, i'm not psychic lmao. i don't magically know the entire project structure

#

if you can't figure out how to call a function, there are beginner c# resources pinned in this channel

full axle
#

Does this help?

naive pawn
#

not really, no.

images of screens are just horrible to look at, code should be shared as text, and this isn't even the context i'd need to help you lmao

#

you gotta put in some effort into understanding what you need to do, or at least explaining what you actually need help with

#

im not playing this game of telephone to tell you what you need to pass to a method that you know of

full axle
#

The game manager picture is not loading

#

That’ll help you with more context

#

Sorry where I’m at right now I can’t send the code as text

#

Is it making more sense now?

grand snow
#

!screenshots

radiant voidBOT
grand snow
#

you can use discord in the browser

full axle
grand snow
#

so people want to help you?

#

its unplesent to read code from a cruddy picture of a screen

full axle
#

No I mean like how does that change my ability to send screenshots

grand snow
#

then you SEND CODE AS TEXT

rough sluice
full axle
naive pawn
#

!code

radiant voidBOT
naive pawn
#

you can use paste sites

rough sluice
naive pawn
grand snow
#

if its not yours then try to use a paste site still

rough sluice
full axle
shell sorrel
grand snow
#

many people ask for help here. the one asking should try to make receiving help easy

full axle
shell sorrel
#

so code as a screenshot is terrible to read, and even worse in your case where its a picture. Its way easier for others to read and edit it, and talk about it with line numbers on a paste site or as tiny snippets in chat

hexed terrace
rough sluice
hexed terrace
turbid plover
#

Im wondering how can I make or configure lighting on through script?

Im trying to make an impact frame and as for my past developing experience that's how I do it outside unity

hexed terrace
#

"impact frame" ? Like a flash of white ?

#

If that's the case, you'd be better off doing that with either:

  • a white image (UI) that covers the screen and you change the alpha of it. Though this is a cheap, meh way.
  • Use post processing for that "impact frame" and lerp the weight from 0->1->0 in whatever timeframe you need
turbid plover
# hexed terrace "impact frame" ? Like a flash of white ?

Impact frame is technically a flash of white but it focus some defined effects and focus on the subject

Lemme explain how I do it outside unity

when I want to focus it to an object I make the saturation -1 to make it black and white and make a kinda like fog effect that's black to focus on its surrounding, then optionally highlight the focused Object

polar acorn
turbid plover
hexed terrace
#

You can configure lighting through code. Your scene lighting won't be what you want, you'd need to have a list of all the lights that will be affected by the impact.

turbid plover
#

Thanks, really help

full axle
#

I’m not intentionally making it difficult I didn’t think people cared how I sent my work until someone told me since it’s basically the same thing just not completely flat like a screenshot

polar acorn
#

People can't Ctrl+f a screenshot

#

People can't copy out a screenshot to their own installations to check something in their own setup

turbid plover
#

One more though,

Lets say I have a script that doesnt inherite something, how do I attach an object or define an object to that? Since there's no variable to pass it through

hexed terrace
eager spindle
turbid plover
hexed terrace
#

Never use GameObject.Find .. and if it's not a MonoBehaviour (on a gameobject), that wouldn't find it anyway

eager spindle
#

GameObject.Find finds GameObjects

rich adder
shell sorrel
rich adder
#

but yeah Find is def horrid..don't use that lol

eager spindle
#
public class SaveData {
  public Vector3 lastPosition;
  public float money;
}
public class SaveManager : MonoBehaviour {
  public SaveData data; 
}

public class PlayerData : MonoBehaviour {
  [SerializeField] SaveManager saveManager; // drag your SaveManager in here!

  public void Start() {
    Debug.Log($"The player has {saveManager.data.money} coins!"
  }
}

SaveManager has a reference to SaveData, which doesn't inherit anything. SaveData has money property.

Since you have a reference to SaveManager, you can access the SaveManager's saveData and then access the money from there

rich adder
#

I usually have SaveData living on a DataManager singleton or something most times
so i just do DataManager.Instance.SaveData

#

hmm yeah so like [SerializeField] is your best bet usually, unless you need cross-scene or runtime references

turbid plover
#

I mean im just trynna do OOP for absolutely everything but what im thinking now is making new Class with a variable/argument we need for it to work

I guess this knowledge isnt that big of a deal so you guys can rest now lol

rich adder
eager spindle
#

yes

turbid plover
rich adder
turbid plover
#

Does that work the same?

rich adder
#

c# is basically Java

turbid plover
#

Yea

rich adder
#

*improved java (arguably)

turbid plover
#

Does it also work this way?

shell sorrel
rich adder
shell sorrel
#

like java did not even have value types outside of primitives for a long long time

turbid plover
#

Appreciate you guys for helpin me lol

rich adder
#

speaking of value types, you also have struct you can use instead of class

silk night
rich adder
#

its debatable on benefits but I usually prefer struct over class when dealing with just value types contained
also its more efficient / a requirement sometimes for net..

shell sorrel
shell sorrel
turbid plover
shell sorrel
#

C# is not really part of the C/C++ family

turbid plover
#

Really?

shell sorrel
#

its Microsoft Java

naive pawn
rich adder
turbid plover
naive pawn
#

syntactically, the c/c++ family encompasses c#, java, js too

shell sorrel
#

that is like C or Lisp that would cover everything

ancient quail
#

Hello, I am new at Unity. Does anyone know why I can't set tilemap's tile anchor values? I cannot add a new layer because of this.

rich adder
#

also this is a code channel

turbid plover
rich adder
eternal needle
naive pawn
rich adder
#

we splittin atoms here

shell sorrel
naive pawn
#

also syntactically there'd also be the if..then and if : groups

naive pawn
rich adder
#

all I know its a pain in the ass sometimes working with Marshalling and Goddamn C/C++ structs to c# structs 😵‍💫
...embedded systems..

turbid plover
#

Ahh at the end of the day it all just convert it to binary

shell sorrel
rich adder
#

"oh yeah my value for xPos is now 128328123" wtf

shell sorrel
turbid plover
#

The first programmer was a woman prolly why we're all debating what is on or what is with lol ( no offense for all woman out there dont unalive me)

#

Peace be with yall, imma go out with ma baddie

rich adder
silk night
naive pawn
#

let me guess, endianness also reared its ugly face lol

rich adder
#

ah yea i think that was the keyword I think "endianness"

shell sorrel
rich adder
#

now you somewhat know my pain catcrymic

naive pawn
#

oh my god i just realized HaachamAAA

shell sorrel
naive pawn
#

damn that's way off topic, not sure i can adequately summarize it avoiding a tangent lmao

naive pawn
#

i once wrote a solution to a competitive programming thing and i used a char[] representing 48-bit numbers (32 bit had overflow, 64 bit used too much memory)

im just now realizing i couldve just used an array of a struct of 3 chars and that wouldntve used extra memory for alignment and i couldve had a method to read out 64bit values for math easily

shell sorrel
rich adder
delicate laurel
#

I followed unity guide, but use Rider instead of visual studio. I have tried to add project Class Library inside unity project Solution, but it disabled in Solution view. Also it inform me that it deleted project, why?

grand snow
#

and they have no affect on code compilation

wintry quarry
#

use a separate C# project for developing the source generator and use it to export the DLL

mild furnace
#

Any clue why VSCode makes use of ripgrep when tabbing back into unity?
Its maxxing out my cpu causing the editor play to take about 20-30 seconds. Closing vscode makes it almost instant

#

I've disabled all the AI features, and use of symlinks.
This project is fairly large but I've had no performance issues until recently

#

Iteration time is way too slow now

hardy wing
mild furnace
#

Should I switch to Rider?
I'm running short on time, tired of updates making tools unusuable

hexed terrace
#

Rider and VS are "better" than VSC.

Rider isn't free though.

slender nymph
#

well, it is if you're using it for non-commercial or open source work

rich adder
grand snow
#

none are free

#

for individuals its usually fine but otherwise no

rich adder
#

ya VSC C# Devkit and VS both have the same license.. but at least you can do commercially.. until you need to use the enterprise edition

mild furnace
#

Big cpu spikes on processes relating to ripgrep.exe every time I tab from vsc back to the editor

rich adder
#

ohh then thats..weirdd.. if it helps I havent updated c# extension since like May

mild furnace
#

I’ve turned off background analysis which seemed to lower the general cpu usage, but not these spikes

#

Idk if it’s the “hot reload” settings in c# dev kit

rich adder
#

sounds more of Windows issue.. I search ripgrep.exe some old from 2022 VSC forum posts also come up..

rich adder
hallow acorn
#

hey what can cause my OnTriggerEnter not to get called?

naive pawn
hallow acorn
rocky canyon
#

Rider is only free for non-commercial use
keep that in mind b4 swapping over

hexed jungle
#

hi

hexed terrace
#

this is a channel for help with code. Im not sure if this question is even relevant to this server.. if it is delete from here and ask in #💻┃unity-talk

hexed jungle
#

ok sorry

frosty surge
#

Hi guys, im from italy and i have some questions to do to someone who knows about netcode and how to do a multiplayer game.
Just have some questions about it and i absolutely dont want to disturb anyone, if someone want to help me, please dm me
|| (idk if i can ask this thing here, tell me if im wrong or something else) ||

slender nymph
polar acorn
#

Also it's a good idea to just ask the questions instead of looking for one-on-one support

frosty surge
formal swan
#

Hi, I have just begun learning Unity, I was writing the scipt and an error CS0103 showed up. It said the name "spawnPipe" does not exist in the current content, but the name is literally established below this. Why is that?

polar acorn
brave robin
polar acorn
#

SpawnPipe exists only inside of Update.

formal swan
#

hmm how do I fix that?

polar acorn
#

Chances are, you don't want to do that

brave robin
#

Move SpawnPipe() outside of Update(), right now it's within its enclosing brackets

formal swan
#

Ok let me try

#

How about now? Think it's gonna work?

formal swan
#

yayyyy its workingggg :0

#

hm the tutorial did it the previous way, so that was confusing

shy iron
#

Hello everyone. I have a good idea for a 2D game, I think. But I don't have any experience creating it. There are only a couple of artists.
If anyone is interested in creating my idea, you can message me. I don't speak English.****

formal swan
#

Thx guys! Also, since im still grasping the basics, the words in the script r sometimes colour-coded in yellow, green or blue. What do those represent?

radiant voidBOT
# slender nymph !collab 👇

: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**

formal swan
shell sorrel
shell sorrel
#

SpawnPipe is after the closing brace of Update

formal swan
#

ooohhhhh i see it now, it's so hard to catch XD

#

man, coding for the first time makes me feel dumb lol

polar acorn
# formal swan Yea 👀
"I did it exactly like the tutorial so why does theirs work and mine doesn't" counter:
Number of times it wasn't exactly like the tutorial: 193
Number of times it was exactly like the tutorial: 5
Number of times the code literally did not exist: 1
2022-07-19 to 2025-10-02
shell sorrel
#

it gets easier once you been at it for a while

polar acorn
#

192 other people have made similar mistakes, and those are just the ones I've noticed

#

(yes this is a real counter)

formal swan
#

lmao u actually counted

#

thx guys, it's rly helpful^^

bitter bobcat
#

hey folks, can yall help me a fix somethin, shouldnt take too long

radiant voidBOT
# eternal needle !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

bitter bobcat
#

I have this weird glitch where I built an interaction system, but it would only register from one side of every object

slender nymph
#

did you end up configuring your IDE yet? because if so i can tell you what your issue was

bitter bobcat
#

I think so

slender nymph
#

show it

bitter bobcat
#

how do I check

slender nymph
#

screenshot your entire vs code window

noble rover
bitter bobcat
#

did I do it ?

slender nymph
#

like, you can literally see on your screen why it isn't configured too, so consider actually paying attention to the information presented to you

rocky canyon
#

yes ^ what box said..

noble rover
bitter bobcat
#

Im downloading a net sdk

#

hope it works

rocky canyon
#

but from what little we can see the .net was the reason it wasn't configured correctly

slender nymph
#

the link i provided also has thorough troubleshooting steps to get it fully working

soft lotus
#

How do i parse a hex string (like, lets say "00ffaa") into an actual colour struct?

#

is there an easy method, or do i have to do parse it as individual r, g and b values and then combine em into the struct

soft lotus
#

THANKS

bitter bobcat
#

K im back, lemme see if it worked out

#

how should it look ?

slender nymph
#

you should now have syntax highlighting for unity types as well as built in stuff

bitter bobcat
#

doesnt seem to be workin out

slender nymph
#

you'll know it's working when MonoBehaviour, Transform, Input, Ray, RaycastHit, and Physics are all the same color as IInteractable since they are all types

bitter bobcat
#

fucking finally

slender nymph
#

great! now your issue is that you are using Vector3.forward for the direction of your Ray, that's forward along the world Z axis and will never change. presumably you want it to point the same way your interactorSource is so use its forward

bitter bobcat
#

how do I determine its foward

slender nymph
#

hint: look at the docs for Transform

bitter bobcat
#

so I change it to vector3.interactorsource ?

slender nymph
#

no, that would make 0 sense at all

bitter bobcat
#

I suppose youre right

slender nymph
#

did you look at the documentation for the Transform class yet? considering InteractorSource is a Transform?

rich adder
bitter bobcat
#

how do I do that

#

youll have to walk me through this one

rich adder
#

did you look at the docs like suggested ?

#

look at the Properties

bitter bobcat
#

alright

#

lemme see

#

does it have somethin to do with the EulerAngle functions ?

rich adder
#

not at all no

bitter bobcat
#

localrotation

rich adder
#

you want a direction not a rotation

slender nymph
#

stop guessing and read what i told you then read the properties of the class

rich adder
#

only the "Properties" section is important, you can ignore the rest.. Look carefully

bitter bobcat
#

I can only find rotations and positions

#

dude, please

slender nymph
#

i already told you exactly what property you need, you just need to fucking read what i said

rich adder
bitter bobcat
#

Damnit

rich adder
#

based on what was said to you .. if its not Vector.forward then it must be.....

bitter bobcat
#

Vector.localrotation ?

slender nymph
#

jesus christ

bitter bobcat
#

Yeah, I get it, fuckin hell

rich adder
#

thats why Transform was mentioned

#

its literally one of the top results in the doc page I sent

#

com on man lol

bitter bobcat
#

InteractorSOurce.foward ?

rich adder
#

there we go..

bitter bobcat
#

thanks for the patience

#

means alot to me

rich adder
#

if you click the docs for it

bitter bobcat
#

Yeah, Ill be looking through those and trying to piece it together next time

#

bookmarked the docs already

#

have a nice day

golden solar
#

Is anyone getting issues with fields appearing invisible in the inspector in Unity 6.2 (6000.2.6f1)? Happens often when I click on a game object

slender nymph
#

seems there are a bunch of issues with the inspector in that version. you can try restarting the editor, if that doesn't work then close the editor, delete the Library folder from within your project, then open it again and it should hopefully work properly again

brave robin
#

I'll have to try that tonight. It also spams a lot of errors to console related to its own inspector UI

golden solar
rich adder
#

that version is probably busted

slender nymph
#

yeah seems that way, i've seen a lot of issues with it from people

rich adder
#

lots of people seems to be having issues with inspector not drawing properly

slender nymph
radiant voidBOT
# slender nymph !bug file a bug report 👇 then maybe switch to another version and test that
Reporting bugs

🪲 To make bug reporting as quickly as possible, we made a bug reporting application for you. When running Unity choose Help->Report a Bug in the menu, or you can access it directly through the executable in the directory where Unity is installed. It will also launch automatically if you experience a crash.

📝 If your bug report is to do with Documentation, either an error, typo, or omission, you can report it by scrolling to the bottom of the page where you found the issue and click ‘Report a problem on this page’!

💡If your report is to do with a new feature idea, you can check the Unity Product Roadmaps page to see if your idea has already been planned.

For more complete instructions on how to report bugs, access: https://unity3d.com/unity/qa/bug-reporting

golden solar
#

Bug sent 📧➡️

desert temple
#

It's been a little while since I was on Unity for a student project, and certain systems seem to have changed in that interim. I've got:


public class Paddle : MonoBehaviour
{
    public bool isPlayer1;
    public float speed;
    public Rigidbody2D rb;

    private float movement;

    // Update is called once per frame
    void Update()
    {
        if (isPlayer1)
        {
            movement = Input.GetAxisRaw("Vertical");
        }
        else
        {
            movement = Input.GetAxisRaw("Vertical2");
        }

        rb.linearVelocity = new Vector2(rb.linearvelocity.x, movement * speed);
    }
}

I'm getting:
'Rigidbody2D' does not contain a definition for 'linearvelocity' and no accessible extension method 'linearvelocity' accepting a first argument of type 'Rigidbody2D' could be found (are you missing a using directive or an assembly reference?)

There's probably something I'm missing, but I'm not sure what it is since things have changed from the tutorial I'm using.

polar acorn
slender nymph
#

make sure your IDE is configured so you don't make silly spelling mistakes like that

#

!ide

radiant voidBOT
polar acorn
#

Ah, right, that's it

#

I hadn't even noticed

bitter bobcat
#

Maaaa, I need help

dusty trellis
#

Whenever I boot up my game, these error messages come up. They dont affect anything but I was wondering how I make them stop popping up every time I open my project?

I tried deleting the Serialization file but that didnt do it

What happened is I paid a friend to write a script for me, then he changed the names of things for the second revision.

bitter bobcat
#

I dont know why, but I keep jumping without me pressing the key

#

I also seem to be going backwards

desert temple
slender nymph
polar acorn
ivory flower
desert temple
polar acorn
hexed terrace
#

!vs

radiant voidBOT
# hexed terrace !vs
Visual Studio guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

desert temple
#

Wait, why did it change back to linearVelocity...?

hexed terrace
#

that's what it is now, Unity will auto change it - but it prompts first asking you if you want

desert temple
#

This whole process is what I mean by configuring and IDE.

hexed terrace
#

scrolling up, I see now others have said about this, I'll leave it there

desert temple
#

Okay, I'm trying to find the extension in visual studio.

hexed terrace
#

Which extension

#

you don't install any extension in VS, there's a.. module? that you install with VS through the installer.

desert temple
#

I'm looking for the official one, but it ain't showing up, which is frustrating.

hexed terrace
#

You don't need that, it has nothing to do with VS being setup correctly. It's just additional if you want it.

hexed terrace
golden solar
#

I've sent a bug report

carmine summit
#

what should i use if i want to recolor segments of a 2d Sprite according to data from the GameObject (i.e. a table of colors which changes over time)? in other words, tinting different parts of the image on the left to make the image on the right (ignore the stuff that's not the cylinder)

#

i think shaders might be what i want here but i don't know how i'd make the color data accessible to a shader

#

..also i've never written a shader

vital otter
#

having trouble learning animator
for some reason, I cant have the rigidbody affect a sprite unless root motion is enabled, but if it is enabled the animator wont animate the transform. How do I fix this?

wintry quarry
desert temple
slender nymph
#

now you can correctly use linearVelocity (provided you spell it correctly this time)

polar acorn
maiden drum
#

Does anyone has an easier way of finding all objects within a bounding area that doesn't include iterating over all objects in the scene?

Iterating over all objects can take a considerable time if there are thousands of objects.

#

And they don't have colliders, for physics.bounding

#

i know potentially i can make my own n tree, but i assume that unity has it's own for collisions

slender nymph
#

give them colliders then you can use a physics query like OverlapSphere

shell orchid
#

for some reason when i walk on a slope it slows me down but i can still go up them. when i walk up terrain thats high it stops me. Is there any way to make the slopes be treated like flat ground. the tutorial i followed had the guy go up slopes just fine and i have everything he has applied https://pastebin.com/NVf7eMiC

slender nymph
#

you've already got a thread for that in #1390355039272439868 , rather than crossposting it to here you should just bump your thread

shell orchid
#

you can do that

#

howq

maiden drum
slender nymph
shell orchid
#

oh so repost it ight

#

ty

slender nymph
slender nymph
languid pagoda
#

Is there a method that I can use to determine if a position is possible to be reached by a navmeshagent?

slender nymph
languid pagoda
delicate laurel
languid pagoda
#

Thank you anyways tho!

#

im trying to see if something is blocking a destination

slender nymph
#

did you know that you can use sample position and if the position you pass isn't the one returned then that means that position is technically not reachable?

#

there's also CalculatePath which will calculate the whole path

languid pagoda
#

Ok you are right I can totally use SamplePosition then thank you!

slender nymph
maiden drum
#
  • if there is a quad tree implementation in unity
maiden drum
languid pagoda
#

Yeah there are tons of them on github

#

that is what you need

#

spatialhash is better for dynamic objects

maiden drum
#

sounds cool, i never heard of this data structure

languid pagoda
#

I use the one I linked for a level streamer

maiden drum
#

yeah looks like what i'm looking for, essentially I want to find the objects to apply a force to in a spring mesh

languid pagoda
#

Its quiet a handy data structure tbh

delicate laurel
#

Text

Assembly 'Assets/ExampleSourceGenerator.dll' will not be loaded due to errors:
Unable to resolve reference 'Microsoft.CodeAnalysis'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
slender nymph
#

and you've made sure that your source gen project (the actual c# project, not your unity project) has the correct version of the code analysis nuget package installed? and that you've set up the settings for the dll in unity correctly?

#

based on the error, the latter is the issue

static terrace
#

I got a parent with Vertical Group Layout, and it stores some kind of cards and those stuff, but if I have too many cards, it will go over the screen, how do I make it that you can scroll down to see them?

grand snow
#

use a scroll view

#

and have the content use a vertical layout group

delicate laurel
# slender nymph and you've made sure that your source gen project (the actual c# project, not yo...

Documentation says to do

Under Asset Labels, click on the label icon to open the Asset labels sub-menu.

Create and assign a new label called RoslynAnalyzer. To do this, type RoslynAnalyzer in the text input field
of the Asset labels sub-menu and press enter. This label must match exactly and is case sensitive. Once created, the label appears in the Asset labels sub-menu from then on. You can click on the name of the label in the menu to assign it to other analyzers.

But there is no Asset Labels in inspector

slender nymph
#

okay, and what about the first part of that message you are responding to?

delicate laurel
delicate laurel
slender nymph
#

and which version of the editor are you using

delicate laurel
slender nymph
#

then, assuming you've applied the label, you've done everything correctly

delicate laurel
#

I don't get why, but after applying the label, there is no error

#

how does it work?..

languid pagoda
slender nymph
#

yes, but i gave you an alternative that you can use

languid pagoda
#

yeah looking into that now just was making sure I was reading it correctly

true nacelle
#

Hi everyone! I'm a new Unity user, and I'm trying to have a score in a game. The player throws food and when food collides with deer, I want the score to increase. The score variable is in the PlayerController script, and currently I have a public method in PlayerController to increase score by one. the public method is called by the script that detect's collisions for the food. Is this the correct way to do this? Or should I be using serialized fields? Serialized fields are a new concept for me so I'm unsure how to use them.

slender nymph
#

serialized fields are not a replacement for what you are currently doing. you can use a serialized field to assign the desired references, but it wouldn't change the workflow for calling that method (with the exception of removing any Find and GetComponent calls)

true nacelle
#

Okay, that makes more sense now, thank you!

molten vortex
#

For handling UI, does it make sense to use visual scripting for this or no? Specifically I am talking about presistant overlay UI that shows with information on screen.

I also want a sub-ui to open when you click on objects at the cursor

eternal needle
molten vortex
#

Got it

#

Same deal with state machines?

eternal needle
#

It applies to anything. Visual scripting will always be more limited as youre limited to the nodes that exist. The nodes may cover exactly what you need, it may not. Not many people here really use it to give you an answer. There is #1390346878394040320 but still if you can write c#, its better

cosmic dagger
molten vortex
#

Like does using state machines make no sense if you can already use C#

cosmic dagger
molten vortex
#

Ah

eternal needle
#

You can write everything and more in c#. You use a state machine if you need a state machine

cosmic dagger
#

You need to create your state machine using code . . .

#

It has nothing to do with visual scripting . . .

slender nymph
#

state machine is just a design pattern, it has almost nothing to do with visual scripting vs actual code

eternal needle
#

In your UI goal, I dont really see the need for this to be a state machine though, unless youre referring to something else

molten vortex
#

State machine was unrelated to UI

#

For input actions like buttons, is there a way to listen for when it is pressed rather than checking if it is pressed every frame?

slender nymph
#

input actions
this implies you are using the Input System, and if so you can subscribe to the relevant action's performed event

molten vortex
#

How do I do that?

cosmic dagger
ripe shard
molten vortex
#

Thank you

ripe shard
molten vortex
#

So that would replace using the interactAction = InputSystem.actions.FindAction("Interact"); method to get inputs?

molten vortex
#

Got it

#

I assume that is better for performance or does it just offer more functionality?

ripe shard
#

it primarily avoids coupling code to data via arbitrary and brittle string names or hardcoding the input map through the code generator or static API

#

once you have the action reference, functionality is identical

molten vortex
#

But to find the reference there needs to be something to distinguish what input you're getting. I dont understand how it would do that without the name of the action

ripe shard
molten vortex
#

Okay, so instead of searching for the origional action, I assume you would add it as a public variable to the script?

because the declariation: public static InputActionReference Create(InputAction action) Still require a inputaction, thats why I am confused.

rain solar
#

how do high distance renderers have enough RAM to load in that much data?

#

i know they use LODs but they arent cheap in memory

teal viper
# rain solar how do high distance renderers have enough RAM to load in that much data?

What kind of data are you talking about? Aside from assets, it's mostly just transforms, gameobject data and similar stuff. This doesn't consume that much ram. Probably less than a kilobyte per object. With that assumption, a million of GameObjects would consume less than 1GB of RAM. And then there are various techniques to address that as well, like level streaming.

ripe shard
molten vortex
#

Ohhhh okay

#

Okay I got it working but I want to make sure I actually did this correctly:

public InputActionReference interactAction;
    private InputAction _action;
    
    private GameObject selectedObject;
    
    void OnEnable()
    {
        _action = interactAction.ToInputAction();
        _action.Enable();
        _action.performed += MouseClick;
    }

This works but is this leveraging the interact Action Reference appropriatly?

ripe shard
molten vortex
#

Got it

rain solar
ripe shard
# molten vortex Got it

the MouseClick handler is badly named, you are making an assumption about what the input action is, which contradicts the design intent of the whole InputAction abstraction.

teal viper
rain solar
teal viper
rain solar
#

and it ruins the illusion

rain solar
ripe shard
#

load before you move into view

rain solar
#

the loop is already slow

ripe shard
#

then maybe you are loading too much in the first place, sounds like your individual chunks are already too big or inefficiently implemented.

ripe shard
#

otherwise it should be a simple issue of tuning your chunk-load-trigger logic

rain solar
ripe shard
rain solar
#

wym

teal viper
rain solar
#

i can load everything in a sphere around the player instead of frustum. But then how do i efficiently determine what needs to be unloaded or loaded. That involves a massive 3d chunk iteration over the enter render space

teal viper
rain solar
#

loop the frustum's aabb

teal viper
rain solar
#

if i have to distance check a million chunks its not more expensive

ripe shard
#

also, maybe put your chunks into a spatial lookup datastructure

rain solar
#

does that work with LODs?

#

i havent implemented LODs yet

ripe shard
rain solar
#

explain me

#

i have the big dumb

ripe shard
#

time for you to hit the google

rain solar
#

i have

#

it doesnt know

#

i searched all of google

#

every page

ripe shard
#

nobody here is going to give you a tutorial in algorithms and datastructures.

#

you've got the keywords and principles, you need to do some work on your own now.

rain solar
#

can you tell me the structure of the spatial LOD lookup thingy?

#

or if it has a name what its called

ripe shard
#

octtree, rtree, kdtree, bounding volume hierarchy

rain solar
#

oct trees dont allow moving a chunk from one branch to another

#

i have banned them from my vocabulary

#

you have to rebuild them constantly

ripe shard
#

well, you cannot have fast lookup and fast update, thats just the nature of things

#

but you can make update locally bounded, and octtrees are fantastic for that.

#

if you rebuild the entire tree, you need a better algorithm

#

or use another tree

rain solar
#

hmmm ok thanks ill try to implement this

teal viper
#

BTW, what you're doing is definitely not on beginner level. I'd suggest moving future questions to #1390346827005431951 instead.

teal viper
#

Can you stop the spam?

rain solar
#

its solved ish its fine

teal viper
#

<@&502884371011731486> theres seem to be a person having a problem with reading the community conduct here...

north kiln
#

!mute 1358741545708425239 1h muted while we go over this

radiant voidBOT
north kiln
#

!warn 1358741545708425239 if you have nothing meaningful and on-topic to say on this server, say nothing at all. There is no off-topic on this server.

radiant voidBOT
signal vine
#

hey I'm currently trying to create a character selection screen for a game I'm working on, and I'm running into a weird problem where even though I can see the characters listed under the parent gameobject in the scene, I can't seem to see them in the game no matter what I do, I'm happy to check anything or get screenshots of specific parts if anyone has any suggestions or might be able to help

#

it's 2D, they don't appear even when theres no background image, the next character and last character buttons are working to disable/enable the prefabs correctly, I'm not sure what else to check

teal viper
spice ivy
#

ohh man this is embarassing how do i make a script that makes a plant grow 😭 sorry im new and stupid

signal vine
rich adder
signal vine
#

here's the scene itself

teal viper
#

As well as misunderstanding how canvas is working in the scene view.

signal vine
#

starting the game, then clicking play, then clicking next

signal vine
#

the two players under the characters parent are prefabs of the full players with all of the scripts etc

eternal needle
spice ivy
signal vine
#

depends on if you wanted animated growing, something to cause it to grow etc

#

not that I could probably help anyway but it would make it easier for people to help who can

spice ivy
winged ridge
signal vine
teal viper
winged ridge
#

I asked because 2 different methods

rich adder
teal viper
signal vine
#

Ah so I need them to simply be sprites/images

eternal needle
signal vine
#

And a seperate script can deal with the actual prefab spawn?

spice ivy
spice ivy
signal vine
eternal needle
# spice ivy for now its just click and then grow over time ill improve as i go later on

if it always stays as click then grow, then the logic is pretty easy to setup. You would just need some sort of public method to indicate that the plant is now allowed to grow. Then in update you can do the timer if its allowed to grow.
If the logic is more complex in the future, you'd probably need to come back and refactor it entirely to allow for some list of actions to happen in order

#

depends entirely on your requirements so it's pretty good if you're able to sit and think about what you actually need in your game. Theres a world where you could just have each plant reference a "next plant" and replace the spawned object if you need some stage system