#💻┃code-beginner

1 messages · Page 846 of 1

waxen jasper
#

And the behavior associated with that type

rich adder
#

yeah but what do you have now?

#

like enums or something

waxen jasper
#

The ball stores it’s behavior rn

rich adder
#

so they have the same script?

waxen jasper
#

Yes

rich adder
#

ok so on that script you have some way to distinguish they are different ?

waxen jasper
#

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

rich adder
#

you can use also a poco , depends how you want your workflow

#

or both

waxen jasper
#

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

rough granite
#

used them once and hated them ~_~

rich adder
#

you're missing out

rich adder
waxen jasper
#

But like should i store the prefab in the SO to make the game objects

rich adder
#

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

waxen jasper
#

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

rich adder
#

pretty much

waxen jasper
#

Like a new sprite and stuff

#

Omg I’m so dumb

#

Every ball does have the same prefab

rough granite
#

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)

waxen jasper
#

Yeah thanks

rich adder
#
//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

rich adder
#

kinda

rough granite
rich adder
#

lord..

rough granite
#

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

rich adder
#

this is a nightmare to maintain.

rough granite
#

it was

#

main reason why i dropped the project even though i loved it

rich adder
#

thats why SOs are so great

#

you can just keep creating them like a new text file and boom its own thing

rough granite
# rich adder thats why SOs are so great

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

earnest coral
#

hello, i am new:)

#

and i am also very confused

rich adder
earnest coral
#

i have so many ideas for lore, but i cant make a game vro😔

teal viper
earnest coral
#

but i wanna make a game dog😔

teal viper
#

Not sure what a game dog is, but you'll need to learn gamedev to do it.

rich adder
#

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)

rough granite
earnest coral
#

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

rich adder
rough granite
rough granite
#

!collab, smh

radiant voidBOT
# rough granite !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**

teal viper
#

And

#

!learn

radiant voidBOT
rich adder
earnest coral
#

i have money

rich adder
#

ok then look into making a post where linked in bot msg

earnest coral
#

alrighty

cosmic sable
#

any youtube tutorial that explains a lot of unity math stuff?

naive pawn
#

that's a very broad topic and what you need will depend on what you're making

cosmic sable
#

I've been stuck a lot cause of these math functions

#

I feel like I really need it

naive pawn
#

could you be more specific

cosmic sable
#

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

naive pawn
#

that's still very vague and i have no idea what it is you're having issues with

cosmic sable
#

ahh basically, just the foundation for me to take math functions in

#

its like donut blender basically

naive pawn
#

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"

rich adder
#

even music

naive pawn
#

it'd be a waste of your time (and a fool's errand) to learn "all of math"

cosmic sable
#

the basics of math functions like, transform.position basically

rich adder
naive pawn
#

what specifically do you need help with?

cosmic sable
#

I guess yeah

naive pawn
#

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.

cosmic sable
#

gotchu

polar acorn
warm magnet
#

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?

night raptor
warm magnet
#

-# sorry if i dont make sense these terms are quite new to me

night raptor
warm magnet
#

so i can use it to find the relative speed of the player

#

nvm for now, think i found a lead

night raptor
#

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)

keen dew
#

If you just want the velocity at that frame it's (position after RotateAround minus position before RotateAround) divided by deltaTime

night raptor
#

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)

warm magnet
#

right, ive tried using transform.position - previousframe transform.position to get the movement vectors but that doesnt seem to work correctly

night raptor
warm magnet
#

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?

naive pawn
#

!code

radiant voidBOT
night raptor
#

now you are taking a position, multiplying it by deltaTime and the subtracting

night raptor
#

yes

naive pawn
#

these are really hard to read, can you just use codeblocks

warm magnet
# night raptor yes

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????

naive pawn
#

log before that point

warm magnet
#

oh damn im stupid

#

it still logs that the vector is 0 tho

#

wait

#

oh nvm

light glacier
#

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?

naive pawn
#

is that the only unload call you have?

#

