#💻┃code-beginner
1 messages · Page 846 of 1
The ball stores it’s behavior rn
so they have the same script?
Yes
ok so on that script you have some way to distinguish they are different ?
Not yet bc i only have 1 kind of ball rn
But once i add balldata
It will
Like once i add the SO you were talking about
Bc my original thought was
If i have an SO that stores the prefab i can make the game object with that
It’s there another way
I’ve never used an SO btw
used them once and hated them ~_~
you're missing out
they are very similar to Plain C# objects but they can be created in the editor and dragged into scripts as assets
But like should i store the prefab in the SO to make the game objects
again it depends cause you could be doing things backwards
you could even have 2 prefabs.. it all comes down to how you plan on instantiating these, if they have a common prefab or completely different prefabs
if they have the same script, mesh and only a few things in code changes them 1 prefab suffices to then pass SO Data to it and build the object that way
or Poco
Oh i see
So i can have 1 prefab
The SO can store how i change that prefab
To be a certain kind of ball
pretty much
yeah SOs are intended to be used as like a spreadsheet of data that you can only read from where each SO is it's on well object with it's own set of data (technically you can write to them but it isnt recommended)
Yeah thanks
//create a different data in editor with CreateAssetmenu
public class BallData : ScriptableObject {
public BallType BallType;
public Color color;```
```cs
// script on gameobject
public class Ball : Monobehvaior {
[SerializeField] BallData BallData
public void SetupBallData(BallData data){
ballData = data;
Debug.Log($"ball type is {data.BallType}");
//prints 'ball type is Bouncy'
if you have a POCO concept is the same
funny enough lots of editor stuff write to them
kinda
funnily enough i enjoyed working with the code like this over SOs (this was from my first project, and what i changed into SOs and hated). I just hardcoded all the skills inside a class
lord..
there was times i spent a solid 12 hours just trying to work my way through it to add an extra skill or 2 to it
this is a nightmare to maintain.
thats why SOs are so great
you can just keep creating them like a new text file and boom its own thing
the SOs got even worse to maintain ngl, though i was working on making something there that when i create a weapon it would create a base of like 15 skills (all other SOs) for it at the same time
how they worse to maintain you can literally put them in different folders
Write a book instead.
but i wanna make a game dog😔
Not sure what a game dog is, but you'll need to learn gamedev to do it.
give your polished * story script to someone who will make a game out of it or learn the required skills to do it yourself (it takes a long time and patience)
i did lol, but i think it was less the actual SOs but instead what i did with them, i had to make a huge Skill tree (i was too lazy to do this by hand so i spent like 50 hours making a skill tree generator), there was another factor to it that i kinda forgot about now (it's been ~ a year and half)
i have unity and im using c#, i just dont know the language and i want a partner fr
so we can have strokes together
def give them a proper revisit cause they are very powerful in many usecases
(it takes a long time and patience)
a very long time, i spent a solid year of 8 hours a day working on a project and it still ended up very unpolished
wrong place to look for one
!collab, smh
: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**
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
realistically this is pretty much unfeasible, a decent coder wont just work for free . Whats the motivation for someone working for free?
maybe a gamejam..
i have money
ok then look into making a post where linked in bot msg
alrighty
any youtube tutorial that explains a lot of unity math stuff?
that's a very broad topic and what you need will depend on what you're making
could you be more specific
I would need it for a farm game but, I think I'm gonna try to consume more than I ask for so I don't keep getting stuck
that's still very vague and i have no idea what it is you're having issues with
ahh basically, just the foundation for me to take math functions in
its like donut blender basically
yeah no "math" is still very broad
vector math, kinematics, matrices, quaternions, trig, smoothing, color blending, etc might be used in different contexts and all fall under "math"
even music
it'd be a waste of your time (and a fool's errand) to learn "all of math"
the basics of math functions like, transform.position basically
start with this I guess
https://docs.unity3d.com/Manual/scripting-vectors.html
what specifically do you need help with?
so, vector math?
I guess yeah
cool, you can look stuff up with that keyword or go through the link nav sent
vector math isn't more "basic" than the others i mentioned, it's its own category with basic topics and advanced topics.
if you need help, you need to be specific about what you need help with.
gotchu
Position isn't a math function. It's a number. It can be part of a math function, but it's just a number, like 4 or 12 or 525,600.
It's just that the number is actually three numbers, because it's a position in 3D space and you need to know all three dimensions to know where it is
Quite new to unity, I'm attempting to make a gravity simulation game, in it i have a moon that transform.RotateAround()s a planet, is there a way that i can turn this rotation movement into a Vector so i can find the relative speeds of the moon and the player?
What vector exactly are you looking for?
The movement of the moon around the planet
-# sorry if i dont make sense these terms are quite new to me
So do you want the delta from the earlier frame or the velocity vector or what? What are the relative speeds and what you need them for?
the velocity vector (i think)
so i can use it to find the relative speed of the player
nvm for now, think i found a lead
relative to what would have been my next question, there are many ways to calculate the velocity vector. It is also a bit of matter of definition which vector you should use since it is not a constant velocity (current velocity vs the midway between this and the last frame)
If you just want the velocity at that frame it's (position after RotateAround minus position before RotateAround) divided by deltaTime
that is also technically not 100% accurate since the path of the planet is an arc instead of straight line but it all depends on the constraints we are living under (of course it is very very close for most cases)
right, ive tried using transform.position - previousframe transform.position to get the movement vectors but that doesnt seem to work correctly
It should very much work correctly. If you show the code and explain in what way it doesn't work, we can maybe help get it correct
ok ok hold up
rn im tryinna get relative speed to work with a speed tracker, the code looks like this (bottom line is rounding for the text display)
movementVector is the transform.position - previous frame transform.position vector
currentMoonScript.movementVector is the same but for the moon's movement
these are at the start and end of Update()
but for some reason when i read movementVector.magnitude, it increases continuously when i'm moving, and pauses increasing when i stop
It should be 0 when im not moving no?
!code
📃 Large Code Blocks
Use links to services like:
https://pastes.dev/
https://paste.yunohost.org/
https://share.sidia.net/
https://paste.ofcode.org/
https://paste.myst.rs/
📃 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.
The order of operations is definitely wrong in the velocity calculation isn't it? You are supposed to calculate the direction vector first and the divide by deltaTime (not multiply)
now you are taking a position, multiplying it by deltaTime and the subtracting
so like this?
yes
these are really hard to read, can you just use codeblocks
ok this is weird, now when i read the magnitude it flashes between 0 and another number
it does look like the other number is correct though
ok nah im moving at a constant speed and the vector keeps changing
from like 4 to 2
ok what the moon's movementVector.magnitude is just 0
when i debug.log the transform.position and previousframeposition theyre both the same????
you logged them right after you set previousFramePosition = transform.position;
log before that point
I have this scene. Boot additively loaded launcher and launcher additively loaded game.
Boot -> Launcher -> Game
But when I call
SceneManager.UnloadSceneAsync(SceneManager.GetActiveScene());
while the game scene is active, it unloads also boot. The launcher stays.
Anyone know what is happening here?
is that the only unload call you have?
also check if you're perhaps calling it multiple times
Thanks I just noticed with the debugger it actually gets called twice
Hiya! I am making a pixel art game and was wondering what people use to enforce a universal framerate across animations? I currently have two sprites updating at the same rate, but with a slight offset which is quite jarring
Wait, this seems more appropriate for the animation channel.
hey guys, im wanting to make a game like a social one with quests and all, sort of like rec room and VR chat, i wat it to be a VR game. ive made a basic plan for it i just need like basic help with buildings and stuff
specifically coding cuz i only know LUA and python
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Hello - how can I found out why this error suddenly appears? It happened after having closed Unity and opening it later in the day.
try refresh library folder maybe ?
guys, how do i make a prefab only scale one way and not both
as in on 1 axis?
what
yeah
My unity keeps lagging even when im not playing
what did you try
which course do i take to learn the basics of coding 🧐 ?
there are some pins in this channel if you want to get familiar with c#
and coding in general
the learning pathways are more unity specific
sure thanks. yeah i tried solving the coding problems i got while watching yt tutorials on how to make specific systems by using chatgpt premium but it ended up with me just copy and pasting the code so thats not really the way to learn. big no no
its good youre aware of that
yikes you paid to get scammed?
but also yeah if youre going to pay for AI you kinda picked the worst option lol
so is that a good or bad thing? its not really a bad thing if ur looking to learn unity c# specificly for game development inside of unity and nothing else right?
unity c# is the same c# as the regular kind of c#
youre just learning to use the unity api specifically
you still need to understand some basics of c# alone
learning "normal" c# you realize unity does nothing special with the code
i still think its good to at least familiarize yourself with c# outside of unity first
the only concepts you need to know are specific to their workflow like wat are GameObjects, Scenes, lifecycle of objects etc.
but at the end of the day, youl be doing the brunt of the learning within Unity
eh not really. i didnt purchase it, i borrowed it from a family member. is it the best ai no. is it decent enough if you need help with some specific stuff outside of coding yes. would i purchase it no
Ah thanks :)
ah ok
Okie.
thanks alot
this will be a long journey.
will be worth it tho
its good knowledge to have because it carries over to other things
also would setting up a goal to make a short 5 minute horror game in a month and gather as much information as possible be good or bad
maybe as final goal, but in the beginning you're better off making smaller projects with the concepts you learn
everyone learns different . so do whatever works for you.
what helps for me, if you learn something like move object across the screen, make as many needed smaller test projs with that concept / code until you can do it on your own or add variations, usually that solidifies into your memory
alright. will do. thanks for the advice man
hey can someone help me with some code im working with? im currently trying to learn unity essentials in the pathway and ive been stuck on this code forever , thank you very much
what is your actual question
!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
im learning to make collectibles and i feel im writing the code word for word but my collectible still wont get collected
!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
• :question: Other/None
also the issue is probably scene setup related rather than the code here
hmm soo you thnk i messed up putting my collectible somewhere?
do you have colliders on both objects and a rigidbody involved
No, only the collectable should be set to isTrigger.
yea , im at a loss ill look at this ty
really quick , am i not suppoed to do the normal rigibody? the one at the top
you need that if you are working in 3d, yes
you also need a collider because the rigidbody is not a collider itself
could it be as simple as me using a box collider when im using a star? lol
go through the link i sent. it walks you through everything you need to check
alr ty
You should have a collider and rigidbody on the player, and a collider set to trigger on the collectable, as well as your script.
You also need to be actually moving using the rigidbody
Teleportation with transform doesn't collide
i got it to work somehow , my code seems to be the exact same but i added a space before my last // comment , ty all ill use the website to try and find anything else if i need help
this option doesnt save? i also exited it out directly
does a unity final build contains the compiled ifs on the build (#if UNITY_SOMETHING)?
im using a lot of #if !UNITY_EDITOR and sometimes a #if UNITY_IOS or UNITY_ANDROID to separates somethings on my scripts...
i do know i could use application.plataform to check which one im using, but im my head on the build the compiler simply removes the script from the source so it will be lighter.
If the compile directive isn't true, the code inside it literally does not exist
So, anything wrapped in #if UNITY_EDITOR just never makes it into a built game at all
ok, tks ^-^
#if false
a comment with extra steps
I'm trying to make a fps game and I don't know how to code using visual studio can someone help?
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
can you clarify what you mean how to code using visual studio?
like how to connect your ide to unity?
or coding in general?
yeah when ever im doing something the little list on the side doesn't show
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
• :question: Other/None
Thanks
a comment with syntax highlighting lmao
how long do u guys actually code? man feels like im very slow, it's like im thinking how to solve this issue for 2 hours and then only actually code for 30mins
is there a trick for this on how to code fast
just practice/experience. it's just like any other skill, you'll get better as faster as you keep doing it
this is pretty typical, programming is mostly problem-solving in a way a computer can understand, then writing it out in a way a computer can understand
with experience you can make those 2 tasks overlap and/or do the problem-solving mentally
Hi how can i make the cinemachine camera follow the player when it spawns, it worked fine when the player was already in the scene but when the player spawns in the scene the camera stays at spawn
Hey everyone, i'm having too much trouble making a point and click 2d game about serving coffee, my character it's ignoring collision and i don't know how to fix.
I don't speak english very well but i want help solving this, i don't find it any content about point and click games, soooo... Help?
how are you moving the player?
can i send the code here?
📃 Large Code Blocks
Use links to services like:
https://pastes.dev/
https://paste.yunohost.org/
https://share.sidia.net/
https://paste.ofcode.org/
https://paste.myst.rs/
📃 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, does it have appropriate collider and rigidbody components
when i first tried i used rigidbody but he starts to fall, i removed the gravity but it dosen't help either
is this in 2d or 3d and what perspective
wrong quotes, but for large code blocks, see the "large code blocks" section.
still wrong quotes
and again don't post it here
oh sorry
see the "large code blocks" section
where do i post?
first it was a 2d only, but now i made it 3d
in one of the websites linked there
don't know what is better
have you changed the rigidbodies and colliders to 3d?
neither is "better", you have to decide what you want for your game
so you're moving via the transform, that won't respect physics
if you want it to respect physics it needs to be moved via its rb
those are 2 completely separate things
if you have something that you need physics for, you would use the physics system
and if i don't i can just use the rb wihout it?
if you don't need physics then you wouldn't use physics
nice
so do you need physics or not
no
when i click for the character to walk he must collide with the tables and stop when collide with a wall, but he just pass over it
there is a voice channel? i can livestream
so you do need physics, unless the world is a grid and a the character takes up one whole grid (which you could handle differently)
and no
i thougth pshisics are only needed for fall and this kind of things
collision is physics
makes sense
are you sure this is point & click

yes
you can click anywhere and the character walks there?
yes
pretty sure that's not point and click
point and click usually doesn't need physics, nothing's actually moving around, or if they are, it's on pre-specified paths
since in point and click, you can only click on specified objects
that's the point part of point and click, no?
i think the point part is using the mouse to select where to go and not arrow keys / wasd
the idea was to make NPCs come and ask for some types of food and then eat, pay and go
yeah
right, but in most it's not actually going there
it's what to select or what room to move to, not which position to physically move to
by that logic LoL could be a point and click game, no?
tbf i woulc consider it one but i haven't played it before
bro what
i think that's just one of the forms of a point and click game
point and click movement != point and click genre
most point and click games don't even have point and click movement
it's point and click selection
anyways this isn't sounding like a point and click game. this is just a game with mouse-controlled movement, physics could fit here
can i send a short video of the game?
of course not
i think this can be the oposite of nsfw
so, he not suposed to walk in the walls and over the tables
btw i used tilemaps to make the ground walls and pretty must everything
Do you want to make like this
i created colliders
Get mouse touch position and blend player position to touch position
you would not be blending anything
just colliding probably wouldn't be great, seems like you'd want to do some pathfinding here
🙂 then you can use navigation
Yaa pathfinding
if you dont know what your talking about dont respond 👍
agreed, found a 2d navmesh asset awhile ago and was thinking that would do great here
🙂
i tried to use one but i realy couldn't understand what i was doing
I think he is asking to make system like that
So I told
i want to make the character to walk where i clicked and bt that interact with the npc or the foods
the npc will walk in, sit at any free table and then ask for a specific food
the character will walk to the food and grab it and then delivery to the client
the client will eat and then walk to the cash machine
i click in the cash machine
he pays and leaves
you all think i should re doit everythyng? because i'm willing to, this supoused to be an easy project but i'm to dumb to understand what i'm doing
this is harder than you might think
i'm starting to believe you're rigth
i'm losing hair just thinking about how to make the NPCs walking in making all those things etc...
so i can use rb and he will collide?
i can move the rb with the mouse?
you can move the rb using code, and you can also use code to detect mouse input
though another option could be to only allow clicking a few specific spots and then having preprogrammed paths
this would probably be simpler than a pathfinding thing but probably more work
Hello, guys! Btw, I am learning the A* Algorithm and it seems very complicated. I imagine how Unity's Built-in NavMesh reduces headaches because it actually implements the A* internally haha
But if you learn at least the simplest like most foundational implementation and practice the logic systematically, I assume the logic and the understanding will be clearer
because thats what I do
trying to break the algorithm into small pieces and understand the logic.
Welcome to the first part in a series teaching pathfinding for video games. In this episode we take a look at the A* algorithm and how it works.
Some great A* learning resources:
http://theory.stanford.edu/~amitp/GameProgramming/
http://www.policyalmanac.org/games/aStarTutorial.htm
Source code: https://github.com/SebLague/Pathfinding
If you'd...
Α* even a simple implementation seems to complicated omg
yes but I have to make it and learn thats the point, because we have AI project in college and we have to implement our own A* algorithm for pathfinding and not using NavMesh
And the point is actually to understand how pathfinding actually works in AI
ok FSM's, Behavior Trees arent hard at all to implement I mean its ok but A* its more than complicated XD
I haven't tried GOAP yet
I assume it wont be hard as well
What exactly are you struggling with?
A* is not that complicated IMHO.
could someone help me i dunno what these mean lol i know its something wrong with my code but dont know what ive been looking at it for the last 15 minutes and am now blind
The errors are basically telling you what's wrong. ; expected means that semicolon is missing. As well as the file and line numbers where the error appears.
ima be honest got now clue where its telling me to have a semicolon is there a way to decipher it?
this is basicly all the lines ive added when the error popped up
Player.cs file line 7. Look at the error again.
Provide code properly if you need help figuring it out.
!vode
There's no command called
vode.
!code
📃 Large Code Blocks
Use links to services like:
https://pastes.dev/
https://paste.yunohost.org/
https://share.sidia.net/
https://paste.ofcode.org/
https://paste.myst.rs/
📃 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.
I'd like help with Nav Mesh Agent. My NPC character has a fixed rotation when I turn its animation on and it is not the rotation I want (I want it to walk down the path in this image). I have tried numerous things suggested by searches, including adding the model as a child, turning on and off the root setting, rotating all kinds of things, but once the animation starts, the rotation is fixed. Any suggestions? I am running Unity 6000.3.
Hey, guys! About the A* aglorithm, I have a question. So, I cant really understand why do we do convertion from World Position to percentage in grid. I mean what is the point of the World Position and why do we convert it?
Percentage?? I'm not sure you need that in A*. What you might need is distance to the goal as heuristics(a guess basically) to be able to chose the best next tile in the path.
And to calculate distance world position can be used. You can also use the grid space distance. Details like that are optional and depend on your specific use case of the algorithm.
you have to convert because A* does not work with vectors
it works with grid nodes
so WorldPosition -> Grid Nodes convertion
I assume
Assets/script/player.cs is the file
(7,28) is the location in the file, line 7, column 28. (often the column isn't super necessary but can be useful sometimes)
fix the first error first, since the incorrect syntax might affect parsing later down and cause more errors even if the rest of the file is fine
It works with whatever you give it(or rather however you implement it). Grid nodes also have vector positions(their indices in the grid), but you can use whatever. It depends on what problem your implementation is meant to solve.
hi mate sorry was out heres the link for that pastes dev site https://pastes.dev/aKmMYywX70
So, yeah. Read all the replies and you should be able to handle it. It's really obvious.
okay cheers mate
you can also remove second using UnityEngine; on line 3 but yeah it just a visual correction.
wait is anything with public int meant to have a ; on the end of it?
honestly thank you didnt notice it
Any statements in C# need to end with a semicolon. I recommend going through C# basics.
(pedantically that's not entirely true but it's a good rule of thumb)
can you recommend any videos or something to read on about c sharp basics? just kinda been free balling it with yt videos
the culprit here is a field declaration rather than a statement, but yes these need semis as well
there are resources pinned in this channel
Tbh the best c# intro stuff is not in videos
Declarations are statements too afaik.
iirc not, but different languages define them differently. i'll have to check
iirc field declarations aren't statements but local variable declarations are, as declarationstatement
(also pedantically not all statements need semis - control flow statements take substatements, blocks don't have outer semis, but other than that yeah you need semis)
okay quick random question why does making some statments just use () while others need ()) what does the double )) do?
() is used to call methods and constructors
(And to make them)
Conditionals and loops too
if you're passing the result of a method or a constructor to another one, you will have nested braces, for example
(expressions here rather than statements, to be pedantic)
okay i really need to learn some stuff on c sharp language :0
is it worth learning c sharp first and then game design or both at the same time
a few terms to get you started
declarations say something exists, eg a class declaration class Name { ... } or a field declaration public int health;.
statements do something, eg an assignment (transform.position = Vector3.zero;) or an if statement if (condition) { ... }. statements need to be in a method, constructor, initializer, or accessor body.
expressions represent some value, eg arithmetic (1 + 2) or a field access (gameObject.name).
sometimes these can overlap, and are distinguished by context. int x; would be a declaration in a class body, but a declaration statement (a declaration used as a statement) in a method body. MethodCall() can be an expression used in another statement, or used as an expression statement on its own (requiring a semi)
i have found most the problems i thought having a ; and the end of that private void was looking a bit weird
that's called a method, it returns void, it's not called a void
wait so private void Die() thats a method? isnt that just a return or something along those lines?
that's a method
the return is the return
well, that's just the header of the method declaration, the full method declaration also includes the body, and we'd refer to just Die as the method
okay so why does it say void if its a method?
that's what type it returns
sorry if these a dumbass questions
nah these are beginner questions, there's a difference lol
are you familiar with what "void" means just in plain english?
or like, in minecraft, same thing
id like to think i do
so is private void die does that just mean that the text is just a void or something when the code runs?
what text?
A function called
GrabCarKeys()
might return CarKeys because that’s what you get from doing it
a function called Jump() returns void because you get nothing from doing it
private void die()
the text is just text
it's declaring/defining what Die is
Die is the method, it returns void, aka nothing
oh okay i think i get it so its just returning to void so it just doesnt run the code again?
Not really no
okay im so confused i look this shit up and everything
it's not returning to void
it's returning nothing. that's referred to as returning void in code
yeah thats what i meant when i said returning to void sorry
well not all of it but returning to nothing
specific wording is kinda important here 
the only thing it's returning to is the caller (whatever called the method)
yeah im getting that vibe ahahaga
wait so what is with all the other void like void start void update?
thats got all the movement stuff i feel really stupid asking this i should just go read up on it lul
Those are Unity specific functions
start is called once on the frame when the script is first enabled
And Update is called every single frame
ah okay thanks that was the easyist thing to under stand ahahah
these methods that unity knows about are called messages, there's a list of them in the monobehaviour docs, and you might also see others used by inputsystem for example
huh okay well i fixed all the problems in the code but now if im holding down say a or d and then jump when the guy lands he stops moving is this like a unity thing or is it because i got simple coding?
either your physics setup, your level setup, or your code
ahaha that made me laugh okay will think ill refine that stuff later is there anything youd recommended looking up for learning c sharp basics?
already mentioned resources in pins
alright I am basically copypasting what guide doing with little explanation
public void SaveData()
{
string savePath = Application.persistentDataPath + Path.AltDirectorySeparatorChar + "SaveData.json";
Debug.Log("Saving Data at " + savePath);
string json = JsonUtility.ToJson(playerData);
Debug.Log(json);
using StreamWriter writer = new StreamWriter(savePath);
writer.Write(json);
}
public void LoadData()
{
using StreamReader reader = new StreamReader(persistentPath);
string json = reader.ReadToEnd();
PlayerData data = JsonUtility.FromJson<PlayerData>(json);
Debug.Log(data.ToString());
}
do I need something to know about StreamReader and StreamWriter to make sure it won't violently explode my OS or the game?
Probably nothing special. Should probably use common sense as with just regular file write/read.
Using the using keyword is a good start. It shouldn't explode anything except both ReadToEnd and Write can throw exceptions. You should probably catch those somewhere and show some error to the user
File handling is specially prone to exceptions which you can't always prevent yourself so being prepared for them is always a good thing
is multiplayer very hard to do?
It depends, but it's definitely not a beginner topic
It's hard to wrap your head around at first. But once it makes sense it's not too bad
(Which still means it’s pretty hard)
There are some pretty good starter guides, but most of them won't explain why something works, just what to do. If you want to learn, it's probably best to start with "I want to make a multiplayer project and see what I can do with it" rather than "I want to make this exact game"
If I fiddle with setRotation, I can get my NPC to always face (0,0,0), which is not what I want either but at least is different. How can I set the rotation before the animation and have it stay there until I change it?
Imo that's exactly where the difficulty comes from. No one really explains why or how it all works together. They just show what code to use and you're never fully able to grasp the full picture until way too late
Yeah, that's where (in my opinion) experimentation is the most useful method to actually get an understanding, when you're looking through all the things you can do to find the right one
public void SaveData()
{
string savePath = persistentPath;
Debug.Log("Saving Data at " + savePath);
string json = JsonUtility.ToJson(playerData);
using (StreamWriter writer = new StreamWriter(savePath))
{
try
{
writer.Write(json);
}
catch (System.Exception)
{
Debug.LogError("Game save failed");
return;
throw;
}
}
}
does that makes sense?
do I need to go through all possible exceptions?
throw after return doesn't make sense. It should throw an error or a warning at least.
autocomplete just gave me System.Exception I assume it's any
I guess I should just remove throw
...or not
Yes, exception should work. Though, if you don't use the exception object, I think you can skip it entirely.
ok return after throw would make more sense
Have you considered using a plugin for saving, or just wanna make your own?
(Lots of free ones)
throw; doesn't make sense
that doesn't make sense either
Not really. Throw would trigger a new exception and return immediately(before the actual return).
does this make sense?
int X() {
return 1;
return 2;
}
catch (System.Exception exception)
{
Debug.LogError("Game save failed");
throw exception;
}
I guess this?
I assumed throw is the thing which just logs
I assume I should assume less
return and throw both end the function execution into different paths. anything after a return or throw won't run
This is fine if you want to log a custom error in addition to getting an exception
Depends on what your goal is
I ll be curious what is it anyway
of course
not
right, go look that up
Unless you catch that exception somewhere else, you'll basically get a crash.
oh
unity handles errors that have bubbled out of messages into unity's own code, by catching and logging them. thus, exceptions from messages don't cause the entire game or editor to crash.
throw doesn't do any logging, it just throws the error.
I am getting vague picture itunitively now
the specific terms used here - error throwing, error bubbling, error handling - can be looked up
catch (System.Exception exception)
{
Debug.LogError("Game save failed " + exception.Message);
return;
}
I suppose this will do
you don't need the return there, it's the end of the function
well, yes
(also just a tip, consider adding a colon (or quotes, "with reason", etc) there, eg "Game save failed: " + ... to clearly separate the message in the log)
Is this not the right place to ask this question?
nav meshes? you might want #🤖┃ai-navigation
forgetting all the terms I am aware that you can encode classes/structs/fields into a long string, how it called?
what would be reasonable package/extension for unity to use it to make class into a such string to then put it as JSON to the web?
At runtime you can serialize a class object into a JSON and deserialize a JSON back to the class object but this requires purposeful handling using Unity's JsonUtility library
What are you trying to do?
compress
?? Please elaborate. Unless you've got an object that will somehow serialize to a multi-megabyte JSON, compression feels excessive
I know I can make data smaller so why not to do that
Compressing and uncompressing trades space for speed. Your data will be smaller but take more time to handle
If you don't need to save space, might as well save speed
The overhead and added complexity of compression is not always worth it, but if you need it, say for networking, you can encode the JSON string as base64 and save some space
I've never bothered with that but I think that should work
Also presumably you control both sides of the link, so gzip compression would be fine too
Base64 is always bigger than the original string. It's not a compression algorithm
Forget what I said then 😛 not too familiar with it other than as a string based way to transmit image data
BitConverter.ToString something?
Base64 turns bytes into letters. Letters are already letters, so you can't get more letter per letter
I ll be having floats ints and bools inside a struct likely
would make sense to convert struct into bits and then to string?
How many fields are we talking here?
I have class objects with 50+ fields I serialize to JSON and it's still extremely small
Sure, look into bit streams I think
Something something binary serialization with MessagePack
It's got LZ4 compression options for maximum smallness
how do I instantiate a prefab as a component
MyComponent instance = Instantiate (prefab, etc..
prefab's Type must be of the component you want (edited for clarity)
Cannot implicitly convert type 'UnityEngine.GameObject' to 'PlayerSave' CS0029
show what you did
you're trying to fit a square peg in a round hole rn
It sounds like you maybe have a game object holding that component as the prefab, which won't work
What type is the variable that holds your prefab
so I need to keep prefab as a component aswell?
GameObject
as I already mentioned #💻┃code-beginner message
So then it will instantiate as a game object
As you were told, use the type you actually want
If you instantiate a game object prefab, you get a game object. If you want to instantiate a component, use a variable of that component instead
alr
this is really confusing for me because I ve been doing it through GameObject for years
never too late to learn the correct way 😛
I viberead as prefab should have that component
both
you declare the Prefab as the type you want, The component / type must be on the gameobject / prefab
yeah I get it now
otherwise it wont let you drag in the prefab
as a small downside I see this thing is not helping me anymore
manual draggin it is
question
void Awake()
{
if(PlayerSave.instance == null)
{
PlayerSave.instance = Instantiate(save_file_prefab, Vector3.zero, Quaternion.identity, null);
}
//Do something else
}
will Awake and Start of PlayerSave execute before or after Do something else piece?
Awakes always run first
You can test the order with logs if you want to verify whats running when
my question is about will Awake of Instantiated thing execute after or within Awake which instantiated it
Awake() => Instantiate.Awake => DoSomethingElse
thats why I said you can also test it by putting logs in awake of each script
I mean I could but I hoped it was a trivial question
Awake is unitys way of a "constructor" so creating a component makes Awake run (assuming the gameobject is enabled)
yeah, Unity won't search for component types in your Assets
apparently it's a performance consideration
(i find it very annoying!)
It is impossible for the instantiate object's Awake to run before the creator's Awake if the creator's game object is active
(there's no reason you can't call a method on a component whose game object is deactivated)
Start will execute later. It runs on the first frame that Update would be called on.
New search can but it can be dog slow
if you know what you want to do but don't know how to do it where do you guys search?
here (or google, youtube, ai, etc)
knowing what you want to do is basically the first step 😛
it's so hard to translate what i have in mind to words that the google will understand
Can anyone make me a game that has kick stick and insta ban I don't care what type it is but I want it to be named speedy taggers and have a mod menu if anyone can make that it would be great DM me if you can
this server is for unity help not free work
Oh ok😢
Yeah like they said
but were you interested in making this game or commisioning for it?
I just want a gtag copy with the kick stick a modenu and insta ban
Maybe Quick Question: i have a vector3 which im using to move a player by using add force. Vector3(xMov, 0, zMov); works well but can travel faster on diagonal eg. W+D press.
so ive tried whacking Vector3(xMov, 0, zMov).normalized; in and it crawls but still applies force.
how are xMov and zMov calculated?
float xMov = xInput * moveSpeed;
float zMov = zInput * moveSpeed;
you need to normalize a vector made from the original input values
then multiply that by your move speed
normalizing a vector sets its magnitude (so, its length) to 1
you want to ensure that the input vector has a magnitude no greater than 1
(that way, you can't go more than 100% of the maximum move speed)
AH, i understand. i will try to implement it
think that did it!
Vector3 WorldXZ = (new Vector3(xInput, 0, zInput).normalized) * moveSpeed;
thank you very much
Is it okay to use code that I don't & can't fully understand?
It's usually a math equation or multiple physic manipulation that work together
My goal is to learn, not to finish a game, but even after taking hours of my time to try understanding the math, it still doesn't click for me
Yes, you're not going to jail if you do.
It depends, knowing what something does like "if i put this in this comes out" is pretty alright, even if you might not understand how that happens
feel free to post examples if you need help learning x or y though
using stuff you don't understand is problematic because when stuff isn't doing what you want it to do, you can't know if the stuff using the things you don't understand are being used right
You sure? I don't want to serve another sentence
Yeah i usually know what it does by removing/editing it and noticing what happens
Ty for the help guys
for picking up to transfer into inventory system, do u guys destroy the game object?
been stuck on this a bit
fcckk inventory system is deeper than I think

Yeah, sure. You could always object pool it if it's something reusable.
But if you don't need it anymore, remove it.
thanks, I will look into this
inventory systems are def. a programming/unity skill check
I've made way too many, and each time they look/function differently. It really is a very open ended feature.
if you do, you should separate it into a method with comments that say what it does overall - if it's mixed in with other logic you might confuse your future self lol
(also perhaps with links to where you got it, in case you need to tweak it - more info may be present in comments or whatever)
should object pools for different things like example bullets and enemies be in a different pool or should the be in like the same script
different
different pool can be same script
much neater to keep them separate, make a parent class
why would it be neater?
couldn't you just use a generic class (like what unity provides)
(speaking somewhat from inexperience here - is there a reason it's actually neater?)
the unity one i meant btw
made parent class generic so you can just inherit and pass whatever prefab to it and keeps its on own pool
most of it is boiler plate AddToPool n watnot
...yeah? you don't need children for that, just separate instances
confused myself I think we saying similar thing lol
you're saying to make subclasses, i'm saying to not...?
are you suggesting subclasses? i'm confused
I meant you make it a parent class if you need to but I meant the generic bit so idk you might need different behaviors for other pools, didn't realize OP meant only objectpool
couldn't you pass the different behaviours as callbacks 🤔
that's how ObjectPool does it
i guess it's not so different if you're making one that's based on inheritance
i figure a good way of doing it is have 2 objects share the same script and assign different prefabs to them for different pools. why would i need other classes and stuff when i can just make the object pool script itself adaptable to any game object. if i need to change it i guess i can inherit from that script and make changes needed, maybe thats what nav is saying to begin with?
yeah maybe extending would be bad idea, I wasnt sure if you can switch out Object for something like list
didnt realize you can probably just use GenericPool in special scenarios
i think GenericPool is just a singleton ObjectPool effectively
if i need to change it
unity's own ObjectPool allows this by letting you pass callbacks to specify specific behaviours
if you were writing your own pooling thing, you could choose to use inhertiance for that same task
oh okay cool i didn’t realise there was built in stuff for pooling
i kinda just made my own functionality for it
yeah its fairly new
oh it is?
I think 2021?
yeah... 2021 doesn't feel "fairly new" to me.... time is hard
(not necessarily disagreeing with you, just commenting on time perception)
lol maybe only when I got into unity it wasnt there felt recent
2021 was 5 years ago, that's brutal
in my brain "few years "
at least learn page exists still https://learn.unity.com/tutorial/65df850fedbc2a082fb11029#65e0cf5cedbc2a22f86a6cb8
By implementing common game programming design patterns in your Unity project, you can efficiently build and maintain a clean, organized, and readable codebase. Design patterns not only reduce refactoring and time spent testing, but they also speed up onboarding and development processes, contributing to a solid foundation that can be used to gr...
man, I went to bed after asking the question here and took a nap
the best way to deal with problems is by sleeping
so, I never "really" did any "true Unity way composition" of components (independent, decoupled from anything and pluggable almost on anything, etc.).
this time I tried to do it for my kinda emergent gameplay focused game, but I've encountered one problem - data duplication/scarcity (maybe I misspell the word, lol) in similar logic-wise components (I guess it's the problem of too much breaking down logic into components, but it's another day problem for me, lol). like, what can I do about it? isn't making "single source of truth" data components is the only proper way with a bit of cohesive coupling for data only and not other components? I don't want to do some sort of upper level controllers to manage it, because I don't like this solution.
maybe there some any other way I don't see?
are you familiar with scriptable objects?
yes in general, but I needed it for runtime data mostly which doesn't need to be shared nor serialized all the time for all objects
like, I could instantiate some runtime copies of my SOs and use them per object, but I don't know about that. feels like a convoluted solution to a cringy problem, but maybe it's the way, lel
i mean you haven't really described the issue you're facing in detail, "data duplication" covers quite a few things
what's the data in question you're having issues with?
oh, I see. I will try to explain as much as I can what I'm trying to achieve.
I have an idea in mind for my project to control state of any object via enabling/disabling components whose are added/removed to gameObject at runtime dynamically. those components (because of this setup) must be fully pluggable and without any dependency to any other components. so, the problem with this - I need somehow store the runtime and config data for components and provide it for them automatically without Inspector. like, if I just store all relevant data per component - it will be scattered and have different runtime data values per component (so it can or not be a problem some times with "data desyncs"/weird values). for that I need some sort of "single source of truth" data control or something like that with dynamic data creation/requesting. but I don't know if it's even good idea in the first place.
like a poor man ECS, but without ECS, lol
you could have the components use a class to contain data that needs to.. change dynamically i guess?
does this need to be serialized or something? im confused what the issue is with having each instance manage its own data
maybe I'm overthinking the data per component (if it will be disabled when they are not needed, it's not a problem, I guess)
but serialization is pain in the ass when data is scattered around multiple components + I would need to restore at some point components on the gameobject after save loading if they were added dynamically on that point in time
are you serializing to save to disk or for network or what
it feels like you're leaving out quite a bit of context here
to save on disk only and restore at some point ofc. I'm not making an online game
sorry I my speech/explanation is confusing (not a native)
what exactly is the context of the game where "single source of truth" is becoming a concern? as in, what's the issue with having each component store its own stats? is there a game design/mechanic thing that makes this an issue?
I think that this is the place to ask this, how should I sync a custom object when I spawn a network object that contains it?
like, I have a card interactuable that I spawn in the player hand and set a card type (a custom scriptable object)
that card type is what I want to sync
#1390346492019212368 (and include what networking library you're using)
I think that I found a way to do it, if it doesn't work I'll move to that channel
can anyone tell me why my object gets stuck to the ground sometimes when moving
what's the ground made of? just a single collider or what exactly?
it's a tilemap collider, i also added a composite one i thought it might fix it but it didn't
you should use a composite, and also make sure to mark the tilemap collider as used by the composite
for future reference, this is a code channel, this question should go in #🖼️┃2d-tools
Composite operation: Merge
oh ok thanks
hey, anyone familiar with p4 (preforce)?
!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
doesn't really seem like a unity thing though...
Hiya guys, question about some UI components.
I'm making a wheelofnames kind of wheel and I want to display the last results on the side.
I made an object called Result List inside the Canvas with a Vertical Layout Group and a Scroll Rect that takes its own rect transform as the Content. Each Result object inside Result List is just a Text.
As you can see from the video, the results can go up and down way farther than it should. How can I make it so that the scrolling stops as soon as a Result objects hits either the top or bottom image?
And more importantly, if my approach is wrong per se, what should I do instead?
this is a code channel, ask in #📲┃ui-ux
oh, my bad, cheers
(you can use the forward message feature to avoid having to reupload everything btw)
oh sick lmao
ye lol
Hey can anyone tell me the best way to move a rigid body
For a responsive movements ?
AddForce
That has to much latency 😖
wdym latency?
Player can’t stop the character in time
not really any "best" ways
for dynamic rbs, your choices are linearVelocity or AddForce (& angularVelocity and AddTorque)
for kinematic rbs, it's MovePosition (& MoveRotation)
Inputs take time and since it’s additive in nature
that's not a thing with AddForce specifically, that'd be a thing with how you handle movement overall
I tried moveposition but it was clipping my character through the terrain
let me guess, your rb is dynamic
Yup
i specifically did not list MovePosition as an option for dynamic rbs
so, no surprises there
you can add counter forces or damping, for example
there is no "best" here, there's barely even "both worlds" lmao
Yea great!
figure out how you want the player to behave or handle
Dynamic objects have gravity built in but kinematic objects don’t
then from there, whether it should respond to incoming forces/collisions - if yes, a dynamic rb, if no, kinematic
then figure out how to best model the physics involved in your desired behaviour
Yea guess that’s the only way now
Ohh by the way does unity runs better on windows or Linux?
Vector3 targetVelocity = moveDirection;
targetVelocity.y = PlayerRigidbody.linearVelocity.y;
Vector3 force = targetVelocity - PlayerRigidbody.linearVelocity;
PlayerRigidbody.AddForce(force, ForceMode.VelocityChange);
moveDirection is your input vector
cool. that difference really doesn't matter much in the grand scheme, they have more significant differences
iirc it has some issues with linux drivers but they're both fine overall
this will move the dynamic rigidbody smoothly without sliding
Yea I wasn’t able to boot unity on Ubuntu so guess I will be stuck with microslop windows
Thank you 🙏
This is exactly what I wanted
why not just reset the velocity if you're going for this behavior
this keeps the movement smooth
no instant stops
or velocity overrides
you're applying an instantaneous force, it's basically a velocity override
Yea better than damping
Vector3 targetVelocity = moveDirection;
targetVelocity.y = PlayerRigidbody.linearVelocity.y;
PlayerRigidbody.linearVelocity = PlayerRigidbody.linearVelocity + targetVelocity - PlayerRigidbody.linearVelocity;
```if you decompose the stuff you're doing, you're effectively doing this
i meant like you are not modifying the linearvelocity directly
so trivially, that's equivalent to just doing PlayerRigidbody.linearVelocity = targetVelocity;
yes, you're just modifying it indirectly, but in an equivalent way
it has the same behaviour as modifying the linearVelocity, it's not going to "keep it smooth" more than modifying the velocity directly
I swear I tried both and my version is a lot smoother, afaik using AddForce with velocitychange keeps the rigidbody reactive to other forces
where just changing the velocity completely bypasses those forces
setting the velocity happens before the simulation step
if you had other forces applied in this case, they'd get nullified the next FixedUpdate too
dumb question, but what is that character called in unity? like the basic one just for coding and anim
like built in char for unity?
I just want to put my movement code there to test and see how good it works on characters
I'm just using a tall as rectangle atm
there isn't one
you might be thinking of something provided with a tutorial package?
U see those in unreal engine/unity all the time on dev logs, I just dk what it's called
there are some provided by unity (company), but nothing built into unity (game engine)
I will test this out when I get home and come back to you
this?
i just googled "unity default humanoid" and scrolled a bit
I guess yeah
if these aren't it you can google for one yourself
i have made this test before btw, in case it answers your question about velocity movement responding to forces #💻┃code-beginner message
(though obviously this doesn't compare with AddForce)
Can I actually learn coding on a device
what else would you learn coding on
I'm asking a question meaning I have no information
the holy spirit is starting to code
right no, think about that question for a second.
Yeah your joke or what's supposed to be it's Somehow
I will stop there
Then if you lack the wisdom to provide assistance you can let it be
What do you think "a device" is? Because you wrote Android first before changing it. A laptop is also a device, so is a desktop computer. Are you asking if you can learn coding on a mobile device specifically?
eyy my man, calm down ur holy spirit
u're supposed to offer salvation not throw hands
Coding on a device is easy. Try coding without a device!
Yeah on a mobile Device
Thank you for correcting I didn't actually view it on that point
you can, but it won't be fun
coding without a what
Is that an app or
Well I viewed it as a phone
It never came to my mind that it was a diverse connection name
connection name? what even...
I have a device for cooling nutritional items that I consume to stay alive.
bro don't consume devices 😭 you're gonna get copper poisoning
anyways, coding uses a lot of symbols. on a typical mobile keyboard, that means you will have to switch keyboards very frequently. there are some apps that can help with that (with their own keyboard with symbols), or some keyboards that let you use symbols without switching.
beyond that, using tab, autocompleting quotes, intellisense, a lot of these play very poorly with mobile input methods.
you can "learn" if it's just reading, but practicing, you're better off using something that has a physical keyboard and access to proper IDEs
Thanks for the information , I will use the school laptop if it works
hui
Jokes on you i buy only the best made with pure gold cables cause those are good for you to consume
i wonder if you can get gold poisoning despite its unreactivity
For some reason whenever i try changing the inputs button presses to be set to "Press Only" in the interactions section, nothing changes about them
From what I heard this is supposed to be functionally the same as GetButtonDown
Is there any more in depth docu about scenes in unity? The official docu is very lacking in that regard because it only mentions it being useful for having multiple level for example. But I see onstantly people using scenes for their landscape, background, ui, static objects and sometimes even their damn character.
press only is the default behaviour
this is incorrect. wasPressedThisFrame is one of the direct analogues to GetButtonDown. if you're using event callbacks or messages, you need to also check the state, in the phase or isPressed, depending on how you've set it up.
if your inputs are not acting as desired, perhaps ask in #🖱️┃input-system, and provide this info: the desired behavior (what do you want to detect, what do you want to ignore?) and how you're receiving input (any relevant objects in the inspector eg PlayerInput, InputActionReference, what objects are you accessing in code)
scenes are, at their core, groups of objects that can be loaded or unloaded as a group. they can be used for many things, levels are just one such use
Okay but one more thing. What are those code paste website things called again?
!code
📃 Large Code Blocks
Use links to services like:
https://pastes.dev/
https://paste.yunohost.org/
https://share.sidia.net/
https://paste.ofcode.org/
https://paste.myst.rs/
📃 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.
Thank you
Hi! 2 questions here;
- How can I change the URP Graphics API via code?
- How can make an collider mesh in blender and import it into Unity? Sort of like how Godot lets you add _col to the object name to add a collider when you import it.
- what do you mean by "changing" an entire API? what's the goal there
- not a code question, ask in #🔀┃art-asset-workflow
- So changing from DX12 to DX11 to Vulkan (and vice-versa)
- Okay thanks!
This is what I am referencing, how can I choose which Graphics API is being used? I see games with one package(such as PEAK), use multiple graphics APIs.
-# PEAK being able to choose the Graphics API being used
It's not done with code. Note how it uses a separate launcher before even running the game. See https://docs.unity3d.com/Manual/PlayerCommandLineArguments.html for the launch options
Ohhh okay! Thanks!
@elder hearth that's not a separate launcher btw, that popup is something steam automatically gives you (when you set this up through steamworks)
Oh of that I am fully aware, that just passes arguments to the unity CMD launcher right?
yeah
is there a way to GetComponent in a gameobject's children but not it's grandchildren?
yes with a direct reference
if its child why not just link in the inspector?
GetCompoentInChildren looks for the First object with the component, parent included
without knowing how many children it had though, is there a way to stop it from looking in grandchildren?
i want to get a script from every child object but not from grandchild objects
again why not just make an array in the inspector
if the script is on the grandchildren it will include those unless you do some sketchy shit with transform checks
getting a script from every child already sounds really like a xy problem
pretty sure can be solved better
or with events and power of oop
ig i dont have to it would just be convenient to not have to drag them all
You can multi select multiple object and drag once.. its not a big deal lol
takes 1 drag..
it would also be convenient to not have to debug that system of dynamically grabbing references
when direct references are possible, it's often much better
Whenever my player character is selected, the jump height and look sensitivity is as it should be. But when I deselect my player, something happens to it for some reason and they both go way down.
very weird
Your code is dependent on framerate. When you have the player selected, the values in the inspector change and drop the framerate in the editor. When it's deselected the framerate goes up and the game runs faster
alright yeah just say it faster 😔
For unity specifically 2d what are the best tutorials to get you to a high level fast
If you are looking for shortcuts, you are setting up yourself for a frustrating fail.
Go through courses on Unity Learn, then you'll be much better equipped to absorb more specific tutorials.
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Thanks
So I'm missing some deltatime shenanagins?
(also sorry for the late response)
📃 Large Code Blocks
Use links to services like:
https://pastes.dev/
https://paste.yunohost.org/
https://share.sidia.net/
https://paste.ofcode.org/
https://paste.myst.rs/
📃 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 please don't use photos/videos of screens, use screenshots or recordings instead
Where can I apply to be come fire what do I need to do
to become fire...?
Spontaneous combustion is a difficult goal, I probably would not recommend that lifestyle.
fire walk with me
That requires many years of learning the arcane arts. Transfiguration into elemental manifestations is an advanced topic.
go to the nearest gas station
RealtimeCSG-1_601 gives me a lot of warnings, how do i fix it?
what do the warnings say
Unable to find style 'WinBtnClose' in skin 'DarkSkin' repaint
UnityEngine.GUIStyle:op_Implicit (string)
RealtimeCSG.EditModeSelectionGUI:OnEditModeSelectionSceneGUI () (at Assets/RealtimeCSG-1_601/RealtimeCSG/Plugins/Editor/Scripts/View/GUI/EditModeGUI/EditModeSelection.GUI.cs:154)
RealtimeCSG.EditModeSelectionGUI:HandleSceneGUI (int) (at Assets/RealtimeCSG-1_601/RealtimeCSG/Plugins/Editor/Scripts/View/GUI/EditModeGUI/EditModeSelection.GUI.cs:52)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
ask the realtimecsg developers
is using csg best way to build in unity?
Oh, Realtime CSG!
It's a very old package
I wouldn't be surprised if it was trying to use GUI skins whose names have changed
I used to use it, but it does not work on my Macbook, alas
I love brush-based level design. It's dramatically faster than something like Probuilder
You'd need to fix the editor code that's trying to use the invalid styles. I don't know a lot about this, though...
(that is, about what names would be valid)
ok, so if its old then i should use something newer right? is there a better builder?
unfortunately not! I have not found a solid replacement for RealtimeCSG.
Chisel is the closest thing I've used, and it's kind of glitchy (it's still in alpha)
I do use a tool named "PoseidonCSG", but that's not brush-based
It carves meshes together
e.g. like this
this is actually just a bunch of square rooms
I am a big fan of it, but it's not a replacement for Realtime
ok thanks
I only switched off of Realtime because it includes a native .DLL that simply can't run on ARM macOS
Yoooo,can someone send me a script to do the player movement?
You dont need to crosspost.
and no do your own work
i do this and doesnt work using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
[Header("Movimiento")]
public float speed = 5f;
[Header("Componentes")]
public CharacterController controller;
void Update()
{
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
Vector3 move = transform.right * x + transform.forward * z;
controller.Move(move * speed * Time.deltaTime);
}
}
probably because you have 0 clue what any of this does and how would you even implement this
or have errors in Console, either way you have to learn the program you wish the use before using it
Ok…
assuming they even put the script on the gameobject, I bet the editor is screaming about the Input Handling being New while using Old
any errors or warning in the console?
why are you guys being so harsh to others while mini modding..
i dont see whats the point behind what you guys are doing
bro really spammed another channel to say this shit 🤕
which is why rules were made aware to you, but being combative instead of accepting and moving on, a sign of immaturity somewhere..
bro where are you from
now you're posting in a channel even more unrelated to your rantings
aight aight
is there a general chat
hey, is anybody here using https://github.com/naelstrof/JigglePhysics ? I keep getting super weird glitchy behaviour. Perhaps there is someone here who knows how to trouble shoot such things
super weird glitchy behaviour
doesn't say much.. no one can troubleshoot off that
I tried messing around with all the parameters. But it makes no difference. I've disabled collisions. I've tried adding angle limits. Nothing has any effect whatsoever
have you tested other models ? also should've at least put a NSFW with a Spoiler markdown
The hair also has physics and it works fine
the weird thing is that it used to work well in the past. And then one day it started glitching without me really chainging anything
clearly something was changed, pretty rare things break on their own that drastic
do you have a previous commit you can check to compare?
Hm... I've pulled an older version of the .fbx model and it works well. But the crazy thing is that my current fbx that glitches out is literally the same model. I imported both into blender. Here they are side by side
The only difference I see is that the fbx that works has a pose, and the one that doesn't is in rest-pose. But it shouldn't matter, as the pose is over-written by the animations anyway
eh could be related something in animation itself or maybe a setting was changed on model in unity somehow
only you would know what changed between those two times
Where did the error even come from? All I did was spawn a button
clear console, try resetting the layout or restart unity
do you have something selected? where is your inspector 🤔
looks like the editor shitting itself not your code per-se
It went full black. You can see on the right side
Thanks. it's fixed
bit wild but ok
I mean its to be expected using such an early version of unity
it happens other versions but less in more matured versions (LTS usually)
misleading "supported" unity puts to make people think its good lol but still you're 5 patches behind . Latest is 9f tho
I see
oh there we go good timing lol as I said that..
Ok... it's getting weirder and weirder. I found the issue. I took the skeleton from the working fbx and from the broken fbx, put then side by side and compared. Everything is identical except for two bones (that hold a sword). They are named the same. They are parented exactly the same. The only differnece is that in the broken fbx, those bones are moved slightly forward. I copied those two bones from the working fbx and pasted them to the broken fbx and re exported and the broken fbx is now working just fine. I am so confused.
And these two bones have nothing to do with the breast or glute bones which are glitching out
I just checked. Those two bones are not even keyed by the animations at all.
This plugin is just broken
Yea, literally. I just took the broken fbx again, this time I didn't even copy the bones from the working one, I just moved them slightly to the back to be more or less where they were, re exported and now it's working again. wtf
I tried to take the broken fbx and re-created a prefab from it, added just the breast bones themselves and it breaks there as well. These bones are not even keyed or related to the breat bones in any way or form. I thought that maybe this plugin does some hidden behind-the-scenes caching and maybe that cache was out of date or something. But it breaks even on a completely freshly made prefab.
do you guys know any better plugins for jiggle physics? Or is everyone using this one and I am the only one who struggles with weird ass glitches
Dont crosspost, use #1180170818983051344 for promotion
For like a first game is it ok to use some AI
learn
this is a coding channel
Will Hong's Dynamic Bone is the most popular one
there is also magica cloth
The game is pretty simple. Might learn for my next game
i couldent find my way back to the 2d art place or whatever so ima just ask here-----why does he have weird black triangles on him he dident last time
typical unity newbie "projects"
I think I'm making 60 red ! thingies per second
also the simulation literally works anyway
maybe I should try to optimize for ! production.
is there a limit to ! per second?
you have shaded wireframe mode on, change back to shaded in scene view
Is there a limit to what?
amount of these things produced
so it isent going to blow my computer up? thank you
haha no its an optional mode
all channels are listed in #📑┃channel-directory as well
so you can always use it to find one
danke
chances are whatever is causing the error is inside of an update function
its most likely a singular problem rather than multiple
thank you for prodiving useful advice
my main intention was however to share a funny situation
although now that I think about it it would not be funny for someone who actually knows unity so whatever
Opened my phone to discord being open and this being the first thing i see on the lower half of my screen and i seriously thought my phone cracked since i last touched it 😭
This is a Unity server
oh omg sorry
Damn
<@&502884371011731486>
?ban 862406848182747206 spam off-topic job advertisement
cloud100005 was banned.
Hello everyone ! i want to fade some instantiated game Object that have the same materials,do i have to instantiate a new material so i can fade it individually or are there any other way ?
depends what you're fading but yes you can fad inidividually
simply affecting a copy / disopsing works fine, for better performances MaterialPropertyBlock is also an option
its a sphere that have to fade out after some seconds , But I think I've found a video where I could adapt the script.(https://youtu.be/vmLIy62Gsnk)
Learn how you can easily fade out objects that are using the standard URP shaders that obstruct view to the player using C# code!
In this tutorial you'll see how to determine which material properties to adjust for the standard URP shaders:
⚫ Universal Render Pipeline/Lit
⚫ Universal Render Pipeline/Complex Lit
⚫ Universal Render Pipeline...
thank you i dont really know what disopsing is so i'll have a look
disposing that was if you were to create a copy to modify so you don't mess with the shared one
oh okay thx
when you create a new material each time it causes more garbage ideally you dispose of it when done
sure
Does anyone know how to script well?
idk
a lot of people do
!ask 👇 pay particular attention to the last few points
: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
so if you have a question and need help you should ask
I take out my feather pen and write soliloquies
Would anyone be able to help me decide which implementation of the following to choose from? I'm having some fun making a deckbuilder game and trying to finalize the process of making new Cards. I have a List<CardActions> of ScriptableObjects that executes in order and does the logic of a card (does damage, draws cards, heals target, repeats CardActions, etc). Then where I'd like advice in is what way should I modify the CardActions? I have three implementations so far: List<CardActionModifiers> which reads like a sentence so easy to create new cards but heavily relies on enums and if-statements. List<CardStatCheckModifiers> which just does a simple bool check and it's the CardActions themselves that sees if true then flip on/off a bonus like more damage. And then lastly I have List<CardBonuses> which is more modular since I get to drag and drop a specific bool-check SO and then any CardBonus SO which if evaluates true, applies the bonus. All three of these do a "Does player have >= 12 intelligence? If true, add 2 damage to Fire Bolt".
oh sorry
why has CircleCastAllNonAlloc been deprecated, when it seems like no suitable overload for CircleCastAll exists to replace it?
there's no int return type overload, which means I can't use a previously allocated array the way I would with OverlapSphere
the overload you want is on CircleCast not CircleCastAll
