#💻┃code-beginner
1 messages · Page 389 of 1
Yeah but any personal recommendations?
imagine wanting to be gamedev but then throw yourself in javascript
if you want general game development advice for different engines/frameworks/languages then ask in a general game dev server
imagine wanting to learn javascript at all 🤢
So people can use it more viably
this reasoning makes no sense
Bro agar.io is playable on the web too😭
seriously though why use JS
funny that that's allowed
what does that mean?
okay, many games are playable on the web. including many unity games
javascript performs like shit
U can make unity games on the web?
the web is pretty flexible. a lot of things can be made to run on the web
Oh good to know
did you do any amount of research before asking your question?
U don't need js tho right?
I used three.js for a quick portfolio site and wanted to shoot my hands off
Uhm? That's why im asking here
Used it for a class in uni, same. That stupid teapot will haunt me
it uses WebAssembly to embed your WebGL build you do not need any javascript
Alr alr
yeah its pretty solid for a javascript engine goes
For android? Does it use kotlin?
unity uses c#
nope
#📖┃code-of-conduct
You are required to do research before asking here
it all gets compiled to hardware code anyway
My question was different
You can research in between questions
There are many unity games on the web
You can use C# and Unity and Export to any platform (consoles too but you need special NDAs and approvals)
I asked for a recommendation based on experiences, since you guys know how to use unity
Are they good tho?
why not find out for yourself
You're not going to learn overnight of course, take a week to so play around and if its your thing then go for it.
Tbh I wanted to hurry, didn't wanna waste my time with wrong sources, that's why im asking ppl, regarding that, did any of u use the sources in question?
That's fine
I wanted to hurry
yeah good luck with that
^ very true . this is unrealistic
I meant, I want to start right away with the right source
if you can't even be bothered to put in any effort to research for yourself how do you expect to be able to "hurry" to learn an entire game engine
did you not think to try official sources
Like, for instance, with java I started with a book and had good results, I followed recommendations too
if you know java then c# will be easy
Researching can be misleading
its essentially Microsoft Java.
oh in that case why bother learning anything at all? learning requires researching ideas, but if research is misleading then learning is useless!
the docs and the learn site ofc
if only you'd bothered looking at the pinned messages as was suggested multiple times now
Alr, But did u guys learn from there???
this was my first Unity course
https://learn.unity.com/project/beginner-gameplay-scripting
it mixes well Unity concepts into C#
i'm done engaging with this. this back and forth is useless since this person clearly wants to be spoon fed the information rather than putting in any amount of effort at thinking for themselves
Why would they be pinned if they were not good?
Cool, thks, my focus was mostly a 2d game, so I suppose it takes less time
we can mislead too
Bro just stop being hostile, im asking ppl, sources are good but I wanted to get info first
at this point you're just trying to prove a point instead of actually going to learn
only if they're from craigslist
we aren't on craigslist, so we aren't trustworthy, end of discussion 👍
👌👌
thought this was a field for those passionate in R&D
Again.. just so you are aware, you are required to research first
#📖┃code-of-conduct
No hostility intended. That is just the rule here, for future reference.
Wish you the best
i only use organically sourced courses from the stinkiest of brainrot farms. anything else is too complicated for my tiny brain to handle and is therefore misleading and worthless. if the course doesn't spoon feed me the information and give me step by step instructions without explaining the actual purpose of doing things a specific way then why even bother making it in the first place
ok issue was i needed to provide base with parameters from parent class
but why i even need provide them if they not being used?
I did research tho, just wasn't sure what to get
you still haven't provided any proper context for what you are actually doing so nobody can really answer that
I feel like you have ignored every single response you got today.
Can you please share code as requested?
I do hope the official docs are good, cuz for instance, I tried roblox studio docs and.. they were kinda disappointing
whats the purpose of base
that calls the base class's constructor
thats video game... this is a GAME ENGINE
but i dont want create first class i want create second class
What is the purpose of doing this?
This is likely not what you want at ALL
multiple of them for same parent
You made a constructor with it being used. Of course you need to provide it then
but the second inherits from the first
Isn't it kinda similar when developing stuff? But ok, lets see those docs
I would say no
but second not creates first one so why it needs parameters for first one
so when you create an instance of the second it is an instance of the first. and the first one can only be constructed using that parameterized constructor because that is the only constructor that exists on that base class
yes it does because it is the first class
no because not many business rely on a game like robolox studio
XD I mean its roblox
strange i debug logged and i havent seen duplicates
anyway can i have many of second classes all pointing to first class
exactly its a small market and its mostly kiddies.. A game engine needs to be suitable for big studios and keep their shit on par
but this is going on too long, just try the material and make your own decision as with everything you should do in life. Goodluck friendo
there are no "duplicates". an instance of test2 is an instance of test1 because it inherits from it. just like an instance of any of your components is also an instance of a MonoBehaviour. and a MonoBehaviour is an instance of a Behaviour
they aren't "pointing" to the first class, they are inheriting from the first class
so i cannot have array of second class inside first class
why would you want that
if i have a room, with one person, and that room also has one adult, how many people are in that room
so i can store array of arrays in more sane way
that does not answer the question
if you can't make the link between your classes and this example, you have not understood OOP yet, and you should go learn that first before trying to utilize it
secondary class can hold variables and i can hold that class in array
yeah that's unrelated to inheritance
why does that secondary class need to inherit from the first?
This went from an XY problem to an WXYZ problem
just an average interaction with anuked tbh
because it will generate variables using ones from first class
that does not answer why it needs to inherit from it
hey, never had this happen, but when i loaded my project neither the game or scene was showing up with anything, how do i fix? i spent 10 years on this game !
@late burrow read this example
no errors or messages? is the editor frozen?
you've spent 10 years on a game and don't know how to open your scene?
nope, nothing
You should 1000000% do more basics of c# outside of unity first. Basically all the terms you're using dont make sense and this isnt a proper way to learn. You're basically listing random words until someone explains what they think you mean
is the project in the editor
no it is open, the scene screen is showing absolutly nothing though
screenshot the entire editor with the hierarchy visible
Sounds like a corrupt scene file
see?
Any changes showing in the version control you are certainly using?
Ah modded game
nope
We dont help with modding or decompiling
Deleted a light?
you've got lighting in the scene view enabled and what appears to be pretty much no lighting
Oh, modded
not modded, i had did that because i had accidently forgot my old acc
monkee game gonna be the new VRChat
it's also very clearly not showing "nothing" considering we can see the objects in the hierarchy and even the outline of the object selected
toggle this off and show what you see
yes i know but why does it have 0 lighting, not modded or anything its my game, just forgot my old acc, and had to undo it
nothing
Accounts have nothing to do with it.
still nothing
i said show
Thks, speaking of which, I just found (for beginners) C# coding stuff, where can I find the beginners stuff for unity(in the pins)?
@tender stag as long as script on the same object as the PlayerInput asset it works without references.
So I just have 1 class that handles Inputs by making a public Get bool for example. Basically same as what you got
my PlayerMovement just cares about V3 inside moving, it doesnt care where inputs come from (bot, player etc.)
#💻┃unity-talk has the non-coding resources
can u show me an example
im pretty sure i know what u mean tho
Alr thks
u guys here?
yeah let me grab it rq
I mainly stole from the Unity example assets anyway, since thats how i first learned the input system lol
at this point you should move your question to an appropriate channel. it is not coding related and has something to do with your setup most likely 🤷♂️
send the channel
real quick, @stiff rock have you tried restarting
yes, ive also uninstalled my stuff and reinstalled it
there is no help channel
almost all of the channels are help channels
reading must be hard, huh
There is a lighting channel..
Also #💻┃unity-talk
they disabled scene lighting so it's probably not lighting
Ah, missed that part
I know what the problem is but i dont know how to fix it..
What does the error say
My console was lagging so it showed an old error. I found out i didnt make an float..
no that's not the issue
read the error
look where you put the declarations for scorepoint and score
I think thats what they meant by saying "i didnt make an float"
one can only hope they understood. Also VSCode really colors local vars the same as Properites and fields??
gotcha just waiting on the project to open for some reason unity hangs sometimes on 2022
np
im busy anyway
trying to figure out client side prediction movement
with all that replication and reconciliation data shit
yeah
oh yeah thats gross
I just noticed it on my mac
oh yeah thought it was my theme..
at least my props are diff color
the default theme doesn't have a ton of colors
keyword 1 (for, if, else)
keyword 2 (class, readonly, int, get, public, new)
var
const
type
func
string literal
number literal
yeah and changing it is annoying because you have to mess with json files..bummer.
hey since unity uses yaml for its scene/meta/asset/prefab files can you replace that with json
how would i stop my player from getting stuck like this?
not really a code question
or maybe it is.. we dont know..
its running, but it dosent move anywhere cus there's like a small small ledge between the tiles
compound?
forgot what its called
same lmao
yeah use composite colliders
composite?
on the tilemap?
have your tilemap collider be a composite and add a composite collider
make sure you put Used By Composite on the collider
and make the rigidbody it puts as static
which fixes the issue
you might need to set it from outlines -> polygons
for it to work
make sure this is checked
oh thanks so much!!
but how would i fix edges like this?
or jsut make the player walk over them
that I'm not sure as i don't do 2D often. Try asking in #🖼️┃2d-tools or #💻┃unity-talk perhaps
ok thank you!
you might need to fix the physics outline on sprite, but I'm not positive 🙂
yea ok thanks!
this is correct @balmy rivet
hey guys! im still trying to get the nodes from my tilemap into code. this is the method i'm trying, but it's giving me false data. anyone know why could that be?
public bool[,] GenerateMap()
{
bool[,] map = new bool[tilemap.size.x, tilemap.size.y];
for (int x = 0; x < tilemap.size.x; x++)
{
for (int y = 0; y < tilemap.size.y; y++)
{
Vector3Int tilePosition = new Vector3Int(x, y, 0);
TileBase tile = tilemap.GetTile(tilePosition);
map[x, y] = (tile == walkable_tile);
}
}
return map;
}
yea thank you, worked
https://gdl.space/nufepihati.cs
Dont mind the serializedfields were there to see them in the inspector without debug mode on
this is the grid
what do you mean by "false data"?
false values where there shouldn't be?
yea
make sure you're setting walkable_tile
use Debug.Log to see if tile == walkable_tile is passing, or if it's not being reached for some reason
yeah
but ofc there are a lot more
is walkable_tile just an empty tile
(btw, sidenote, convention in c# is to use camelCase rather than snake_case for fields. if you use camelCase, unity will automatically split the words for you)
what about tiles that have dots
yeah, but they arent blank tiles
ah, ok.
you are comparing Tile References that will never be true
no, the tilemap will give the same references
are you differentiating between an empty space in the tilemap vs the empty tile? try Debug.Log and see if there's more nulls than expected
more nulls than expected?
well, how many nulls are you expecting
love those colors
well, do you have a tile for that?
also, are you passing the right Tilemap?
and that's the one with walls?
the black tiles
quick question...
should I worry about security or effectiveness of my game from the start? If I am just messing around...
what do you mean by effectiveness?
effectiveness of game?
It seems like I do find ineffecitve but workable solutions
What do you mean by "Security" or "effectiveness" for a game?
and you only have Wall_00 that's the black space?
like setting everything public for my convenience
- Make it run
- Make it right
- Make it fast
in that order
yessir
That's not a "security" thing, that's an organization thing
So you don't accidentally change something where you shouldn't
if it runs, then its right... no?
have you tried just logging out all the tiles yet?
no
make it do what you want it to do
but making it run is the first step
ah okey
everything is private by default. that's more about encapsulation . . .
at what point I might start considering the limitations of unity?
when you hit them
okay wait
i get a bunch of Nulls
^ lol maybe a few weeks before.. if u got that hindsight DLC
limitations? just make the game. when, or if, you hit them, worry about it . . .
and a few wall_00's
So I should just mess around. without worrying about writing the most optimized code?
@robust turret quick reality check, you're in analysis paralysis right now
correct.
is that what you're expecting?
There is too much to start from. and hard to grasp the startin point
no
just start..
i hv tons of wall_00's
thats part of the rollercoaster
Just DO IT ™️
check your tilemaps
you are at the starting point. now go
aight
Depends on what you mean by "Optimization". Things like "Iterate your for loop backwards so you can break a few elements early and save 0.0004ms" is a bit excessive. Things like "Don't do GameObject.Find in Update on every object" should definitely be considered
not really. make a to-do list of what you need for your game. start and cross them off one-by-one . . .
btw any good 2d free assets suggestions?
i don't know what this is, you do
But nothing runs slower than code that doesn't exist
itch.io. unity asset store
those are all wall_00's
so make something go first
try disabling your other tilemaps and look at them one at a time
what will that do tho
and which tilemap is that in
nodes
should I worry about any malware when downloading assets?
make sure the reference is correct? not sure at this point
just dont open exe's
okay thanks
assets are gonna be .blend, .fbx, .obj, .png, .mp3 etc
on itch.io? just make sure they're popular to a degree
find a good art pack
and let it inspire u
https://streamable.com/xur7u1 i've peaked
editor code + console commands + reflection stuff
ive maxed out my brain.. it hurts now lol
ayee
BUT i have a console tied into anything i chose to make a singleton from
it just works
now time to crunch some polish.. get my motivation back
oh I thought the "Trace" command would show you debug rays or something
it shows a stack trace following the function u pass into it
neat!
time does a similar thing.. where u pass in a function and it logs the time it takes
soo in theory i created all my back-end systems already.. pickups, actions, health, shield, attack damage, etc
i can call all of it via the console..
now the hard part is putting it all together
always is
i have 1 issue tho.. is editor hotkeys.
when i try to search Player.. the Shift + P breaks out and pops up the Project Settings
(i had that off the side of the screen) thats why i have to reclick on the console after i type P
indeed!
🙏 Unity
Is this way of comparing two instances ok?
if (Instance == null)
{
Instance = this;
}
else if ( Instance != this)
{
Destroy(this);
}
Or should i make a isEquals() method?
me crouching and move backwards, unity telling I cant save in playmode :
what for?
it shouldnt happen in builds anyway
🤣 one of the first bugs i encountered too
I just wonder if the (Instance != this) is valid for Unity to compare two different objects of the same type
that button discovery was literally a godsent a i had a video on it but it didn't post a short so I just said fuckkkit
why wouldn't it be
we dont even have the #archived-unitytips anymore
best code i've ever used
using UnityEngine;
public abstract class Singleton<T> : MonoBehaviour
where T : Singleton<T>
{
public static T Instance { get; private set; }
void Awake()
{
if(Instance != null)
{
Destroy(gameObject);
return;
}
DontDestroyOnLoad(gameObject);
Instance = (T)this;
DoAwake();
}
protected virtual void DoAwake() { }
}```
Generics 💪
I see a lot of save systems without it and I cringe
I don't know, maybe Unity doesn't understand it this way, maybe theres another IsEqual() method I should use
I'm implementing a singleton, btw
Yeah, that looks fine. Assuming for a singleton? That is pretty standard
https://unity.huh.how/references
Check out singletons here for how vertx would do it
whats wrong with this?
imo thats a good starting point , do it for a save system.. Instead of making save method only Save(SaveData)
Make the method Save<T>(T data)
lol, funny u should say this.. thats where i found my generic singleton code
this for a singleton though? this would be cycling through objects rather than keeping a single object for the duration of the runtime
my save system is held together with ductape
How so?
i may try this in the future once i get more the overall project stable
oh wait im dumb
big fan of flex tape myself
zipties are my fav
actually turns out my save system is in a project all on its own.. and the rest of my stuff is in another
this oughta be fun
Yeah, i'm gonna use Aethenosity's suggestion
probably safer
nah i read it wrong yours is fine
public class TurkeyTrampoline : Singleton<TurkeyTrampoline>
{
// can't beat it
}```
and u still have ur Monobehaviour acess
Dang, too much to hope there was a trampoline react...
I should do that with mine, then make it a lib
fresh idea 💡
i find it easier to work on bigger systems in isolation
lasts night long hour session fever/dream , though not as exciting as your project lol
I typically use folders for that, unless it's big enough and i think that i might reuse it
that's how i started creating packages for my stuff . . .
Spent my whole day yesterday making a multiplayer lib
this is the lockpicking lawyer
[smashes all of my tools into pieces]
And it somehow got downloaded on nuget
76 times
I don't even know if it scales lol
I know it works fine tho, connected 4 clients together on a server
nah mines all back-end garbage.. theres no substance yet this is cool
the backend is the meat and potatoes. I was just trying to find this mechanic and all the videos kinda sucked they all did some wonky shit, I kinda enjoyed doing my own way of it turned okay
and 1 hour.. thats quickness
Oh def not 1 hour lol it was a long "coding hour"
my time is 1 min of coding time is like 1 hour in real life xD
The fact that i can feel the lag on lan is pretty weird
is this netcode?
did you log the latency at some point?
i made a test app and i got around 7ms from client to server on both LAN (my address) and localhost
it was a bit worse from client to client
like 12
another quick question...
Can the Game Objects 2,3,4 inside the Game Object 1 branch be recognized by Game Object 1's script?
Or I should specify it
is this server auth ?
That's probably partly because of event polling
"branch"?
Nope, but it can be (kinda)
are you talking about the hierarchy, perhaps?
you can find it via code but you better off making a reference
those are Transforms children
in this case, Bird is an object with two children: DownWing and UpWing
You can iterate over all children of a Transform:
so should I reference them?
I have a Func<NetPeer, Packet, Packet?> that i can use to do stuff with packets before they get sent back to clients
okay basically im having a lot more problems than i should with this. im trying to use unity's new input system. how can i simply detect when a button is pressed from my InputActionReference?
foreach (Transform child in transform)
{
// ...
}
or Bird script knows it already
if they are child of same script is prob better to do so
You can also just directly reference the children.
[SerializeField] Transform downWing;
then drag "DownWing" into the Down Wing field in the inspector
bird script doesn't know anything , you have to tell it things lol
"find this here, put it here do this" yadayada
I should also learn the terminology🥲
scripts are just text files of instructions
thank you raah
or a statement
you're welcome raah
okay. I was just wondering if I can find better solutions
whats this for?
thanks ^^
cleanest way to do it imo.. I've also made a few packages.. and just to avoid any kind of conflicts i use Fresh, empty, stripped down unity projects
not sure yet I needed it for my own project but now, I'm thinking to make an asset
was inspired by playing dying light again recently and they had this mechanic
yea, those are the best kinds.. means u put attention to detail (it being something u were gonna use)
so when u share it, its pretty solid to begin with
yeah i was very picky on going for the almost same feel and look of DL
i need a lockpick mechanic in my game too.. but its dystopian future stuff soo im still brainstorming for a mini game
I just need to find a good 3D model of a lock but its been difficult (for free and cc)
what type of lock? jsut a keyhole one?
i seeen the first episode of fallout
b/c of the hype but i havent gotten around to seeing dying light yet
ohh, ofc ive played fallout lol
skyrim had a picking mechanic too
i enjoyed that one
bethseda!
don't slur bethseda's name 😅 whats wrong with u
most glitch-free games ever made
i have sooo many hours in that game is pathetic
i think i did 3 full playthroughs when i was younger
with a skill modifier?
i use a curve
interesting
you wanna friend me? i want to ask u some other questions but the channel isn't right for it lol, asset related*
the the great revealo!
sure
this is bad ass bro
you can see the green is the range, the harder the difficulty of lock the less of a range
thats basically all minigames summed up in a gif
I was thinking it was angles at first
(all the videos i seen were doing some shit with angles)
but my brain cant brain rad too well
mp3 is supported by unity right?
yes
ok
mp3 and wavs are ur two go-tos most likely
* ogg vorbis has entered the chat *
my bad wrong format
m4a seems to not work
the OG
oh yeah, i start a new project and create a folder for editor and runtime. nothing else is added . . .
do you utilize project templates?
like make custom ones? im thinking of making a basic scene w/ all ur basic stuff included.. and use that as my starter projects
got to stress test it first and find any instabilites
i made one for packages; that's about it. they were empty except for the necessary folder structure . . .
i do have script templates for MonoBehaviour, custom class, struct, interface, etc. when i create and name a script, all the boilerplate code/setup is there . . .
U want to create templates for yourself? To not start from scratch every time?
basically what im doing
stuff like DoTween, TMP, Cinemachine, 2D package all that stuff i have to repeated add
I believe there are ppl who share their templates for free
soo i thought why not add all the stuff i need.. make a few simple things that everyone uses.. (include a Character Controller) and tada got me a phresh prototype project each time
tho idk where XD
ahh nah, i dont want someone elses template. 😄 im just curious when people actually do it themselves
as you want... there is a saying
a good artist creates a great artist steals
lol.. not sure i agree with that.. but i wont judge
there is a legit saying
its not smth I made up
To steal from one is plaigarism.
To steal from many is research.
exactly
to steal from all is programming
draw it
how?
depends what kinda grid you got
rectangular
i meant in the code..
You can draw them as a mesh probably
yea i hv no idea how to do that
found this
it might help you
https://gist.github.com/mdomrach/a66602ee85ce45f8860c36b2ad31ea14
basically you can do mesh.SetIndices
or just use line renderer and call it a day
right
Can someone help me I am having a problem and so posted it on stack overflow https://stackoverflow.com/questions/78594391/weird-behavior-of-a-spline-unity-3d but no one is answering anyway here is what my problem is. I am using https://github.com/CMDRSpirit/RollercoasterDesigner this package is to make your own roller coaster. Sadly it is not very polished but I have one problem with it. When I set the StartSlope Variable it sets its own. Around 0.7 for y and 20 for z
I tried to get Chat GPT do help me fix it but that didn't work. I am at a loss I have no clue why this isn’t working. Please help.
Hello I am using https://github.com/CMDRSpirit/RollercoasterDesigner this package to make my one roller coaster. Sadly it is not very polished but I have one problem with it. When I set the StartSl...
NullReferenceException: Object reference not set to an instance of an object EnemyPatrol.FindTarget () (at Assets/Scripts/Enemy/EnemyPatrol.cs:90) EnemyPatrol.Update () (at Assets/Scripts/Enemy/EnemyPatrol.cs:44)
the if statement is the line 90
private void FindTarget()
{
float targetRange = 50f;
//Change GetPosition probably need to create a function in playermovement names that + have a look into this instance stuff
if (Vector2.Distance(transform.position, PlayerMovement.Instance.GetPosition()) < targetRange)
{
state = State.ChaseTarget;
}
`
public Vector2 GetPosition()
{
return gameObject.transform.position;
}
Gets position of the player.
I dont know why im getting the error
check every reference variable on line 90 and make sure they're not null . . .
something there is not like the other
only reference variables can be null. first, identify which variables are reference types. then check the value of each, one-by-one . . .
all of them are giving normal numbers back
I was initally going to use AddForce to make my Character Controller jump. Although, since it is not a RigidBody. There is no method for this. What can I do instead? I'm using SimpleMove, because I would rather not take the time to make my own gravity.
which variables did you check and where (in your code) did you do the null checks?
well then its time to learn
also "custom gravity " is a simple v3 calculation, nothing insane about it.. the CharacterController Move method has an example
gravity implementation is like two lines of code
whaat
I did transform.position inside FindTarget,
PlayerMovement.Instance inside FindTarget and the functoin
and targetRange inside the findtarget function
okay hold on lemme check this out
what don't you get? lol
no no i just expected it to be weirdly difficult
ohh nah that shits ez
force accumulation is the hard part
PlayerMovement.Instance.GetPosisiotn is the problem
the only thing weird is the cc.Move should be called once, and the Example code calls it twice.. Just combine them into one call
targetRange is a float, which is a value type. it cannot be null. the same applies to GetPosition which returns a Vector2. check if PlayerMovement.Instance is null as that is a reference type . . .
yeah just thought i would check targetRange just in rare case. Got it fixed tho
Just to be clear, for the future, there is no rare case. That would be impossible. Value types cannot be null
a rare case is impossible. value types cannot be null. that's just a fact . . .
what if some rare insane unity error happen
quick help with particles needed pls
I have clouds and I want them to spawn from the rightside of the screen at different speeds and move till the end of the screen and disappear
but somehow they are not accepted as a material for particle system
There is no error that would cause that
what if my unity got corrupted and that just happen
That is not what would happen. Not possible
yes sprites are not materials
oh rip
I am rarely definitive like this, but it simply is impossible, in any situatiom
I have a bad habit of hedging my bets, but that is not necessary here
what should I do then?
should I just write a random spawn code with different speeds?
just make a new material that is a sprite shader and add you sprite inside?
or particle system shader, forgot which..prob latter..
also not a code question #✨┃vfx-and-particles
no answer there -_-
i mean it was only 10 mins..
Yeah, it can take some patience sometimes
the cycle of perceived dead channel continues
or fingers crossed ask here where there is more activity
yeah how about don't be rude to others who need to ask about code get flooded by someone asking about vfx
also not everyone who knows code might know how particle system works well
but I wasn't rude to anyone 0_0... there was only 1 code related conversation going on
Thank you
There is a server for it
do yourself a favor and just learn the code lol
Hello
especially when its not fitting to the channel
at minimum #💻┃unity-talk would've made more sense
You will get muted if you share it here btw
Nav just got hit by it haha
Yeah, I typed it before you said that
Slow phone is slow
I hit it twice and got muted..second time with no http in link 
Sent the person in need to the VFX discord server in question
hope they find what they're looking for
thats why fingers crossed. realising that anybody answering here will be simply of pure desire to help without a slightest responsibility to answer
Those people will answer in the right channel. Just post it and wait a day
There is a good reason for the rules being that way
Just putting you in the heads up, if the mod tells you don't say you didn't know lol
they certainly won't agree with that viewpoint of yours now,
its literally in the rules not to do it. but moving on..
checked community conduct don'ts,,, nothing I have done wrong from there I believe
and in read-me... just spamming in different channels I suppose?
here is my logic...
somebody specialising in coding has higher chances of knowing a little bit of everything, while somebody specialising in other spheres (such as graphics, art, music etc.) can afford to go entirely into that sphere only
not acceptable?
im artist turned developer. i post thru-out the channels.. but different topics each related to the channel
its not me you have to make a case to 
if its a VFX question it belongs in VFX esp if its only been 10 mins you dont post in a code channel..thats just saying "ey I need to know this now, let me do as I please"
smells entitlement lol
Or maybe saying, This is not a too specialized question and it does not need a 10 years of VFX experience professional's opinion. Even an amateur in this field can answer this.
And I assume amateurs can be found in different channels as well.
Idk how to word this without sounding suspicious so here we go lol
🫣
Is it possible for my game to scan a user's file folder and do something with the information? The idea is to search for specific files and turn them into objects on a shelf that you can then interact with.
lmao..
What's that?
its a library that interfaces w/ the OS
save files, read files, move files, copy files
(I'm ngl I've never touched Unity, I'm making this music project purely for fun and I'm just asking so I can keep notes)
I want to turn downloaded albums into physical records
sus indeed
Well, not literally physical
System.IO is not a unity specific thing. it's the namespace that contains all of the stuff you would regularly use for reading/writing files in c#
But like, records on a shelf in the game
you should just let the user pick a file, which you may use System.IO for, and then do whatever shenanigans you want.
just because the channel is called VFX doesnt mean its not the same people answering... has nothing to do with being experts in VFX.. its more fitting for the question to be there , and someone who wants to help with VFX question will look there..
(anyway aint going back n forth with this lol test your luck with doing it with mod around idk)
yea i see what ur wanting to do
Users will absolutely hate it if you just automatically get all audio files u can
similar example: populate a bookshelf w/ all the TXT files on a user's machine
For full transparency I've purchased these albums legally and expect my users to do the same
That isnt the issue, its just about how a user will feel if u go ahead and scan random folders in attempt to find audio files.
I know EmuVR does this with ROM files instead of audio files
ya, not sure i'd be down w/ giving those permissions to a game
u could probably make em feel better if its a folder inside ur build files..
that u can move ur audio files to.. to then see them in the game
not sure about u just willy nilly lookin around my machine tho
Correct, not acceptable.
Ah, so having the music folder be inside the game files instead of scanning the user's C\Music
ya, i feel like thats more acceptable
Probably a lot easier to implement too
or even let them chose which folder u look thru
or, #💻┃code-beginner message
as every website does when you want to upload a file
so they can manually pick their own library folder
Dunno how I didn't think of that, I'm 99% sure that's what Emu does
oh i missed this.. this is exactly what i'd do
That was the idea, I forgot to say that
oh yea, thats fine then
I kinda suck at typing, I carry myself much better over vc but I'm in the middle of 50 things atm and this was the most convenient way to ask
I just want to give people an interesting way to enjoy their music in VR
👍 good luck with that.. sounds like it could be cool
Now to find a good tutorial
Oh cool! I didn't expect such a specific one to exist
ya, i figured they'd be a simple one like upload custom avatar
that'd have all the same logic ud need for audio files as wel
System.IO makes an appearance!
I was looking around at the more general ones to get myself used to the basics of Unity since I've never used it. I've seen a lot of people talk about Brackeys' videos, but they're almost a decade old and the UI is completely different.
dont use brackeys please
Is there some drama I need to know?
his tutorials are okay but they're sooo "to the point" that they're hard to expand on
and alot of em are full of little bugs
the code is usually not very easy to extend on
or its at times very wrong and gets corrected only sometimes in later video
I see
check out Sebastian Lague's stuff
the gpt one 😬
it really helped me when i first started
Before I really start working I do have one more question
well thats good at least its not like "use chat gpt "
Yeah it has helped me only a few occasions when I could not find specific formula online and surprisingly it did
AI is only as good as the user commanding it
Considering that
A. I've never developed before
And B. My Quest 2 has the battery life of a domestic hamster
Would it be easier to build my experience from the ground up for VR, or make a pancake build and then port it? Most of my friends don't own anything for VR so I would have more playtesters, but it might be harder to port interactions with almost 0 coding knowledge.
Yeah that can be true
id do it flat-screen first
and then move into VR
its not gonna be a pleasant experience with a shitty Headset w/ no battery life
indeed. VR is not too different anyway just the interactions change
The Q2 is admittedly not the easiest to work with lol
yup, but you wont be very good at that stuff from the get-go..
so best learn ur way up to it
Alright, I'll take a look at those resources
i made a VR type scene w/ just mouse controls.. mouse movement move the head.. left click simulated grabbing somethign with ur left hand.. right click -> right hand
but since i only have a Windows Mixed Reality headset.. i never expanded on it
I should grab a vr headset and start doing some stuff 😮 I'm wayy behind on that
Quest 3 should be going on sale this holiday season
Yea that might be the next move, I bet a nice HDRP project would be finee on that
Never again.
someone had a baaad experience
u started on HDRP yet?
I can play BONEWORKS for hours and feel nothing, but cellphone VR is truly the antithesis of the gods' light.
Not sure if you rememeber the water project
ohh i do
also played around with Unity's RTX but my graphics card was crying, it did look good. HDRP still looks really good
there is someothing about 6 the graphics on HDRP seemed to have improved
not sure HDRP is worth the upgrade
Oh dude, Unity has RTX support?
for a while
Wait til I find a way to badly implement this
fr.. dang yall
People have been making their own ray tracing and path tracing for a while
Which typically have the advantage but also disadvantage of not depending on ray tracing hardware
Weirdly enough I feel like the path traced games that perform the best are the ones using their own implementation, like Teardown for example
That thing runs on my 3050. Tried it even at 4K and it was kinda playable
At 900p (my monitor resolution) it runs over 110fps, max everything
Tho denoising isn't comparable to what Nvidia has
This is from the standard Unity ThirdPersonController Script:
` private void Update()
{
_hasAnimator = TryGetComponent(out _animator);
JumpAndGravity();
GroundedCheck();
Move();
}`
Is the ' _hasAnimator = TryGetComponent(out _animator);' part neccessary during update()?
It gets called during Start()... I thought stuff like this is quite "unideal" performance wise?
uhh that dont need to be in update
What is _hasAnimator even being used for.
`private void JumpAndGravity()
{
if (Grounded)
{
// reset the fall timeout timer
_fallTimeoutDelta = FallTimeout;
// update animator if using character
if (_hasAnimator)
{
_animator.SetBool(_animIDJump, false);
_animator.SetBool(_animIDFreeFall, false);
}
// stop our velocity dropping infinitely when grounded
if (_verticalVelocity < 0.0f)
{
_verticalVelocity = -2f;
}
...
`
I assume for this
It is not ideal. Unity docs and samples would often provide not the most optimal solution, because that is not what they're aiming for.
You only need that once unless you have some weird code somewhere else that removes the animator
Hm.. maybe it is neccessary in order to update the animator on every frame?
But even than wouldn't it be better to get that component once and store it globally?
There's probably no hidden meaning behind that code. It was just implemented like that for simplicity
Aight gotcha..
So.. what would u suggest?
Get that info once and store it in a persistent variable?
If you have no reason the animator should ever be destroyed from the GO then I see no reason why this wouldn't be approached like any other referenced component, serialize it in the inspector or use awake to get it. If you are worried, then null check or require the component.
what
click the link. read it.
then don't get help
fuck this server
you're welcome to leave 👋
imagine getting all pissed off b/c someone sent you a resource that would actually prove to be beneficial to you... and even learn you a way to get help more often, and of better quality.. and then rage-quit taking all the bad etiquette w/ u
DVUnit doesn't have to imagine.
UnityEngine.Random vs Unity.Mathematics.Random?
UnityEngine.Random uses a static rng state, so you don't have to manually create a random instance and then ask it for random values
This can be a problem in some cases (like if you want to have multiple distinct RNGs)
Everything in Unity.Mathematics was designed to be usable in Burst-compiled code (which can run much faster, but requires you to use only a subset of C# features)
I would use UnityEngine.Random unless you have a compelling reason to use the Mathematics random
its telling me that Random is an ambiguous reference between the two so I need to pick one or the other I guess. I added a line that used Mathf.PerlinNoise
Okay looks like UnityEngine.Random it is for me
you may have accidentally added the using Unity.Mathematics directive
I think it was automatically added when I used Mathf.PerlinNoise
Mathf is part of UnityEngine.
Get rid of the Unity.Mathematics directive and see if you get any new errors
oh, a double-ended queue
yesss
No errors. I wonder why it automatically added in the first place?
IDE's tend to do that
sometimes i'll have 3 or four unneeded crap up there i have to remove
LinkedList<T> lets you access both the first and last elements
so that should provide efficient insertion and removal at both ends
gotta pay attention to what you are auto completing, you may have accidentally autocompleted something from that namespace so it was added
Cool, that's exactly what I need! thanks!
I turned off automatic namespace insertion
I kept getting a really goofy directive for..
this one is especially funny because it's a UnityEditor class
so it'd randomly explode my builds
obscure af.
I love getting the Visual Scripting ones
apparently Start is a class in the Visual Scripting namespace
public bool TryGetComponent<T>(out T component) { return gameObject.TryGetComponent<T>(out component); }
Does this return the component or just a boolean when it finds said component?
The return type is bool
Therefore, it returns a bool
It's impossible for it to return anything else.
It will also assign the component it finds into that out parameter
the reason this returns a bool and not a component is because its already doing a null check for you
Same as writing
MyComponent myComp = GetComponent <MyComponent>();
if(myComp)
//do stuff```
the `out` is just a way to return a value or more from method without changing return type
so..
`If(TryGetComponent(out component)){
changeSomething(component)
}`
would work..?
assuming you already defined type of component
other wise you need to include it after the out
Fair! Tyvm 🙂
why cant i modify the return value of Transform.position inside of my Character Controller? It says it's not a variable, even though I can modify it's position in the editor.
Cannot modify the return value of 'Transform.position' because it is not a variable
position is a property that returns a copy thats why you cannot modify it directly but assign a new value to it by replacing
Does if (!component) do the same thing as if (component == null)? I use Jetbrains IDE and sometimes it corrects me but sometimes it does not
they do the same thing yes
yes unity does its own method of null check, thats why ? doesnt work
it will warn you about the second being expensive, it doesn't check for the implicit cast to bool, but the operations are exactly the same
There was a conversation about this earlier, a rider dev said it is.. a bug? They said it wasn't right
must be second one today it seems lol
also if you are curious what exactly the null check entails, it does this: https://github.com/Unity-Technologies/UnityCsReference/blob/master/Runtime/Export/Scripting/UnityEngineObject.bindings.cs#L124
both the equality operators and the implicit bool operator call that method
Awesome, thanks
Love Rider. Someone in this chat mentioned it like ~2 weeks ago so I gave it a shot and the Unity integration is outstanding relative to visual studio. Love the QoL features
Can someone explain this code error? my code is the following:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test1 : MonoBehaviour
int frameCount;
{
// Start is called before the first frame update
void Start(){
print ("Start");
}
// Update is called once per frame
void Update()
{
frameCount += 1:
print ("Update");
}
}
Assets\Test1.cs(18,24): error CS1513: } expected
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code
• JetBrains Rider
• Other/None
Your int frameCount is outside of the { } surrounding the class
I see what I did there
Lmao I forgot to do this
Wait a minute
This is already how it's set up
It naturally uses it
wdym "naturally uses it"
ok just heads up having a configured IDE is required to get more help on code in the future
syntax errors are equivalent to spelling errors
I have it installed, connected, and I have the extension. What more do I need to do?
That makes sense
depends. are you using Visual Studio
or
VSCode
Uhhhhhhh, I think I use the first one? The menu is solid black and it runs smoother than it should for being a Microsoft office product.
As previously mentioned, I am profoundly (and legally) blind
It is the second icon
mentioned where ? you said color blind, I said look at the shapes of the icons are differet
My bad, I thought I did. I apologize for the aggression.
I don't think I've ever seen it
However, I do get a million messages about not having the .NET something or other
yup
that would be it
you would need to install the .NET SDK and restart the PC so the PATH properly updates to include the dotnet command , helps for Intellisense to work
When you finish, this would be the solution (ide highlight would suggest what is wrong):
Thank you, code works fine now! Turns out I misunderstood how brackets worked.
help the C# devkit extension & unity one run the dotnet command so it can connect together to editor
make sure you have restarted the PC, removed the Visual Studio Code Editor package from Unity Package manager , and click Regen Project files in unity for good measure
Btw, both are microsoft.
Does anyone know a solution to my problem: Each time a create a new Enemy gameobject it shares the same health as every other enemy, is there a way to decouple them? I'll provide code is necessary but don't know what exactly to send, my Enemy script or HealthManager script or the Script that casts the attack function.
You made it static?
Or is the health in an SO?
I have a HealthManager class in an object and it's a singleton that the enemy scripts calls, i dont believe it's static
Is there a single health variable in that healthamanager class?
And all the enemies use it?
Where is health? That is what I'm trying to find out
it's a singleton
that doesn't sound right
Health should be in a script attached to each enemy
Oh ok, thank you I'll try that !
In the future, a single variable would of course be a single thing. If all the enemies are using one health variable, they all share the same health.
Anything you want to be separate needs to actually be separate
How do i make a button that plays random musics (audios) ? I made a empty object and put a small script on it with "randommusic" and made a button with the click "playrandommusic" but nothing happens once clicked.
hint: read the warning in your IDE, it's helpful.
all you're doing is assigning randomClip
why do you expect anything to play?
more specifically assigning it to a local variable and then never using that local variable (which is the point of the warning i mentioned)
exactly
im just thinking basic stuff. audio - music haha xD.. so if mention a audio it should play in my head
random question - why should monobehaviors not be instantiated directly?
(like new Class)
because unity manages the creation of components so they are added on the C++ side of the engine. if you construct it directly it won't do that so it won't receive messages like Awake, Update, Start, etc. nor can it be added to a gameobject
you're basically saying "this audio clip is named randomClip" and doing nothing with it
and if it doesn't need any of that then it doesn't need to be a component
ohhh interesting
so were I to be using it like a class and not as a script I should just remove the inheritence of MonoBehavior?
yes, no point in inheriting from MonoBehaviour if it doesn't need any of the inherited behaviour of a MonoBehaviour
gotcha, thanks!
you're very knowledgeable
just comes with experience, i've been using unity for several years now and i try and dedicate at least a little time each day to utilizing those skills/knowledge
yeh I definitely use unity more on and off
so your skill level, even if you may not think it's crazy high, is still admirable to me at least
how come the Audio source gets removed from the Object once play testing in editor?
You're probably removing it via code.
That or it's not actually removed🤷♂️
managed to fix that now :3 ty
for whatever reason, this block of code in the update method, doesnt actually seem to reset my velocity when my charactercontroller is on the floor, unless I'm walking up some slope. has anyone had this issue?
{
Velocity.y += Gravity * GravityMultiplier * Time.deltaTime;
Character.Move(-Velocity);
}
else
{
Velocity.y = 0f;
}```
Are you calling move after setting the y comp of the velocity to 0 ?
What is logged if you log Character.isGrounded and expect your character to be grounded?
I didnt realize you could log that!! thank you a ton that helps so damn much, I didn't realize it might be a problem with that. although I don't really know why it's acting the way it is, still
Best thing to do with issues is to isolate the main problem. In this case I would have definitely checked that variable first, and then move from there 😎
thank you oh wise one 🙏
So now that you know this, why does it not update to the new value? Is this a variable you control? If so, when is it changed and why doesn't this apply? At that point you can start doing more logging
does it matter at all that my character controller is placed above my ground? if so, can this be a result of some of my code or should i be looking in my player's properties?
Depends. What exactly checks if you are grounded and how is this checked?
If it's the collission that floats above the ground then it probably isn't aware that you are grounded due to the distance
I need some help figuring out why i can't get my grounded checks working
everything i've tried has done nothing to help
i've looked up tutorials on youtube and even showed my code to chatgpt
Please share the !code of your system so that we can get debugging
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
So what is the issue? Does GroundCheck() not work?
apparently not, because every time i try to jump, the debug log says i'm not grounded
Then likely Physics.BoxCast is not returning what you think it does
Uri above solved my issue!! that took like 5 hours but I'm really glad it kind of works now.
but yeah, i still haven't figure out why IsGrounded isn't working. Which I do need later. I'm not sure why it's hovering above the ground. Nothing should really be changing it in the code I don't think.
https://paste.ofcode.org/tkxNjubRZ5dkvJQwKNCNXX
please excuse the messy code this is my first ever project 😟
probably. i also haven't been seeing a box being cast to the scene in the first place
according to a video i watched, that code from line 110 downward should be casting a box, but there isn't one no matter what size i put
are you expecting to see a literal box appear?
yeah
read the docs and tell me where it says it draws a box on the screen
here's the same thing from the video
well that's what the gizmo is for (i think)
possibly
U might have the gizmos button off on the game or scene view. Should be in the top right of either window
oh yeah, I can see it now
on an unrelated note I no longer need help with this, after some irl discussion i'm gonna be using a prebuilt controller moving on with my project, rather than building my own from scratch
hi i have a problem
where my keycode dose not work
so i cant turm left or right
i dont think is a programing error
nvm
i restarted my unity and everything works fine
how do i fix this
You add the correct header, in this case Content-Type and with the application/wasm header
correct?
so its in the html file?
No, it's part of your HTTP request
where is that
My guess whatever is the "connecting" part of your game
Or don't you have any specific web requests in your game?
my connection part just takes the url like example.com/?room=id
Okay, so what is the relevant code here?
Please share it
I think, in this case, it is a server configuration problem. The server is not set up for the correct Mime type for .wasm files
from untiy project or index.html
how is that done
presumably you have a web server, configure it correctly
im using pun 2
but your code is being served from somewhere
why do people do stuff that they understand absolutely nothing about?
is hostinger where you are serving your build from
How else would you learn about new things? 
Try Fail Learn Repeat is a mantra for a reason, especially in a beginners channel.
RTFM and do research first. Not just blindly dive in
So, that is where you need to change the configuration as I said above
so it has nothing to do with the build rather the server config?
yes
okk let me see
the Unity docs contain a section on how the server should be configured
Is a list FIFO?
for whatever reason IsGrounded is really confused on what it wants to be. I'm using a singular Move(); method inside of the Update method. I have no clue why this is happening, I'm using the default properties for a capsule and it's CharacterController.
https://paste.ofcode.org/SHU5yQZmKJBBzEtT7Z8UZ5
The messages printed in the output are simply the result of print(Character.isGrounded);
A list requires you to provide a target or index when removing individual elements - what you're probably thinking of are queues and stacks.
The isGround variable updates when the character moves so if it's fluctuating that would mean that you're likely moving and colliding into the ground (possibly with gravity) but not always - if the delta time factor is minuscule that frame, you just might not have triggered is-grounded to be true (my assumption)
Was the CharacterController touching the ground during the last move?
https://docs.unity3d.com/ScriptReference/CharacterController-isGrounded.html
Maybe have your own isGrounded property that would be true (grounded) unless you've been ungrounded for a set amount of time (some threshold, for example 200ms). @iron wing
that's for problem solving, not for learning everything
doing is a supplement for research, not a replacement
will the static DialogEventCallback method at the bottom, modify EventInstances that was passed to it on line 85?
will the mthod like actually modify the dictionary and remove an item from it?
Please properly share your !code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Also, 
i dont want to crash unity again
Log the list of known instances before removing it and after removing it for example
it takes so long to boot up
I don't see how a crash is relevant here, sounds like a different issue