also check if you're perhaps calling it multiple times

light glacier
#

Thanks I just noticed with the debugger it actually gets called twice

marble turret
#

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.

rich adder
fleet quiver
#

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

polar acorn
#

!learn

radiant voidBOT
solar kettle
#

Hello - how can I found out why this error suddenly appears? It happened after having closed Unity and opening it later in the day.

rich adder
fleet quiver
#

guys, how do i make a prefab only scale one way and not both

solar hill
#

what

fleet quiver
#

yeah

lament raft
#

My unity keeps lagging even when im not playing

rich adder
hard mantle
solar hill
#

and coding in general

#

the learning pathways are more unity specific

hard mantle
solar hill
#

its good youre aware of that

rich adder
#

yikes you paid to get scammed?

solar hill
#

but also yeah if youre going to pay for AI you kinda picked the worst option lol

hard mantle
solar hill
#

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

rich adder
#

learning "normal" c# you realize unity does nothing special with the code

solar hill
#

i still think its good to at least familiarize yourself with c# outside of unity first

rich adder
#

the only concepts you need to know are specific to their workflow like wat are GameObjects, Scenes, lifecycle of objects etc.

solar hill
#

but at the end of the day, youl be doing the brunt of the learning within Unity

hard mantle
# rich adder yikes you paid to get scammed?

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

solar kettle
hard mantle
#

thanks alot

#

this will be a long journey.

#

will be worth it tho

rich adder
#

its good knowledge to have because it carries over to other things

hard mantle
#

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

rich adder
#

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

hard mantle
lime basalt
#

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

frail hawk
#

what is your actual question

radiant voidBOT
# cosmic dagger !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

lime basalt
#

im learning to make collectibles and i feel im writing the code word for word but my collectible still wont get collected

slender nymph
#

!ide

radiant voidBOT
slender nymph
#

also the issue is probably scene setup related rather than the code here

lime basalt
#

hmm soo you thnk i messed up putting my collectible somewhere?

frail hawk
#

do you have colliders on both objects and a rigidbody involved

lime basalt
#

box collider? if so , then yes

#

do i need "is trigger" on my player as well

slender nymph
hard fossil
#

No, only the collectable should be set to isTrigger.

lime basalt
#

really quick , am i not suppoed to do the normal rigibody? the one at the top

slender nymph
#

you need that if you are working in 3d, yes

#

you also need a collider because the rigidbody is not a collider itself

lime basalt
#

could it be as simple as me using a box collider when im using a star? lol

slender nymph
#

go through the link i sent. it walks you through everything you need to check

lime basalt
#

alr ty

hard fossil
#

You should have a collider and rigidbody on the player, and a collider set to trigger on the collectable, as well as your script.

polar acorn
#

You also need to be actually moving using the rigidbody

#

Teleportation with transform doesn't collide

lime basalt
#

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

polar acorn
#

Whitespace does not affect anything

#

Most likely, you didn't save

lime basalt
#

this option doesnt save? i also exited it out directly

dreamy scarab
#

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.

polar acorn
#

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

dreamy scarab
#

ok, tks ^-^

vital barn
#

#if false

polar acorn
late dew
#

I'm trying to make a fps game and I don't know how to code using visual studio can someone help?

sour fulcrum
#

!learn

radiant voidBOT
solar hill
#

like how to connect your ide to unity?

#

or coding in general?

late dew
#

yeah when ever im doing something the little list on the side doesn't show

solar hill
#

little list?

#

youre going to need to be a bit more verbose here

solar hill
#

ah yeah you just have to set up your ide

#

!ide

radiant voidBOT
late dew
#

Thanks

naive pawn
cosmic sable
#

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

slender nymph
#

just practice/experience. it's just like any other skill, you'll get better as faster as you keep doing it

naive pawn
#

with experience you can make those 2 tasks overlap and/or do the problem-solving mentally

smoky breach
#

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

night notch
#

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?

naive pawn
#

how are you moving the player?

night notch
#

can i send the code here?

naive pawn
#

sure

#

!code

radiant voidBOT
naive pawn
#

also, does it have appropriate collider and rigidbody components

night notch
#

when i first tried i used rigidbody but he starts to fall, i removed the gravity but it dosen't help either

naive pawn
#

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

night notch
#

oh sorry

naive pawn
#

see the "large code blocks" section

night notch
#

where do i post?

night notch
naive pawn
#

in one of the websites linked there

night notch
#

don't know what is better

naive pawn
naive pawn
naive pawn
#

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

night notch
#

i didn't know i could use rb in a point and click game

#

i don't know much btw

naive pawn
#

those are 2 completely separate things

#

if you have something that you need physics for, you would use the physics system

night notch
#

and if i don't i can just use the rb wihout it?

naive pawn
#

if you don't need physics then you wouldn't use physics

night notch
#

nice

naive pawn
#

so do you need physics or not

night notch
#

no

naive pawn
#

so there wouldn't be any notion of "collision" then

#

what was the issue you had?

night notch
#

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

rough granite
rough granite
night notch
naive pawn
#

collision is physics

night notch
#

makes sense

naive pawn
night notch
night notch
naive pawn
#

you can click anywhere and the character walks there?

night notch
#

yes

naive pawn
#

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?

rough granite
night notch
#

the idea was to make NPCs come and ask for some types of food and then eat, pay and go

naive pawn
#

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?

rough granite
naive pawn
#

bro what

rough granite
sour fulcrum
#

point and click movement != point and click genre

naive pawn
#

most point and click games don't even have point and click movement

#

it's point and click selection

naive pawn
night notch
#

can i send a short video of the game?

naive pawn
#

sure

#

(assuming it isn't nsfw or anything like that)

night notch
#

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

grand seal
night notch
#

i created colliders

grand seal
#

Get mouse touch position and blend player position to touch position

naive pawn
#

you would not be blending anything

naive pawn
grand seal
#

🙂 then you can use navigation

sour fulcrum
#

if you dont know what your talking about dont respond 👍

rough granite
grand seal
#

🙂

night notch
grand seal
#

So I told

night notch
#

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

sour fulcrum
#

this is harder than you might think

night notch
#

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?

naive pawn
#

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

sage mirage
#

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.

sage mirage
#

Α* even a simple implementation seems to complicated omg

sour fulcrum
#

That’s why it’s not your job to make it 😄

#

Some things are better off premade

sage mirage
#

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

teal viper
#

A* is not that complicated IMHO.

cyan marsh
#

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

teal viper
cyan marsh
#

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

teal viper
#

Player.cs file line 7. Look at the error again.

#

Provide code properly if you need help figuring it out.

#

!vode

radiant voidBOT
# teal viper !vode
<:error:1413114584763596884> Command not found

There's no command called vode.

teal viper
#

!code

radiant voidBOT
slate wind
#

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.

sage mirage
#

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?

teal viper
#

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.

sage mirage
#

you have to convert because A* does not work with vectors

#

it works with grid nodes

#

so WorldPosition -> Grid Nodes convertion

#

I assume

naive pawn
#

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

teal viper
cyan marsh
teal viper
cyan marsh
#

okay cheers mate

midnight tree
#

you can also remove second using UnityEngine; on line 3 but yeah it just a visual correction.

cyan marsh
#

wait is anything with public int meant to have a ; on the end of it?

cyan marsh
teal viper
naive pawn
#

(pedantically that's not entirely true but it's a good rule of thumb)

cyan marsh
#

can you recommend any videos or something to read on about c sharp basics? just kinda been free balling it with yt videos

naive pawn
#

the culprit here is a field declaration rather than a statement, but yes these need semis as well

naive pawn
sour fulcrum
teal viper
#

Declarations are statements too afaik.

naive pawn
#

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)

teal viper
#

Yeah, you're probably right about field declarations.

#

Still, they need semicolons.

cyan marsh
#

okay quick random question why does making some statments just use () while others need ()) what does the double )) do?

teal viper
#

They don't.

#

It's probably because one statement is in another one.

naive pawn
#

() is used to call methods and constructors

sour fulcrum
#

(And to make them)

teal viper
#

Conditionals and loops too

naive pawn
#

if you're passing the result of a method or a constructor to another one, you will have nested braces, for example

naive pawn
cyan marsh
#

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

sour fulcrum
#

Both

#

You’ll never finish learning either

naive pawn
# cyan marsh okay i really need to learn some stuff on c sharp language :0

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)

cyan marsh
#

i have found most the problems i thought having a ; and the end of that private void was looking a bit weird

naive pawn
#

that's called a method, it returns void, it's not called a void

cyan marsh
#

wait so private void Die() thats a method? isnt that just a return or something along those lines?

naive pawn
#

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

cyan marsh
#

okay so why does it say void if its a method?

naive pawn
#

that's what type it returns

cyan marsh
#

sorry if these a dumbass questions

naive pawn
#

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

cyan marsh
#

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?

naive pawn
#

what text?

sour fulcrum
#

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

cyan marsh
naive pawn
#

the text is just text

#

it's declaring/defining what Die is

#

Die is the method, it returns void, aka nothing

cyan marsh
#

oh okay i think i get it so its just returning to void so it just doesnt run the code again?

solar hill
#

Not really no

cyan marsh
#

okay im so confused i look this shit up and everything

naive pawn
#

it's not returning to void

#

it's returning nothing. that's referred to as returning void in code

cyan marsh
#

yeah thats what i meant when i said returning to void sorry

#

well not all of it but returning to nothing

naive pawn
#

specific wording is kinda important here think

#

the only thing it's returning to is the caller (whatever called the method)

cyan marsh
#

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

solar hill
#

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

cyan marsh
#

ah okay thanks that was the easyist thing to under stand ahahah

naive pawn
#

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

cyan marsh
#

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?

naive pawn
#

either your physics setup, your level setup, or your code

cyan marsh
#

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?

naive pawn
#

already mentioned resources in pins

cyan marsh
#

ah yeah mb

#

thanks for your help today man (and everyone else) much appreciated

real thunder
#

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?

teal viper
night raptor
#

File handling is specially prone to exceptions which you can't always prevent yourself so being prepared for them is always a good thing

warm magnet
#

is multiplayer very hard to do?

teal viper
#

It depends, but it's definitely not a beginner topic

slim solar
sour fulcrum
#

(Which still means it’s pretty hard)

placid jewel
# warm magnet is multiplayer very hard to do?

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"

slate wind
slim solar
placid jewel
#

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

real thunder
#
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?

teal viper
#

throw after return doesn't make sense. It should throw an error or a warning at least.

real thunder
#

autocomplete just gave me System.Exception I assume it's any

#

I guess I should just remove throw

#

...or not

teal viper
#

Yes, exception should work. Though, if you don't use the exception object, I think you can skip it entirely.

real thunder
#

ok return after throw would make more sense

slim solar
#

Have you considered using a plugin for saving, or just wanna make your own?

#

(Lots of free ones)

naive pawn
#

throw; doesn't make sense

naive pawn
teal viper
naive pawn
#

does this make sense?

int X() {
  return 1;
  return 2;
}
real thunder
#
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

naive pawn
#

return and throw both end the function execution into different paths. anything after a return or throw won't run

teal viper
#

Depends on what your goal is

real thunder
#

I ll be curious what is it anyway

naive pawn
#

do you know how exceptions work in general?

#

eg the bubbling up behaviour

real thunder
#

of course
not

naive pawn
#

right, go look that up

teal viper
#

Unless you catch that exception somewhere else, you'll basically get a crash.

real thunder
#

oh

naive pawn
#

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.

real thunder
#

I am getting vague picture itunitively now

naive pawn
real thunder
#
catch (System.Exception exception)
            {
                Debug.LogError("Game save failed " + exception.Message);
                return;
            }

I suppose this will do

naive pawn
#

you don't need the return there, it's the end of the function

real thunder
#

well, yes

naive pawn
#

(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)

slate wind
placid jewel
real thunder
#

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?

dense plume
#

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?

real thunder
#

compress

dense plume
#

?? Please elaborate. Unless you've got an object that will somehow serialize to a multi-megabyte JSON, compression feels excessive

real thunder
#

I know I can make data smaller so why not to do that

polar acorn
#

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

dense plume
#

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

keen dew
#

Base64 is always bigger than the original string. It's not a compression algorithm

dense plume
#

Forget what I said then 😛 not too familiar with it other than as a string based way to transmit image data

real thunder
#

BitConverter.ToString something?

polar acorn
#

Base64 turns bytes into letters. Letters are already letters, so you can't get more letter per letter

real thunder
#

I ll be having floats ints and bools inside a struct likely

#

would make sense to convert struct into bits and then to string?

dense plume
#

How many fields are we talking here?

#

I have class objects with 50+ fields I serialize to JSON and it's still extremely small

real thunder
#

something comparable I guess

#

still I want to see how far I could push it

dense plume
#

Sure, look into bit streams I think

#

Something something binary serialization with MessagePack

#

It's got LZ4 compression options for maximum smallness

real thunder
#

how do I instantiate a prefab as a component

rich adder
#

prefab's Type must be of the component you want (edited for clarity)

real thunder
#

Cannot implicitly convert type 'UnityEngine.GameObject' to 'PlayerSave' CS0029

rich adder
#

you're trying to fit a square peg in a round hole rn

placid jewel
polar acorn
real thunder
#

so I need to keep prefab as a component aswell?

real thunder
polar acorn
#

As you were told, use the type you actually want

placid jewel
# real thunder GameObject

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

real thunder
#

alr
this is really confusing for me because I ve been doing it through GameObject for years

rich adder
#

never too late to learn the correct way 😛

real thunder
rich adder
#

both
you declare the Prefab as the type you want, The component / type must be on the gameobject / prefab

real thunder
#

yeah I get it now

rich adder
#

otherwise it wont let you drag in the prefab

real thunder
#

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?

rich adder
real thunder
#

my question is about will Awake of Instantiated thing execute after or within Awake which instantiated it

rich adder
#

thats why I said you can also test it by putting logs in awake of each script

real thunder
#

I mean I could but I hoped it was a trivial question

rich adder
#

Awake is unitys way of a "constructor" so creating a component makes Awake run (assuming the gameobject is enabled)

swift crag
#

apparently it's a performance consideration

#

(i find it very annoying!)

swift crag
#

(there's no reason you can't call a method on a component whose game object is deactivated)

swift crag
grand snow
#

New search can but it can be dog slow

night notch
#

if you know what you want to do but don't know how to do it where do you guys search?

slim solar
#

here (or google, youtube, ai, etc)
knowing what you want to do is basically the first step 😛

night notch
#

it's so hard to translate what i have in mind to words that the google will understand

marsh axle
#

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

twin pivot
marsh axle
mint imp
marsh axle
sturdy sparrow
#

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.

swift crag
#

how are xMov and zMov calculated?

sturdy sparrow
#

float xMov = xInput * moveSpeed;
float zMov = zInput * moveSpeed;

swift crag
#

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)

sturdy sparrow
#

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

thorny stratus
#

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

frosty hound
#

Yes, you're not going to jail if you do.

sour fulcrum
#

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

thorny stratus
thorny stratus
cosmic sable
#

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

frosty hound
#

Yeah, sure. You could always object pool it if it's something reusable.

#

But if you don't need it anymore, remove it.

cosmic sable
#

thanks, I will look into this

sour fulcrum
#

inventory systems are def. a programming/unity skill check

frosty hound
#

I've made way too many, and each time they look/function differently. It really is a very open ended feature.

naive pawn
#

(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)

vagrant niche
#

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

naive pawn
#

different pool can be same script

rich adder
#

much neater to keep them separate, make a parent class

naive pawn
#

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?)

rich adder
#

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

naive pawn
#

...yeah? you don't need children for that, just separate instances

rich adder
#

confused myself I think we saying similar thing lol

naive pawn
#

you're saying to make subclasses, i'm saying to not...?

#

are you suggesting subclasses? i'm confused

rich adder
#

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

naive pawn
#

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

vagrant niche
#

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?

rich adder
#

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

naive pawn
#

i think GenericPool is just a singleton ObjectPool effectively

rich adder
#

ohh so i t seems

#

its been a while

naive pawn
#

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

vagrant niche
#

oh okay cool i didn’t realise there was built in stuff for pooling

#

i kinda just made my own functionality for it

rich adder
#

yeah its fairly new

naive pawn
#

oh it is?

rich adder
#

I think 2021?

naive pawn
#

yeah... 2021 doesn't feel "fairly new" to me.... time is hard

#

(not necessarily disagreeing with you, just commenting on time perception)

rich adder
#

lol maybe only when I got into unity it wasnt there felt recent

naive pawn
#

2021 was 5 years ago, that's brutal

rich adder
#

in my brain "few years "

#
Unity Learn

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...

cosmic sable
#

UnityChanSalute the best way to deal with problems is by sleeping

short gust
#

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?

naive pawn
#

are you familiar with scriptable objects?

short gust
#

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

naive pawn
#

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?

short gust
#

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

naive pawn
#

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

short gust
#

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

naive pawn
#

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

short gust
#

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)

naive pawn
#

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?

outer palm
#

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

keen dew
outer palm
#

I think that I found a way to do it, if it doesn't work I'll move to that channel

jovial heron
naive pawn
jovial heron
#

it's a tilemap collider, i also added a composite one i thought it might fix it but it didn't

naive pawn
wintry quarry
#

Composite operation: Merge

jovial heron
shrewd sapphire
#

hey, anyone familiar with p4 (preforce)?

naive pawn
#

!ask

radiant voidBOT
# naive pawn !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

naive pawn
#

doesn't really seem like a unity thing though...

keen acorn
#

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?

keen acorn
#

oh, my bad, cheers

naive pawn
#

(you can use the forward message feature to avoid having to reupload everything btw)

#

oh sick lmao

keen acorn
#

ye lol

fair sinew
#

Hey can anyone tell me the best way to move a rigid body

#

For a responsive movements ?

undone rampart
fair sinew
undone rampart
#

wdym latency?

fair sinew
naive pawn
fair sinew
#

Inputs take time and since it’s additive in nature

naive pawn
#

that's not a thing with AddForce specifically, that'd be a thing with how you handle movement overall

fair sinew
naive pawn
#

let me guess, your rb is dynamic

fair sinew
naive pawn
#

i specifically did not list MovePosition as an option for dynamic rbs

#

so, no surprises there

fair sinew
#

But then gravity stops working

#

Is there anything that gives best of both worlds 🤔

naive pawn
naive pawn
fair sinew
naive pawn
#

figure out how you want the player to behave or handle

fair sinew
naive pawn
#

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

fair sinew
#

Yea guess that’s the only way nowVintageUnity

#

Ohh by the way does unity runs better on windows or Linux?

undone rampart
#

moveDirection is your input vector

naive pawn
naive pawn
undone rampart
#

this will move the dynamic rigidbody smoothly without sliding

fair sinew
fair sinew
naive pawn
undone rampart
#

no instant stops

#

or velocity overrides

naive pawn
#

you're applying an instantaneous force, it's basically a velocity override

fair sinew
naive pawn
#
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
undone rampart
naive pawn
#

so trivially, that's equivalent to just doing PlayerRigidbody.linearVelocity = targetVelocity;

naive pawn
#

it has the same behaviour as modifying the linearVelocity, it's not going to "keep it smooth" more than modifying the velocity directly

undone rampart
#

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

naive pawn
#

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

cosmic sable
#

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

naive pawn
#

there isn't one

cosmic sable
#

what

#

what is that robot looking thing

#

is that free?

naive pawn
#

you might be thinking of something provided with a tutorial package?

cosmic sable
#

U see those in unreal engine/unity all the time on dev logs, I just dk what it's called

naive pawn
#

there are some provided by unity (company), but nothing built into unity (game engine)

undone rampart
naive pawn
#

this?

#

i just googled "unity default humanoid" and scrolled a bit

cosmic sable
#

I guess yeah

naive pawn
#

if these aren't it you can google for one yourself

cosmic sable
#

ahh yeah that's the one

#

thanks

naive pawn
severe prawn
#

Can I actually learn coding on a device

naive pawn
#

what else would you learn coding on

severe prawn
cosmic sable
#

the holy spirit is starting to code

naive pawn
severe prawn
severe prawn
keen dew
#

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?

cosmic sable
#

eyy my man, calm down ur holy spirit

#

u're supposed to offer salvation not throw hands

teal viper
severe prawn
naive pawn
#

you can, but it won't be fun

cosmic sable
#

isn't there a guy, coding in godot engine on his mobile phone

#

I saw a video

severe prawn
naive pawn
#

without a device

#

do you know what a device is lol

severe prawn
naive pawn
#

connection name? what even...

teal viper
#

I have a device for cooling nutritional items that I consume to stay alive.

naive pawn
naive pawn
# naive pawn you *can*, but it won't be fun

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

severe prawn
pure meteor
#

hui

rough granite
naive pawn
#

i wonder if you can get gold poisoning despite its unreactivity

pliant dome
#

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

light glacier
#

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.

naive pawn
naive pawn
# pliant dome From what I heard this is supposed to be functionally the same as GetButtonDown

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)

naive pawn
pliant dome
naive pawn
#

!code

radiant voidBOT
pliant dome
#

Thank you

elder hearth
#

Hi! 2 questions here;

  1. How can I change the URP Graphics API via code?
  2. 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.
naive pawn
elder hearth
elder hearth
#

-# PEAK being able to choose the Graphics API being used

keen dew
elder hearth
#

Ohhh okay! Thanks!

cosmic quail
elder hearth
warm magnet
#

is there a way to GetComponent in a gameobject's children but not it's grandchildren?

frail hawk
#

yes with a direct reference

rich adder
#

GetCompoentInChildren looks for the First object with the component, parent included

warm magnet
#

i want to get a script from every child object but not from grandchild objects

rich adder
#

if the script is on the grandchildren it will include those unless you do some sketchy shit with transform checks

frail hawk
#

getting a script from every child already sounds really like a xy problem

#

pretty sure can be solved better

rich adder
#

yea array in inspector lol

#

why do this at runtime?

#
  • OP
frail hawk
#

or with events and power of oop

warm magnet
#

ig i dont have to it would just be convenient to not have to drag them all

rich adder
#

You can multi select multiple object and drag once.. its not a big deal lol

#

takes 1 drag..

naive pawn
#

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

pliant chasm
#

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.

solar hill
#

very weird

keen dew
#

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

solar hill
#

alright yeah just say it faster 😔

shell quartz
#

For unity specifically 2d what are the best tutorials to get you to a high level fast

fickle plume
#

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

radiant voidBOT
pliant chasm
#

(also sorry for the late response)

naive pawn
#

probably

#

share code, perhaps

#

!code

radiant voidBOT
naive pawn
#

also please don't use photos/videos of screens, use screenshots or recordings instead

sharp dust
#

Where can I apply to be come fire what do I need to do

naive pawn
#

to become fire...?

zenith cypress
#

Spontaneous combustion is a difficult goal, I probably would not recommend that lifestyle.

sour fulcrum
#

fire walk with me

teal viper
burnt vapor
willow bear
#

RealtimeCSG-1_601 gives me a lot of warnings, how do i fix it?

sour fulcrum
#

what do the warnings say

willow bear
#

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&)

sour fulcrum
#

ask the realtimecsg developers

willow bear
#

is using csg best way to build in unity?

swift crag
#

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

swift crag
#

(that is, about what names would be valid)

willow bear
#

ok, so if its old then i should use something newer right? is there a better builder?

swift crag
#

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

willow bear
#

ok thanks

swift crag
#

I only switched off of Realtime because it includes a native .DLL that simply can't run on ARM macOS

cerulean wadi
#

Yoooo,can someone send me a script to do the player movement?

rich adder
cerulean wadi
#

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);
}

}

rich adder
cerulean wadi
#

Ok…

naive pawn
#

have you gone through any basic tutorials/guides?

#

if not, go do some

rich adder
#

assuming they even put the script on the gameobject, I bet the editor is screaming about the Input Handling being New while using Old

frail hawk
steady galleon
#

why are you guys being so harsh to others while mini modding..

#

i dont see whats the point behind what you guys are doing

rich adder
#

bro really spammed another channel to say this shit 🤕

dense cypress
#

bro ım new

#

my first message on the server is to tag memo and type yo

rich adder
#

which is why rules were made aware to you, but being combative instead of accepting and moving on, a sign of immaturity somewhere..

dense cypress
#

bro where are you from

rich adder
#

now you're posting in a channel even more unrelated to your rantings

dense cypress
#

is there a general chat

onyx cradle
rich adder
onyx cradle
#

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

rich adder
#

have you tested other models ? also should've at least put a NSFW with a Spoiler markdown

onyx cradle
#

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

rich adder
#

clearly something was changed, pretty rare things break on their own that drastic

#

do you have a previous commit you can check to compare?

onyx cradle
#

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

rich adder
#

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

dry sun
#

Where did the error even come from? All I did was spawn a button

rich adder
#

do you have something selected? where is your inspector 🤔

#

looks like the editor shitting itself not your code per-se

dry sun
dry sun
#

bit wild but ok

rich adder
#

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)

keen dew
rich adder
#

misleading "supported" unity puts to make people think its good lol but still you're 5 patches behind . Latest is 9f tho

rich adder
onyx cradle
# rich adder eh could be related something in animation itself or maybe a setting was changed...

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

solar hill
karmic jetty
#

For like a first game is it ok to use some AI

median hatch
solar hill
#

there is also magica cloth

karmic jetty
glossy tinsel
#

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

autumn viper
#

typical unity newbie "projects"

#

I think I'm making 60 red ! thingies per second

#

also the simulation literally works anyway

autumn viper
#

is there a limit to ! per second?

grand snow
ivory bobcat
autumn viper
glossy tinsel
grand snow
solar hill
#

so you can always use it to find one

glossy tinsel
#

danke

solar hill
#

its most likely a singular problem rather than multiple

autumn viper
rough granite
keen dew
#

This is a Unity server

cedar lagoon
#

oh omg sorry

sour fulcrum
#

<@&502884371011731486>

north kiln
#

?ban 862406848182747206 spam off-topic job advertisement

eternal falconBOT
#

dynoSuccess cloud100005 was banned.

nocturne kayak
#

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 ?

rich adder
#

simply affecting a copy / disopsing works fine, for better performances MaterialPropertyBlock is also an option

nocturne kayak
# rich adder depends what you're fading but yes you can fad inidividually

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...

▶ Play video
nocturne kayak
rich adder
rich adder
#

when you create a new material each time it causes more garbage ideally you dispose of it when done

hollow turret
#

Does anyone know how to script well?

fair pasture
solar hill
slender nymph
radiant voidBOT
# slender nymph !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

solar hill
#

so if you have a question and need help you should ask

rich adder
dawn wave
#

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".

rich adder
#

this is a coding channel

willow bear
#

oh sorry

native flame
#

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

slender nymph
#

the overload you want is on CircleCast not CircleCastAll