#💻┃code-beginner

1 messages · Page 832 of 1

wintry quarry
#

Not sure what you're actually asking

real thunder
#

aside of that chunks are used for many other things but I only curious about it

#

I am asking if anything in world record mob farms related to chunks being meshes

sour fulcrum
#

at a certain level (eg. mc) it's not necessarily easy to separate the rendering discussion from the logic discussion

real thunder
#

if each chunk is a mesh, well... it explains why half the server were crashing on my base
I got so annoyed that some things were not working evenly ect inbetween chunks that made whole ass huge modpack base in one chunk from the bottom to the top

sour fulcrum
real thunder
#

you know game is good when someone from Uni making an analysis

open crater
#

Guys i have a 2d platformer game. Can anyone explain me why when I use imput system to move the chatacter (cube) with arrows, the cube trembles against a wall when I keep pressing the button? And i also made a checkground system to control the jump but why when my cube collides with the bottom/side of platform it can still jump? I want the cube to be able to jump when on top of platforms. Last thing, im not good at creating sprites so I ask chatgbt to do this, but I would like to use the tiled function on sprites (basically when you scroll with ur mouse or change the sprite size it repeat infinitely) but chat gbt sprites does not support this. What sprites i should use in order to use tiled function?

slender nymph
#

that first part sounds entirely unrelated to the input system and sounds more like you're moving it via the transform but it has a rigidbody that is causing it to depenetrate each physics update

slender nymph
#

move using the rigidbody. of course that is simply a guess since you didn't provide any actual details

open crater
#

Hm ok i'll do that

pliant bridge
#

what is it, I just new about using noise , and then zoomed in to make a chunk in that noise
I used perlin-noise to make it btw. And then it will generate the terrain with the noise

#

mesh generation

open crater
#

What about the other two issues?

pliant bridge
#

i'm searching it up rn

#

thanks alot

slender nymph
open crater
slender nymph
#

you need to provide details about your current implementation that isn't working

#

but i'm not going to attempt to help you now since you don't want to do that so maybe someone else will come along and help with that 🤷‍♂️

polar acorn
errant breach
#

Hello ! I have a small question
playerInAttackRange = Physics.CheckSphere(transform.position, attackRange, whatIsPlayer);

My game is a 3D game, i don't want the sphere to be on the enemy, but rather in front of the ennemy, so that if the player is behing the enemy, he's not detected.

  • After looking on the documentation, there is not exemple on how to achieve that goal. I could add a value to the enemy's X position, but it would always make the sphere advance in the same direction...

If anyone know how to make it, i would be very thankful ! Thanks

wintry quarry
#

Position it where you want

slender nymph
#

create a child gameobject that is positioned where you would like the check to be in relation to the parent, then use that object's position

wintry quarry
#

Use that object's position

errant breach
#

that's a really smart way to fix this issue, thanks ! ill make that :) !

polar acorn
#

There's also the option of adding transform.forward times some distance to the position, which will get you a position that distance away from the front of the object

oak marlin
#

how can I access a script and its public variables between different scenes

polar acorn
#

But, having a bespoke game object for positioning it lets you actually see the origin, so that's probably better

errant breach
pliant bridge
#

ohhhhhh mesh generator

#

thanks alot @wintry quarry

pliant bridge
#

insane...

#

i got alot of information

#

insane

orchid wolf
#

Hey everyone, again. So I have this problem with sprite. Inside this black box I use "Grid Layout Group". When I add items in HUD manually it looks fine, but when it comes to play test, something wrong happens. Any ideas?

frail hawk
#

that happens because you did not use anchored positions for your ui elements

#

you probably just positioned them on your screen

errant breach
#

Hello, i am trying to use the SetParent

Here's the code :

var projectile = Instantiate(attackGameObjectParticle, BeakMuzzle.transform.position, BeakMuzzle.transform.rotation); projectile.transform.SetParent(BeakMuzzle);

The BeakMuzzle is a Transform well defined. But when the attackGameObjectParticle is called... It still has no parent !

Would someone be able to help me ? If you need the code, please let me know !

Have a great day :)

swift crag
#

hmm, you'd get an error if BeakMuzzle were somehow getting set to null

#

When I see no obvious problem, I will start checking my assumptions

#

such as "is this code even running?"

(it sounds unlikely, but what if you had two places that could shoot projectiles?)

#

I'd log the projectile's transform's parent before and after calling SetParent

queen vale
swift crag
#

BeakMuzzle is a transform

#

(so, notably, BeakMuzzle.transform.position is redundant; BeakMuzzle.position is sufficient)

naive pawn
queen vale
#

transform.position != transform

naive pawn
#

(but yeah verify this code is actually being reached as fen said)

naive pawn
errant breach
queen vale
naive pawn
naive pawn
swift crag
queen vale
#

It's true but referring to setparent, it needs a transform not a position

swift crag
#

yes, and BeakMuzzle is a Transform, not a Vector3

naive pawn
#

you're arguing against a point nobody made

swift crag
errant breach
swift crag
#

show us the new code

naive pawn
#

also another thing could just be that you changed the code and triggered a recompile when it hadn't before

queen vale
errant breach
#

public Transform BeakMuzzle;

var projectile = Instantiate(attackGameObjectParticle, BeakMuzzle.transform.position, BeakMuzzle.transform.rotation);
projectile.transform_SetParent(BeakMuzzle.transform);

naive pawn
queen vale
#

B ) and I was right

naive pawn
swift crag
#

it has exactly the same meaning, yes

unborn basin
#

hello I'm trying to get started with unity I already know c# I've already done winform ect someone has good tutorials or can even teach me a little

naive pawn
queen vale
#

... yet i lacked context.. darn

radiant voidBOT
errant breach
#

That's so weird because now it does work..

swift crag
#

if BeakMuzzle was a GameObject, SetParent(BeakMuzzle) would be a compile error

unborn basin
swift crag
#

same guess here

#

you may not have saved your script

naive pawn
#

or it couldve been edited then tested in playmode by accident before

swift crag
#

unity can be set to not reload until you leave playmode, yeah

errant breach
#

Ah, maybe... That would be very unfortunate of my 😅

#

because i was in playmode

#

yes, i think unity just never took time to reload / i did not save. Sorry for your sanity guys 😅

naive pawn
#

iirc, unity kinda supports hot reloading in playmode but it's kinda wonky

#

i disabled that a long time ago

swift crag
#

it works if and only if all of your state is serializable

#

I don't try to use it

naive pawn
#

i guess that kinda makes sense

sage mirage
#

I did it at the beginning of the setup. I think it was AI that write it down by mistake XD

#

I don't have to use AI at all like even for any code help explanation or an example on how to fix something?

naive pawn
#

yes

sage mirage
#

I mean sometimes I stuck very hard on problems

#

I can't even think myself

naive pawn
#

imma be real i don't care

sage mirage
#

I have to get explanation from AI

naive pawn
polar acorn
sage mirage
#

jn order to actually get my brain to work

naive pawn
#

you aren't actually using your brain there 😂

#

learn to problem solve for yourself

#

you don't have enough problem solving skills to fix all the problems AI is giving you lmfao

polar acorn
#

It's a pointless tool because by the time you can actually make use of it without completely ruining your project you no longer need it.

frosty hound
#

People really out there thinking AI has always been the solution lol

sage mirage
#

Maybe you are rightI dont copy paste thats for sure I dont do it what I do is I see examples, explanations and also do all the research for the specific problem like tutorials, docs and other resources and then write the code.

naive pawn
#

ok, then keep doing that and leave the bs machine out of the equation

sage mirage
#

But I cant think how you seniors solve problems without the use of AI. Could you please help me understand? I know about divide and conquer or decomposition breaking problem into smaller parts but what if you stuck completely on a problem what are you doing to solve these problems? Maybe I need some more practice in algorithmic thinking like taking challenges on CodeWars or on any coding platform. I really want to improve problem solving skills.

sour fulcrum
#

research

sage mirage
#

Are you creating flowcharts

queen vale
#

slam your head into a wall till it works

sage mirage
#

class diagrams etc?

sour fulcrum
#

sometimes flowcharts are helpful yeah

polar acorn
#

Instead of reading hallucinated nonsense from the plagiarism machine, you can just... read the data it's stealing from

sour fulcrum
#

just ways to visualise thoughts

sage mirage
#

Its called System Design or Technical Design right?

naive pawn
# sage mirage Are you creating flowcharts

you know how once you get proficient with math, you can do additions and multiplications and stuff in your head without needing scratch paper?

that happens with problem solving too. you might see people just thinking for a bit and giving a solution, they can do that in their head because they've practiced a lot, enough to be able to do that. start with writing your thoughts out, see what gaps are there, research

naive pawn
#

just start doing

sage mirage
#

I have made flowcharts and technical design diagrams

naive pawn
#

those formalized systems help make it more efficient or effective, but they're not going to help much without just the base experience of problem solving

sage mirage
#

the problem is you know I dont do the right think when it comes to decomposition

#

I think I am not taking the right steps in breaking the problem into smaller parts

sour fulcrum
#

most first time solutions are "wrong think" tbh

#

oh you meant right thing lol

sage mirage
#

I am not doing it the professional way instead of typing immediately I think I have to write first the logic etc on a pseudocode and then actually apply after yeah writing all my thoguths

#

thoughts

naive pawn
#

go back and identify them, and see where you can improve

naive pawn
sage mirage
#

Maybe I need more math knowlege?

#

Because I wasn't good in maths

#

in school to tell you

naive pawn
#

you need more practice

sage mirage
#

XD

queen vale
#

You only know what all you can do the more that you understand the tools that you have. Once you know what is available you can combine different things to find a solution.

sour fulcrum
#

is what your doing involving math?

sage mirage
#

Game Math is something relevant in our industry

naive pawn
#

you don't need more knowledge

sage mirage
#

I assume I need Linear Algebra, Boolean Algebra, Calculus, Discrete Math

sour fulcrum
#

if what your doing doesn't involve math, then not knowing math is not your problem

#

i barely know any math lmao

naive pawn
sage mirage
#

Math actually help you think as a programmer

#

if you are good in maths then I think it will boost you up

naive pawn
#

if you know 0% of those, but you can break down the actual problem into needing those, you will have smaller pieces that are easier to research

sage mirage
#

in problem solving anything

naive pawn
#

just reading 50 wikipedia articles is not going to do anything

#

doing math problems is a form of practicing problem solving, just as doing phyics problems or what have you

sage mirage
#

One of my professors told me if you dont study maths in computer science you will be just good in programming not professionals.

naive pawn
#

and if you refuse to actually go do anything you won't be good at all

#

i've told you several times

#

you're in decision paralysis

#

go actually do stuff

#

discussing is not going to help

sour fulcrum
#

I hope your professors aren't as bad as you describe

sage mirage
#

I have some projects bro XD

#

I am working on projects wdym ?

naive pawn
#

you're currently debating how to learn problem solving

queen vale
#

rather than solving problems

sage mirage
#

How to practice Problem Solving and DSA the right way? That's the question.

#

Algorithmic thinking

sour fulcrum
#

by solving problems

sage mirage
#

Yes but what problems?

sour fulcrum
#

problems found in what your making

sage mirage
#

not random?

queen vale
#

What does your game need? What isn't working? why isn't it working?

sour fulcrum
#

work on a project and you'll find some

naive pawn
#

dude does not read

#

dude is treating this as a writeonly channel goddamn

sage mirage
#

I am not treating anything as a write only. I just want some guidance because I think I am confused. Are there any resources you could provide maybe?

sour fulcrum
#

you just gotta work on stuff

naive pawn
#

bro ive said so many things and you keep asking the same thing lmfao

queen vale
#

The tower of Hanoi

naive pawn
#

i would not recommend that tbh

queen vale
#

It's a problem. It needs solved

naive pawn
#

it's a very specific instance of "problem solving" with a specific solution

sage mirage
#

Its not even a coding issue

naive pawn
#

it's going to give practice for that one specific use

queen vale
#

It's an example moreso than practice. You've all already mentioned practice by doing

eternal needle
queen vale
#

so I figured, give an example.

naive pawn
#

i don't think there are reasonable examples to give here ngl 🤔

queen vale
#

🤷‍♂️

eternal needle
# sage mirage That will help me to improve problem solving XD

There are many websites that have problems on them, like leetcode or whatever else is popular these days. If you want to learn common algorithms/graph theory/math problems you'll find all you want there.
You will rarely ever actually use these algorithms

sage mirage
#

I mean some people are really genius in programming and problem solving I mean I think they have a talent by the nature. I dont believe a lot in talent but it exists, and its actually genetics given by nature.

naive pawn
#

ive gone through that. it's 40% interest and 60% practice.

sage mirage
#

anything right doesn't matter ?

naive pawn
#

at this stage, most likely not

polar acorn
naive pawn
#

you don't have enough experience for it to matter

#

you just need to start

sage mirage
#

I am not a beginner.

naive pawn
#

i'm... aware.

eternal needle
sage mirage
#

I have coding experience and with Unity as well the problem is that I want to improve more my problem solving skills and DSA basically how to use Data Structures properly with Algorithms and actually improve.

sour fulcrum
#

you improve by "using data structures with algorithms"

naive pawn
#

"problem solving skills" and "DSA" are not that closely related

queen vale
#

I've been a hobbyist for a decade and still think of myself as a beginner lol.
You learn to solve problems by encountering a problem, and researching the solution.

sage mirage
naive pawn
#

i think you need to focus way more on just the "problem solving skills" tbh

sage mirage
#

You don't build portfolio

eternal needle
#

Do you want to learn or not

naive pawn
#

is uni a waste of time

naive pawn
#

is pregnancy a waste of time (for the child)

queen vale
#

yes

eternal needle
sour fulcrum
#

give that fetus an ipad

naive pawn
# queen vale yes

maybe for you, since pregnancy is when the brain develops a lot

-# i intend that as a joke, just saw the opportunity...

naive pawn
# sage mirage You don't build portfolio

you keep tacking on random shit that's completely irrevelant to the actual topic at hand here, which is practicing problem solving.
the specific problem you solve isn't going to matter that much at the stage of just decomposing issues

#

solve math problems if you want, 3b1b has a ton. the focus will not be on specific topics, but the actual problem solving

#

problem solving is an experience skill. all those others you're worried about, dsa, math topics, are knowledge skills

queen vale
#

i lack in the knowledge dept. UnityChanDown

naive pawn
#

don't we all..

#

(hence the importance of research as an experience skill)

sage mirage
# naive pawn you keep tacking on random shit that's completely irrevelant to the actual topic...

Iam aware that I have to practice my problem solving skills, but my point is to practice them by building portfolio instead of just taking random problems on leetcode or whatever platform there is because at the end of the day you will have to land a job maybe on an indie game dev studio or even on AAA studios when the time comes of course with the use of Design Patterns and all the solid principles which are really helpful.

naive pawn
#

you are worrying about distant, barely-existant problems

#

it's like you're trying to make an art portfolio and worrying about Official Color Theory™ with perfectly curved lines and professional techniques despite barely drawing. that's what it sounds like to me

#

ah to hell with this. it's not like you're going to actually read any of this

sage mirage
#

I read everything bro all the time, I don't know what you mean

#

When you see I ask the same question or maybe don't reply on any of your messages doesn't mean I dont read them. I just have my own concerns and keep repeating. Anyway, thanks for the advice I'll see what I can do.

edgy tangle
#

@sage mirage I know others have reiterated on this point but if your current problem is you don’t have a set of problems to solve in order to practice problem-solving with code as a skill, then just try to make something small yourself. Problems will arise. You will need to either solve them or give up. If you choose the former it’s how you practice and learn. But endlessly debating and talking about it won’t get you there

woven thistle
#

When I double click a script in Unity it automatically opens to the purple Visual Code Studio. However, I only have the blue Visual Code Studio set up for Unity coding. How do I get it so it automatically opens to the blue Visual Code Studio?

naive pawn
queen vale
#

(preferences > external tools)

woven thistle
#

Thanks

queen vale
fallen forge
#

Hey everyone, I am currently trying to set up a basic enemy AI that has two modes:

Wander (goes around the map randomly trying to find the player)
Chase (chases the player while they are in sight, if losing sight it does smart checking to figure out player location).

Does anyone have any good resources I can start with or advice where to learn mroe?

grand snow
fallen forge
#

Thank you for the recommendation by the way

grand snow
#

AI is vague and means many things

#

Unity offers the nav mesh system which can be used to route to some goal with ease

solar hill
#

A* (THE ASSET) is really good but the free version is kinda pointless imo

#

so stick with what unity gives you for now

grand snow
#

lets not suggest that to start

#

That is more applicable for non beginners

solar hill
#

what?

#

im telling them to use unity's default navmesh

grand snow
#

(also A* is an algorithm anyone can re implement for free)

fallen forge
solar hill
grand snow
grand snow
fallen forge
spring root
# fallen forge Yes, the coding is not the issue, I am just looking for Unity methods. I will lo...

https://youtu.be/l8ADGZTwhmk?si=Y4NTMzjkZT893YGi
fairly comprehensive tutorial using navmesh

Hello fantastic people!

In this video I show how to create a simple but effective enemy AI for a 3D game in Unity.
Even though this tutorial is horror-themed, the same techniques work perfectly for many other types of games.

We build an enemy that:

  • patrols between points
  • detects and follows the player
  • attacks when in range
  • returns to ...
▶ Play video
timber tide
#

a* project has 2D pathfinding tho unlike unity's

#

pretty sure that's included in the FREE version

grand snow
#

there are packages that make navmesh work in 2d too but yea its a dumb limitation

timber tide
#

also includes more baking options besides a poly-navmesh such as a grid mesh

#

which is better for games like tower defenses since easier to add restrictions to the indicies that occupy square units

grand snow
#

Thats cool but ive always done A* myself for node based systems

queen vale
#

I'd say something.. but idk the A* algorithm, aside from it finding the shortest path

timber tide
#

Yeah nodes are fine, and you can get a lot of precision at the cost of more mem, but still a little screwy when you do want to create precise zones to prevent walking.

grand snow
#

Oh yea they only work well in some situations

woven thistle
#

how do you make it so that the camera follows the character as he moves around on the map?

queen vale
#

multiple ways, most tutorials use cinemachine (for 3D)

#

Depends on 2D / 3D but brackeys got some tutorials on it.

queen vale
orchid wolf
#

Grid Layout Group supposed to make them all same size

#

but for some reason it does something to sprite

#

That's what concerns me

#

Oh wait, I found the problem, for some reason it changes "InventorySlot" scale to 1.666

#

I guess, that's because my "Stack" is outside it's parent's bounds and when I create a new copy of this prefab, Unity tries to fit in all item by scaling up parent. But my number is anchored to the right corner so that does not help

#

testing it rn

orchid wolf
#

Then, I have no idea

#

It's easy to fix, and I already did that, but just wonder what's nature of it.

queen vale
#

The prefab is the inventorySlot, and the slot is what's being scaled by the grid (iirc)

orchid wolf
queen vale
#

grid doesn't no, but it shouldn't care about the slots children, just the scale of the inventorySlot itself

orchid wolf
#

yeah

#

Anyway, I don't really wanna figure out what's the problem rn, gotta get some rest

#

ty anyway

queen vale
#

Sorry : / , sleep well

errant breach
#

Hello guys

#

Im sorry if its not the right channel but it's kind of an emergency

#

I was testing my game and all of the sudden, it broke. It can happen but here, it's like if everything rollbacked to like 8 hours ago

#

i lost a lot of progression, some bugs that i fixed came back, some part of my model that i deleted / added got reverted to this morning...
It's like if i opened an auto save... Without really wanting it.

#

I just pressed "F9" while playtesting my game to record, and went into override > apply all before starting the game because i never did it with my playerCharacter

#

everything just... Vanished...

Like if i restored the player's prefab from 8 hours ago

#

Script got removed, everything is glitchy, the error "Unnassigned reference" is spammed...

polar acorn
#

Was the prefab the only thing that was changed? Because it seems either you overwrote something or just never saved it in the first place. Unity doesn't do auto-saves.

errant breach
#

I think that i've made a lot of changes to the player without applying them to the prefab and when i finally did.. It, like... Broke everything

slow blaze
#

Hey
I'm trying to implement a simple dialogue screen with a png as the char,
Currently I'm just using a canvas and an array of objects that has 1: the png, 2: the text
is there a more suitable way to do this?

rich adder
#

depends how complex you want to get...
also there are more out-the-box solutions that might do already everything to add manually. One good one is Ink(free), or yarnspinner (paid)

errant breach
#

It reverted their particles and sound to null like hours ago

#

words cannot describe my confusion

#

And now, m afraid it will happen again

slender nymph
#

did you perhaps check out a previous commit in the version control you are surely using?
or are you perhaps storing your project in some cloud sync path like one drive?

errant breach
#

Well, i actually used to use VersionControl, but i no longer do it since yesterday, i deleted it..
And i dont, i installed an autosaver now but im so sad

slow blaze
slender nymph
#

i no longer do
congrats, you've just learned a valuable lesson on why you should always use version control

errant breach
slender nymph
#

that's not related to using version control . . .

errant breach
#

I think it is, a saw it on forum and when i removed version control it finally removed this bug !

sour fulcrum
#

everyone should be using version control

polar acorn
#

And not necessarily UVCS

slender nymph
#

always use version control. whether it's git or unity version control, or some other actual version control software, you should always use version control
or else you end up with situations similar to this where something has broken irreversably in your project and you cannot revert back

polar acorn
#

But some sort of version control

swift crag
#

if nothing else, just use a local Git repository to checkpoint your work

errant breach
#

I trust you guys on the importance of using version control.. The only reason i removed it was because it almost added 8 minutes of booting everytime i started a playtest...
I added this plugin : https://assetstore.unity.com/packages/package/43605
If you guys have any suggestion of great plugins / version control i can use without this glitch, i would gladly take it :')...

#

This is my Unity version, btw..

sour fulcrum
#

github desktop

swift crag
polar acorn
#

Personally I would just remember to save, rather than getting an asset for it.

#

I save so often I'll Ctrl+S periodically on discord

swift crag
#

note that remembering to save and using version control are two completely unrelated things

#

pressing ctrl+S regularly doesn't stop you from deleting something important

errant breach
#

But i mean... Ill try to add UVC back then !

#

I just uuh i-

#

oh alr

solar hill
#

As a suggestion, a lot of people prefer it over uvc

#

And issues like this dont really happen

errant breach
#

Alright, i will configure git with a tutorial then, thank you very much !

errant breach
#

It sometime take 8 minutes just to compile when there's UVC, definitly a weird glitch. But i did put Git

#

I think i understood what happened

#

i put "ctrl" in my game to run and i think i did things like "ctrl + s" or "ctrl + z" while in game and it broke something

#

I just got the exact same error after playtesting : got hit by a rollbacl

muted sand
#

How would I implement currency into my game? Would I just have one big script to handle it all? And how do I know what is on the client or the server?

rich adder
#

implement currency
this is vague as hell

teal viper
muted sand
#

I haven't implemented multiplayer at all but I'm assuming you store each player's stats in a table

teal viper
pliant bridge
#

I wonder about multi level world generation, is it based on how many tilemap layers(with different Z level & sorting order) you have?
I made multi layer noise with perlin noise, heightmap texture, perlin worm, spline shaping, using mesh world generator method (similar minecraft).

But the world generation seems cooked, no multi level like 2nd, 3nd picture

muted sand
teal viper
rich adder
#

perhaps it's to early to do multiplayer..?
💯

teal viper
polar acorn
teal viper
#

The obvious answer is "you learn it, plan your game with multiplayer in mind, select the right framework, integrate it based on what you learned, docs and tutorials".

muted sand
teal viper
# muted sand What's a framework to start off with?

Probably the solution that unity provides - net code.

But again, I think this is too early for you.
Even this question kinda reveals it. You need to start looking up/researching stuff on your own. You could easily Google for what frameworks there are, read about their pros and cons, but you didn't do it and just chose the lazy way. That means you're not ready for networking as a developer yet.

muted sand
teal viper
muted sand
ivory bobcat
#

Most of this can be Googled as suggested.

teal viper
#

Neither are we a replacement for Google.

teal viper
muted sand
teal viper
#

And I answered it, didn't I? They run on the machine that runs the executable.

#

There's no separation between a client and server by default, unless you explicitly implement it.

muted sand
teal viper
#

Indeed.

#

But you don't. Because there's no simple "turn multiplayer on" button.

muted sand
teal viper
#

There's no script for that by default outside of what the dedicated frameworks provide.

muted sand
#

Ok

woven thistle
#

for some reason when I add an image to a sprite renderer only part of the image appears, what causes this. also the image is not fully connected, although all the components save as one. Could this cause it for only one individual component to appear on screen?

marble hemlock
#

collider.bounds.center
is there like a way i could have another version that goes for the top of the collider?

#

my options really only seem to be like max, min, center, and thats about it

eternal needle
pliant bridge
#

Do you guys have any ideas that use mesh generator, perlin noise, perlin worm, and heightmap texture to make world generator in isometric 2.5d ?

#

i was only use perlin noise to make world generation but it was... flat

#

yesterday i knew about mesh generator and about minecraft world generator was using it with multi noise layer

#

to make world generator

#

so i try to make it

#

but now it only generate mesh terrain instead of tiles

teal viper
pliant bridge
#

god...

#

i am so cooked

pliant bridge
#

i wish i have a ram in my head so i can store those shit maths to develop a game

marble hemlock
elfin pike
#
void GatherInput()
    {
        _frameInput = new FrameInput
        {
            JumpDown = _jumpInput.WasPressedThisFrame(),
            JumpHeld = _jumpInput.IsPressed(),
            Move = _moveInput.ReadValue<float>() * Vector2.right
        };

        if (_stats.SnapInput)
        {
            _frameInput.Move.x = Mathf.Abs(_frameInput.Move.x) < _stats.HorizontalDeadZoneThreshold ? 0 : Mathf.Sign(_frameInput.Move.x);
            _frameInput.Move.y = Mathf.Abs(_frameInput.Move.y) < _stats.VerticalDeadZoneThreshold ? 0 : Mathf.Sign(_frameInput.Move.y);
        }

        if (_frameInput.JumpDown)
        {
            _jumpToConsume = true;
            _timeJumpWasPressed = _time;
        }
    }

NullReferenceException on _frameInput

orchid wolf
#

Is it possible to display something like that in inspector?

undone rampart
orchid wolf
#

ok, let me just ask straight, how?

#

Tested, that worked

#

thanks

sage mirage
#

You better use System.Serializable to be sure that you are using the namespace.

naive pawn
sage mirage
#

Hey, guys! What is the best way to actually assign game objects and componets etc at runtime? Is there a Design Pattern that is really useful in this case? Let's say we have two scenes title and main and you have to do dont destroy on load and then at runtime assign game objects or components? Personnaly, what I do is to create bridges between the Manager class that lives on the first scene loaded and bridge this class with a class that lives on my other scene and attaching the components or game objects at runtime like this
For example

#

I was wondering if there is more efficient and probably reliable way to handle assignments at runtime when persistence is needed thats the question. Thanks!

undone rampart
#

what do you need persistence for?

sage mirage
undone rampart
#

thats actually exactly what I do

sage mirage
#

That's not efficient at all personnaly thats horrible

#

No you dont have to

#

Having two game maangers, two ui managers

#

two audio managers

distant orchid
#

Hey guys any YouTuber who makes good tutorials for beginners? For c#

sage mirage
#

thats duplication it break single responsibility principle

undone rampart
#

I have a prefab called game manager and on that I put the main game manager and other submanagers, that prefab is present in every main gameplay scene. And to avoid repetition I use scene templates.

timber tide
#

Why would you need a secondary audio manager

sage mirage
#

You create an Audio Manager, Game Manager and UI Manager and you are persisting them across scenes thats the efficient way I think

timber tide
#

just make a script that works for all cases. Shouldnt be too many

undone rampart
#

You just have one per scene

#

During that scene lifetime

sage mirage
timber tide
#

DDOL

sage mirage
#

DDOl?

#

Yes thats what I am saying

sage mirage
#

The other guy says he is going to create more than one of the same managers

#

Managers should be 1 and only one in the game

undone rampart
#

You missunderstood me

#

I said I duplicate them in every scene, like copy from one scene, paste in another

#

not that I have multiple in a single scene

#

well, I don't actually have to manually duplicate anything since I use templates and prefabs

timber tide
#

I assume the problem is switching scene and some variables become unassigned, destroyed with previous scene, and now you're assigning newer values that are scene dependent

#

which in that case you choose not to use DDOL, and just recreate that manager in each scene, but the static accessor stays the same, or just search the scene for the require components (or via another manager), or have those scene dependent options assign themselves to the manager via static call.

#

like you can recreate the singleton in each scene which is fine. This allows you to go on the editor and do direct assignment

#

audiomanager though may not be ideal as you do usually want some cross-fade music, and similar type of managers that do fade between

sage mirage
#

Managers must be its a "MUST" only 1 of the same type in the game.

naive pawn
#

singletons can destroy duplicates

#

that's the entire point of that Destroy in the singleton pattern

sage mirage
#

Thats what I am telling him DDOL

#

is the solution in this case

naive pawn
#

you don't really need that tbh

#

it is a solution

sage mirage
#

you mean DDDOL?

naive pawn
#

it's not the only solution

sage mirage
#

yes but my question was and how this conversation started

undone rampart
sage mirage
#

@undone rampart said I copy managers across scenes

sour fulcrum
sage mirage
#

Bro that's super inefficient and doesn't cover my question

#

There is a thing OnSceneLoaded

#

So whenever you change a scene you can also assigne references at runtime

#

I did it with scripts called bridges

naive pawn
#

why does the UI manager have specific types for every scene

#

seems unnecessary

undone rampart
#

My final point was if you don't use DDOL, then the managers get destroyed and initialized within the scene's lifetime, that way you don't have to worry about cross scene initialization and references breaking

undone rampart
sage mirage
naive pawn
#

yes

sage mirage
#

I mean I was thinking of another more efficient way

#

there is OnSceneLoaded

naive pawn
#

it's structured like you're trying to use this as an abstraction, but you still have that tight coupling there

sage mirage
#

but i was wondering maygbe there is a design pattern that is really useful

#

or anything

#

a structural design pattern

#

I think

naive pawn
#

stop worrying about design patterns tbh

#

they'll pop up if they're useful

#

not everything needs a fancy name

sage mirage
#

That's just a way to communicate with programmers

#

Design Patterns are common solutions to many software design problems and thats why I am asking if there is anything to this one I am dealing with which in fact is a structural issue.

undone rampart
strong wren
sage mirage
#

Player Manager is actually player controller or something?

#

its not a manager

undone rampart
#

Why are you taking everything I say backwards 😂

#

The arrows represent a direct reference

#

The GameManager is the root

swift crag
#

it's perfectly fine for some systems to be repsonsible for others

undone rampart
#

Each node is responsible for its own logic

sage mirage
#

Audio Manager handles audio everything related to it, UI Manager handles the whole UI, Settings Manager handles settings of the game, Game Manager handles states like game over, ennd state. I mean the duplication thing you said with managers bro thats horrible and my quesdtion was about efficient ways to handle assignments at runtime and that wasn't really helpful, but anyway it is what it is.

undone rampart
#

Bro...I just said I am not duplicating anything in the scene

fickle plume
#

You don't want any rigid game design diagrams or patters in game dev. Each project requirements can be drastically different. You should only go by general philosophy to break down complicated pieces and responsibilities.
It's mostly trying things and refactoring, actual structure can drastically change depending on changing features etc.

sage mirage
timber tide
#

efficient ways to handle assignment is just do it on the editor if you can

swift crag
#

all of the design patterns in the world won't do much if you do not actually make a game

#

to quote Joel On Software from back in 2001...

When you go too far up, abstraction-wise, you run out of oxygen. Sometimes smart thinkers just don’t know when to stop, and they create these absurd, all-encompassing, high-level pictures of the universe that are all good and fine, but don’t actually mean anything at all.

fickle plume
#

And it's much more important to know with what purpose certain design pattern was created to solve what problem, than to know how to rigidly implement it. Because you often need some elements of it and not others.

swift crag
#

in my own game, I have a structure like this:

  • GameController is the god-object. It is a singleton. It bootstraps itself on game start and is responsible for switching modes (e.g. from the main menu into a gameplay scene).
  • Each scene contains a bunch of *Manager components. These are singletons as well, as you can only be in one gameplay scene at a time. They are thrown out when you switch scenes, since none of their state is allowed to survive from scene to scene.
timber tide
swift crag
#

You should implement code that does what your game needs.

#

I didn't create VisionManager because of some kind of design philosophy or grand plan. I made it because I needed a way to gather a bunch of visibility checks together so I could run a single giant RaycastCommand and return the results on the next frame.

#

er, well, that's not quite right; that's VisionSystem 😉

timber tide
#

I like doing GameManager entry point assignment where on sceneload the GameManager fetches all static scene accessors and does assignment.

sage mirage
#

I don't know how some people don't have an idea of Design patterns they actually write implementation of a pattern but they dont even know what is this implementation XD

undone rampart
sage mirage
#

I have a friend that is a programmer I told him about Design Patterns and he said what are these stuff that are you talking about

undone rampart
swift crag
#

i don't think about "design patterns" consciously, but I certainly design my software

#

I don't think "time to use the observer pattern!"

timber tide
#

I think in terms of what will not cause race conditions

#

and most proof concept is just have a manager entry point

verbal dome
sage mirage
#

There are in total 23 Design Patterns all of them categorized in 3 types Creational, Structural and Behavioral of course with their pros and cons as well and they are used in different scenarios. PErsoannaly, I do think about design patterns I want to implement because I dont know a lot for now only State, Observer, Singleton and object pooling

undone rampart
#

I think we need a special "architecture & design patterns" thread

sage mirage
#

That would be cool if there was a channel specifically for game architecture and design patterns and these stuff.

undone rampart
timber tide
#

24/7 chat of debating what dependency injection really means

swift crag
#

there are absolutely not a specific number of "design patterns"

swift crag
elfin pike
#
void GatherInput()
    {
        _frameInput = new FrameInput
        {
            JumpDown = _jumpInput.WasPressedThisFrame(),
            JumpHeld = _jumpInput.IsPressed(),
            Move = _moveInput.ReadValue<float>() * Vector2.right
        };

        if (_stats.SnapInput)
        {
            _frameInput.Move.x = Mathf.Abs(_frameInput.Move.x) < _stats.HorizontalDeadZoneThreshold ? 0 : Mathf.Sign(_frameInput.Move.x);
            _frameInput.Move.y = Mathf.Abs(_frameInput.Move.y) < _stats.VerticalDeadZoneThreshold ? 0 : Mathf.Sign(_frameInput.Move.y);
        }

        if (_frameInput.JumpDown)
        {
            _jumpToConsume = true;
            _timeJumpWasPressed = _time;
        }
    }

Anybody can explain, why recieving NullReferenceException on _frameInput, if it's created there

night raptor
elfin pike
#

New frameInput. 3.line

polar acorn
radiant voidBOT
undone rampart
#

so either jumpInput or moveInput is null

swift crag
#

but yep, that's spot on

#

importantly, this kind of thing would not cause an error

#
var foo = new Bar() {
  thingy = thisIsNull
};
#

(assuming thingy is a simple field, of course)

#

the mere presence of null is fine; trying to access a member of null is what causes problems

elfin pike
#

1 frame before my character spawn something in object is null?

swift crag
#

Share the entire script and then show us the error message, so that we can be sure what's going on

polar acorn
small gyro
#

Quick question is this the "proper" order of things:

// 1. Enums / Nested types
// 2. Constants / Static fields
// 3. Serialized fields ([SerializeField])
// 4. Private fields
// 5. Properties
// 6. Events / Delegates
// 7. Unity lifecycle (Awake → OnEnable → Start → Update → FixedUpdate → LateUpdate → OnDisable → OnDestroy)
// 8. Public methods
// 9. Event callbacks (OnCollision, OnTrigger, UI handlers, etc.)
// 10. Private / Helper methods```
polar acorn
#

Order for what

naive pawn
#

no, because there is no "proper" order

#

as with all things related to code style, if you're consistent with it then it's fine

small gyro
#

Oh awesome. Thanks!

#

I noticed that when I am more consistent with how I order stuff, it makes it easier to learn and debug.

#

So, if there was a recommended one or something I'd just follow that. But seems like I am fine with what I have 🙂

naive pawn
#

there are several recommended* ones as set by like, companies for internal consistency, and you could use those

-# * recommended as in, within the company. outside it's just a set that definitely works that you could use so you don't have to figure it out yourself

timber tide
#

lot of languages usually want some type of method declaration at the top however

#

c# dont care tho

swift crag
#

I do sometimes interleave fields and methods, but only really for "debug" stuff

#

so that it stays out of the way of the normal fields

naive pawn
#

wait no, c/c++ also don't care in a class

swift crag
#

this only matters in languages that require you to declare a symbol before you use it

#

e.g. HLSL or C

timber tide
#

well, header files help prevent the compiler complain about those issues

naive pawn
#

hmm i kinda have conflicting thoughts on this comparison

timber tide
#

but yeah, 'most' languages could be reduced to mostly lower level languages today

naive pawn
#

this is within a class, and afaik, no language has this kind of requirement for classes? only some for free functions in eg c, c++, python
and the free functions one i feel is a different situation

#

i guess c# does indeed also not care for local functions, but i feel like that's not relevant to the specific topic at hand

edgy tangle
# small gyro Quick question is this the "proper" order of things: ```// === Class Organizatio...

The general pattern I see and use most often is loosely:

  1. private/protected fields (serialized or not)
  2. public fields (if any) and properties
  3. Events/delegates
  4. Common Unity lifecycle/event methods/ “callbacks” (Awake, Start, OnEnable, OnDisable, Update, OnTriggerEnter, etc.)
  5. Class-specific methods, loosely in descending order by how common or core they are to the script.
  6. Less-common/core methods and helper/utility methods.

But this isn’t some “correct” order. Just what has seemed to work for me and most of the people I work with.

But most important is just to try to follow some general format across your scripts so you don’t need to recalibrate your thinking every time you look at a different script.

#

I forgot to put const/statics in the list there, but usually those will go near the top as well. Don’t have any hard rule there though.

naive pawn
#

eh while we're sharing, i had this mess for one of my projects lmao

polar acorn
#

My code order:

Wherever it goes, it goes
#

(You shouldn't be writing code so long you need a style like this, IMO)

naive pawn
#

you do have a style, maybe you just haven't written it down :P

swift crag
#

if you start having to think really hard about order, something has gone wrong!

#

not that I'd ever write a monstrous 1000 line long class

#

no sir-ee

naive pawn
#

oh i didn't have to think of it for myself, but i realized it was kinda convoluted so i formalized it for someone else who was offering help

edgy tangle
#

Still having some sort of consistency is helpful even for short scripts. It’s really irritating to find a critical field randomly among method definitions even in a script that’s <100 lines.

#

Like Fen mentioned earlier it’s fine if that field is just used for debugging or something so you don’t really want to pollute the “header” area of the script with it, but if it’s a field that’s critical to the class it’s annoying to find that whoever made it just placed its declaration in some random line in the body of everything else.

swift crag
#

I do try to put all the fields at the top

#

roughly grouped by meaning

#

(since that order affects what you see in the inspector!)

sour fulcrum
#

thats a new one

polar acorn
#

<@&502884371011731486>

#

!collab this is not a job recruitment forum

radiant voidBOT
opaque shell
#

Is this the chat were I ask for help and therapy? I'm losing my mind with a bug

slender nymph
#

!ask

radiant voidBOT
# slender nymph !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

opaque shell
#

Idk why but when I reload the scene its not initialized properly. I tried debugging for persistent objects but nothing came up

slender nymph
#

save the scene before entering play mode. when you load it via code again it loads whatever was actually saved to disk

earnest raven
#

I'm guessing I can ask this here. (I hope)
I have a Stack Camera, but I haven't prepared for it in-code. I have a Dynamic FOV thing and the stack camera doesn't inherit the FOV of the Main Camera -- Can I make it so the stack camera inherits the FOV automatically or do I need extra code?

slender nymph
#

what about that is not clear? your scene is not saved, you need to save it

opaque shell
#

I do save it, like hitting file and save I do that

slender nymph
#

it was clearly not saved in the video you showed

naive pawn
#

having an asterisk or a dot beside a filename is an indicator that it's unsaved

#

make sure that asterisk disappears when you try to save

#

if it doesn't disappear, you didn't save

opaque shell
#

oh I see, sorry. The issue still persist tho

slender nymph
#

you should describe exactly what the issue is, because if you've saved then it is loading the scene as it was set up. so if something is going wrong then something else is the issue

fresh wadi
#

Hello guys, I need help. How do I define the position of an object and instantly update it via a script, so, for example, location = 0 is pic 1 and location = 1 is pic 2?

slender nymph
#

hint: take a look at the Transform class
but also consider going through some basic courses, this is like one of the very first things you learn how to do

#

!learn

radiant voidBOT
dry tundra
#

hello any one help me with this i just started unity some days ago and im getting this error after i try to make my buttons
also this happened after i added

public

Like this
public void singleplayer()
{
SceneManager.LoadScene("Game");
}

also my ui is messed up after that

opaque shell
fresh wadi
#

im guessing player is the name of the object

opaque shell
#

the tag

opaque shell
sour fulcrum
#

player in that code snippet is the name of the variable

wintry quarry
swift crag
#

yeah -- if you see "UnityEditor" in the error, it's probably not your code

#

and most of these UI bugs are fixed by either:

  • restarting the editor
  • resetting your layout to one of the presets (there's a dropdown in the top right)
#

the latter will help if there's a window that has somehow wound up with invalid data stored in it

dry tundra
#

Thanks you
I fixed the problem by updating the unity version Control in the package manger

vapid egret
#

hello everyone. I've got a little problem. I have this app imp building in unity where I generate some trinkets and they're supposed to fall on a littl platform. works perfectly fine locally, but they fall through that floor on a web build on Play. is there a common issue I need to be aware of when deploying to Play?

wintry quarry
vapid egret
orchid wolf
wintry quarry
queen adder
#

Hi guys.

pliant bridge
#

Im currently remaking my isometric world generation so i have a question, so when i make multi level terrain, i set base tilemap layer height is 10 (in the image) , and make a world generation, it will generate a flat world

#

but when i use perlin-noise to make world generation , it will generate to this image
so the question:

#

Do i need to make a function that auto generate multiple tilemap layers to make it like 3d terrain? or just use 1 tilemap , and then change the height of the tiles

#

this stuck in my head for days

frosty hound
#

Changing the height of the tiles seems like the obvious solution to me. 100 layers = 100 tilemaps is crazy, not to mention having to then communicate between them if you're moving along the surface of the terrain.

swift crag
#

The only headache I can foresee is that it'll be hard to actually figure out which tile you're clicking on

#

You can't just map a screen position to a grid cell anymore

#

since the cell you hit depends on the height of the tile

#

this also means that you can't change elevation by more than 1 unit at a time

pliant bridge
#

"100 layers = 100 tilemaps" , yea i was thinking about this , that why i have to remake my world generation.
i was thinking about change the height of the tile solution too, but thinking about the logic is easy but do it in 3d isometric is

#

kinda tough 🙁

#

thank you two for giving some solutions

bitter pine
#

is there a way to make an animator have an event from a script that isnt on the same as the animator component?

bitter pine
frosty hound
#

No, animation events have to call a function on the object that animation is playing. Having a small component that just fields the event functions is fine?

bitter pine
#

mk, if i have to then ig i have too

swift crag
bitter pine
# swift crag Why do you think you need to do this?

im using an OLD version of unity 5.6.6f2, because im using unityfor3ds to well, make games for the 3ds. and the 3ds is very limited with memory. so im trying to limit the amount of scripts i use a scene

naive pawn
#

seems like the memory of the animator itself would overshadow anything like that

bitter pine
naive pawn
#

do some profiling, see where the memory loads actually are, rather than going after small details

#

an animation component would probably use less memory given that it doesn't have to keep track of layers/states/transitions/parameters 🤔

#

though also the assets themselves would likely be significant memory

sour fulcrum
#

<@&502884371011731486>

naive pawn
#

not a place for AI-generated advertisement spam

bitter pine
queen adder
naive pawn
#

it's not suitable for this place.

bitter pine
frosty hound
#

Please keep this advertising off the server. This channel is for coding help.

queen adder
#

Bye!

vapid egret
#

Here comes a new question! I'd like to send a family friend a little project on Unity Play. It currently works just fine on desktop browsers, but I have to switch to desktop mode on the phone because Unity play says the game is not supported on mobile. Are there build settings that I can change to get it to work in chrome/safari mobile?

wintry quarry
#

Also make sujre you're building from a new enough version of Unity

lethal grove
#

question, I tried 2 layers on an animator but they aren't let's say "fusing", both layers each have their own mask, one is upper body and lower body. The animations on each layer only handle the parts of the body they should be managing.

I tried watching tutorials but they always use imported animations, I'm using .anims in my case so I can't convert my anim into a humanoid as they do in the tutorials

#

I'm kinda lost

slender nymph
lethal grove
#

right

#

thank you

elfin pike
#

How long I have to keep license for code. Very soon at least 50% of code will be changed

slender nymph
#

i imagine they are referring to a license that came with code they acquired elsewhere. in which case, that entirely depends on the license

slender nymph
#

read the license to find out. and don't seek legal advice on discord because you will still be liable for any advice you take

glass summit
#

I'm making a Parkour game in Unity, and I want to make a simple Jump feature where the character jumps when the player presses the spacebar. The Jump button won't work normally, because when I click the spacebar, the ParkourController is looking for an obstacle in front of the player so I wanna make it so that the Player should jump when click the spacebar, but if they are facing an obstacle, they perform a Parkour Action like usual


[Header("Jump Settings")]
[SerializeField] float jumpHeight = 2f;
[SerializeField] float gravityMultiplier = 2f;

bool jumpRequested;


if (!hasControl)
    return;

// Jump input
if (Input.GetButtonDown("Jump"))
{
    jumpRequested = true;
}
if (isGrounded)
{
    ySpeed = -0.5f;

    if (jumpRequested)
    {
        ySpeed = Mathf.Sqrt(jumpHeight * -2f * Physics.gravity.y);
        jumpRequested = false;
    }
}
else
{
    ySpeed += Physics.gravity.y * gravityMultiplier * Time.deltaTime;
}


public void CancelJump()
{
    jumpRequested = false;
    ySpeed = 0f;
}```


``` ParkourController.cs

private void Update()
{
    if (Input.GetButtonDown("Jump") && !inAction)
    {
        var hitData = environmentScanner.ObstacleCheck();
        if (hitData.forwardHitFound)
        {
            foreach (var action in parkourActions)
            {
                if (action.CheckIfPossible(hitData, transform))
                {
                    playerController.CancelJump(); // stop jump

                    StartCoroutine(DoParkourAction(action));
                    return;
                }
            }
        }
    }
}```
meager gust
#

if parkour action is found... then cancel jump

#

where problem?

#

you might want to invoke ParkourController from inside your PlayerController.cs. Or at least the part that checks for the jump input

#

the way you have it right now: if the parkour controller is running first before playercontroller, its going to cancel a non existent jump

#

and then the jump gets created when the playercontroller runs after it

#

I dont have enough info but thats where I would start

median hatch
#

check if there's any layer mask in front, if not then just jump normally

orchid wolf
#

Hello, am I doing something wrong or it's justi mpossible to serialize generic type?

naive pawn
naive pawn
#

the serialization rules manual doesn't mention anything about generics, so i don't think there's anything special there

naive pawn
orchid wolf
#

so I could easily change that

naive pawn
#

fields are

orchid wolf
#

original isn't prop...?

naive pawn
#

if you want an autoprop there, serialize the backing field, [field: SerializeField]

orchid wolf
#

or wait

#

Imy dumb ass

naive pawn
orchid wolf
#

ye

#

I didn't notice that

#

thanks

#

gotta check that I guess

#

but I already to implement different solution lol

cosmic dagger
#

you need to serialize the property with [field: SerializeField] . . .

chilly barn
#

im trying to have a minimap in the upper corner that will follow the ship, since most of this is text panels except the map you click to move your ship, but right now the minimap isn't loading but the ship is confined to the box, but the camera doesn't follow it so it just drags across the screen

naive pawn
#

wouldn't the minimap be UI, unrelated to the actual ship

orchid wolf
naive pawn
# chilly barn wdym?

i mean what i said. i don't know anything about the context you're working in, other than what you gave, which is.. not much

naive pawn
#

if you want it to serialize just that 1 field, you would probably need something like a custom inspector/drawer/serializer.. not sure how those would work though

orchid wolf
chilly barn
# naive pawn i mean what i said. i don't know anything about the context you're working in, o...

So pretty much the goal is to have a map on the upper right that acts as your way to control your ship, so you press somewhere on it and your ship turns and moves there and the map follows. The rest of the screen has text panels and stuff. Right now the ship just moves around in its little confined square but there’s no map and the camera doesn’t follow it. I guess the final goal is for it to look like the ship isn’t moving because the camera follows it yk?

#

Does that make sense

orchid wolf
#

I mean, it's kinda fine

naive pawn
#

unity introspects the structure, not the interfaces

orchid wolf
#

mk

naive pawn
#

or do you intend for that "minimap" to be a window into the gameworld

chilly barn
#

If you click anywhere on it the ship moves there

chilly barn
#

The actual movement and world map and everything is in that upper right window

#

The rest of the screen is UIs for text and information and terminals and stuff

naive pawn
#

how are you actually representing your world

#

it's starting to sound like it's not actually a minimap, but the only spot where it's not UI

chilly barn
#

I’m just not sure how to apply it

#

The whole screen is UIs and then the upper right is the actual “gameplay” for the most part

#

So I guess minimap is the wrong word

#

It’s just the map

#

But small and in the corner

naive pawn
#

i'm not sure what the ideal fix for this would be, but i have a few ideas

  • static camera, ship doesn't move, world moves around the ship
  • moving camera, moves along with ship
  • static main camera, ship moves in some other place, there's another camera that follows it and that's used in the main ui
orchid wolf
#

not sure if I need to override GetPropertyHeight, but I don't think it's crucial

chilly barn
#

How would I set that up tho where I can click for the ship to move still?

naive pawn
#

the camera would follow the ship

chilly barn
#

I see..

pliant bridge
#

i also successfully created the river ye, but the position of the tiles are shit

lapis sierra
#

hey, can anyone recommend a good tutorial for state machines for 3d character movement? Just asking because idk how to implement state machines with 3D movement and the tutorials that i've seen are so confusing...

spice burrow
#

anyone got a suggestion for how i could make a part rotate when i scroll the mouse up and down (snapping between a few different angles)?

sleek prairie
#

guys i need help i cant attach my script and i have no idea what's the problem here

lapis sierra
naive pawn
#

!ide

radiant voidBOT
naive pawn
sleek prairie
sleek prairie
naive pawn
#

you just need to configure it

#

it seems like you were midway through configuring it but it's not done

sleek prairie
#

aight lemme try

naive pawn
#

if you've configured it fully, the using UnityEngine; should not be grayed out, and you should see some errors highlighted.

sleek prairie
#

aight, also is this correct?

naive pawn
#

looks about right

#

have you installed .net using that .net install tool?

sleek prairie
#

i just installed this, idk if this is the one you were talking about

naive pawn
#

it is not

#

i specifically said "using that .net install tool"

#

the one you installed in vscode

#

with this one you have to restart your pc or something. i don't remember, i haven't used this

#

if you install it with the extension, you just have to restart vscode

sleek prairie
#

oh i have

#

i havent restart my pc yet thou

#

lemme restart then

naive pawn
sleek prairie
#

oh you were right i havent

#

do i have to checkmark all of this?

naive pawn
#

those are settings

#

you do not have to change any of those

#

open the command palette (ctrl+shift+p) and search for install .net or something along those lines

sleek prairie
#

i got these

spice burrow
#

is it possible to change gravity scale in the script??

#

nvm figured it out

night raptor
naive pawn
sleek prairie
#

it's okay mate i already solved it, thank you for the time thou

torpid kettle
#

does anyone know of a way to benchmark all thread groups of a compute shader? waiting for readback gives unusable results as it's impossible to tell how much time was spent on the compute shader, and how much was spent in reading the data from the buffer. any hint would be really appreciated, it's difficult to decide what optimizations to make without knowing for sure how code performs

spice burrow
#

https://paste.myst.rs/74ubmr3c

Anyone know how I could clamp the speed or like, set it to the max speed automatically after it reaches it?
This is for a simple missile.

torpid kettle
#

@spice burrow you can use the Lerp function, so you can kinda have a smooth clamping. or else you can use
Vector2.ClampMagnitude(vector, maxSpeed);

spice burrow
#

hmm alright

#

I'll take a look

naive pawn
#

yeah seems like you'd just clamp the velocity

spice burrow
#

Is there any Mouse.current.middleButton scrolling function? I want to check if the scroll wheel is being scrolled down or up to change between two settings/modes.

rough granite
swift crag
#

i can check the exact name once my project opens

radiant terrace
#

how would i learn c# basics from literally 0 programming knowledge

swift crag
#

Unity Learn can help you figure that out --

#

!learn

radiant voidBOT
swift crag
#

however, you also may want to start with C# on its own

#

I can't offer any strong opinions on how to do that – I picked it up with extensive prior experience in other languages

radiant terrace
frosty hound
#

We occassionally get beginners here asking that question. There is no feasible way to just explain what the "main things of C# are". Do the learning courses.

frosty hound
#

Unity Learn is a good place to start yeah

crystal vale
#

could some one show me how to make an moving 2d animation in unity?

pliant bridge
#

cz for me, VS Studio is so heavy and laggy

#

so i change to rider

#

pretty lighter

summer bear
#

If I want to implement short hopping for jumping (ie. if the player releases the jump button early), what typically is the best feeling approach? Adjusting the rigidbodies gravity? Or adjusting the velocity over time?

summer bear
#

the apex of the jump should essentially be dictated by how long the jump button is held, with a minimum and maximum

silk night
#

you can apply a continous force as long as the button is held

#

up to a certain amount of time per jump

verbal dome
summer bear
#

Have you ever tried the gravity approach?

idle saffron
#

i am new to unity, i want to find the value of a variable in the logic script for use in another script but i dont know how?

idle saffron
wintry quarry
#

be more specific

idle saffron
#

i have a variable in logic script, that i want to use in another script (lets call it scriptA), i kinda understand how to make a reference but it cant get a line of code which accesses the variable from the logic script. I dont know what to write?

wintry quarry
#

The first thing you need to do is figure out the relationship between the two instances of the two scripts in the game are.

#

.e.g are they on the same object? In the same scene? In different scenes? One on a prefab one not? etc...

Pick the one that describes your situation above, and follow it^

idle saffron
#

ok

#

im so lost. i genuinly started unity yesterday. i cant understand what anything means

naive pawn
#

we don't know what you know or don't know, so we're not going to explain every little detail, but we also don't expect you to know every little detail

idle saffron
#

i know like genuinely nothing, ill try to explain in a sec

summer bear
wintry quarry
#

Let's just let them tell us what they're confused about

#

I think it's clear they have not

summer bear
#

Fair

dusk rapids
#

hello guy I am new to unity and I was thinking about making a vr game do you think as a new unity user that doesn’t know how to script or design would be a good idea

wintry quarry
#

At least noe or two basic practice projects

hybrid gust
#

So, I'm using AsyncOperationHandle from the Addressable package to get references to items I want my game's containers to spawn I now feel like that was a bad idea? Once the asnyc operation has been completed, if I wanted to store the results of the operation in a seperate collection, IE, the player inventory I wouldn't be able to Release the operation handle right? Or am I understanding that incorrectly?

idle saffron
#

both objects are in the same scene. ive used references before to find values such as the x position of another object but never to find a variable from a script. as i have just started using c# yesterday my knowledge is almost nothing so i cant really understand either of the links too much despite how simple they probably are. i do not care about efficiency of the script, just need it to work. i know im not being very helpful. would i use get component? im just not sure at all ngl

wintry quarry
dusk rapids
wintry quarry
#

The only difference is you are using your own custom component instead of a Transform.

tepid portal
#

or unitys official tutorials?

#

unity have a pretty insane roadmap with step-by-steps and levels that i wish i knew about when starting out

wintry quarry
idle saffron
#

i know im meant to drag a reference into something under the script in unity, but i dunno

wintry quarry
#

whya re you doing taht

#

Make a variable for your reference

#

use that variable

wintry quarry
#

If you want specifics, you need to share your code

idle saffron
#

ok

wintry quarry
#

!code

radiant voidBOT
idle saffron
# wintry quarry If you want specifics, you need to share your code

under LogicScript, i have defines the variable (public int playerScore;), in a seperate script i need to access this variable for a calculation. i just cant understand how i would make a refence in this context. if imake a variable it wont let me drag and drop likely because i define it as int. i just dont know. i am the most beginner of beginner. thx for helping so much

wintry quarry
#

Then you can do myLogicScript.playerScore when you need the score

wintry quarry
#

pay careful attention

idle saffron
naive pawn
#

you used LogicScript.playerScore, meaning "the playerScore of the class LogicScript", but that doesn't exist

#

playerScore exists as a non-static field, meaning it exists for individual instances, not the class as a whole

wintry quarry
naive pawn
#

you.. didn't do what praetor told you to do

wintry quarry
#

I can't guess at errors without seeing what you tried

idle saffron
wintry quarry
#

look at my example again

naive pawn
#

consider the difference between

Vector3 someVector = new Vector3(4, 1, -2);
Debug.Log(someVector.magnitude);
```and```cs
Debug.Log(Vector3.magnitude);
idle saffron
#

im sorry for being so confused. here is all of my relevant code. im sure it isnt to do with incorrect capitalization.

naive pawn
#

the second LogicScript in the second image is incorrect

naive pawn
wintry quarry
#

In your case you named the variable Logic

idle saffron
#

o my god i am so blind thank you so much. i must look like such a bot

wintry quarry
#

Just a beginner making beginner mistakes

naive pawn
#

no you just look like a beginner 😄
you'll get better with experience

polar acorn
pliant bridge
#

is my world generation cooked?

#

when i change sort order from bottom left -> top right ,it's become multi level terrain but the tile and the grid is not suit of each other, is there any solutions?

#

the grid:

#

do you guys know any issues ?

fickle plume
pliant bridge
#

i did it... but it became worst

chilly barn
naive pawn
#

oh it's a spaceship

#

that explains a lot

chilly barn
#

it can now fly to where you click, spends fuel and turns, and falls into orbit around planets!

icy fossil
#

Hello,

I'm trying to use ECS DOTS to do multiplayer game. I try to keep my project simple as I can.

Here I'm strugguling :
I create a static object cube in a subscene

When I start the game I cannot see this gameobject in "Physics Debugger Tabs"

var physicsWorld2 = SystemAPI.GetSingleton<PhysicsWorldSingleton>().CollisionWorld;
Debug.Log($"[World: {state.World.Name}] Active body physics : {physicsWorld2.NumBodies}");

This show me 0 on Update Method.

sour fulcrum
delicate ferry
#

@solar hill transform.RotateAround(Center.transform.position, OrbitVector, Time.deltaTime * OrbitSpeed);

#

Orbit vector is currently 0, 0, 1

#

I should mention it's a 2d game

solar hill
#

you need to cache the tangential velocity

delicate ferry
solar hill
#

gimme a sec

#
// get the center of rotation what wre oribiting around
Vector2 center = Center.transform.position;
// get current object position
Vector2 pos = transform.position;
// this is  the radius of your rotation circle.
Vector2 radius = pos - center;
// then we find the perpenducilar direction or rather the "tangent"
// this is basically the direction of the object while its rotating.
Vector2 tangent = new Vector2(-radius.y, radius.x).normalized;
// RotateAround according to the API uses degrees, but for the math you need radians so just convert it
float angularSpeed = OrbitSpeed * Mathf.Deg2Rad;
//simple enough formula, you multiple the angular speed with the radius
float speed = angularSpeed * radius.magnitude;
// this is then the exact velocity your object has while rotating 
Vector2 velocity = tangent * speed;
#

then when you need it to no longer orbit

transform.position += (Vector3)(velocity * Time.deltaTime);
solar hill
#

actually woops that needs to be a vector3

delicate ferry
#

Is this the way to find the closest object?

        foreach (var Orbitable in GameObject.FindGameObjectsWithTag("Orbitable") {
            if ((Orbitable.transform.position - transform.position).sqrMagnitude < (ToOrbit.transform.position - transform.position).sqrMagnitude)
            {
               ToOrbit = Orbitable;
            }
        }
grand snow
swift crag
#

I was going to say that this would be a fine place to use LINQ (especially if you aren't that worried about performance)

#

but I forgot that MinBy is an extension method I wrote and not something built in

#

it'd look like this

#
var targets = GameObject.FindGameObjectsWithTag("Orbitable");
var closest = targets.MinBy(target => Vector3.Distance(target.transform.position, transform.position);
#

alas

swift crag
#

(this won't work without some extra code :p)

#

it's just the idea that came to mind

#

It does the same thing you're doing here – find whichever one has the smallest distance

delicate ferry
idle saffron
#

hello, i am a beginner, how would i access the value of a variable in the logic script from a script in a prefab of the same scene? i know very little

swift crag
#

You'll need to get a reference to the component whose data you want to access.

#

(each thing in the inspector, like "Transform" or "Box Collider", is a component)

swift crag
idle saffron
#

thanks for helping, one of them is spawned but due to it being a prefab, i cant drag and drop so i dont know how i would make a reference

grand snow
#

tags are good as a beginner i guess

swift crag
#

Whoever spawns the prefab should tell it about the other object

grand snow
chilly barn
#

hey! how do i make the text and circle sharper? theyre getting softened rn and its supposed to be more pixel perfect instead of smoothed, going for that retro terminal type vibe

grand snow
#

circle is however its rendered and not relevent to this channel

chilly barn
#

ur right, my bad

idle saffron
grand snow
idle saffron
#

it is a prefab

grand snow
#

@idle saffron

GameObject newPipe = Instantiate(pipe, somePos, someRotation);
MyComponent c = newPipe.GetComponent<MyComponent>();
c.DoCoolShit();
#

Spawn, keep reference, get some component, call function or assign to some variable

idle saffron
grand snow
#

the thing to understand is you can get the script/component instance from the new object and interact with it

#

c.coolVar = 15; or something

#

if that still confuses you then you need to learn more c# basics

idle saffron
#

ok

eternal vale
#

Unity is kinda hard for me to learn

#

Im switching to godot

#

🙁

solar hill
#

what do you expect us to tell you?

#

thats its going to be easier elsewhere?

#

because its not, youre free to use what you want, but if youre switching just because of the learning curve you are in for a rude awakening

eternal vale
#

I actually learned godot forst than unity

#

For me godot is much more easier than unity

ivory bobcat
#

Game development is difficult overall. Not sure how changing interfaces will make it any easier.

smoky breach
#

Is there a way to check with the new input system if any key or control is moved to get out of an idle anymation?

#

or to do press any key to start

thin lotus
#

I have this loop with a delay of 0.05, but when i test it, it appears much slower
public class Click : MonoBehaviour { float sizeincrease = 0.1f; int iterationCount = 3; public float delayBetweenSteps = 0.05f; void OnMouseOver() { if (Input.GetMouseButtonDown(0)) { StartCoroutine(ScaleOverTime()); } } IEnumerator ScaleOverTime() { for(int i = 0; i < iterationCount; i++) { transform.localScale += new Vector3(sizeincrease,sizeincrease,0); sizeincrease += 0.1f; yield return new WaitForSeconds(delayBetweenSteps); } } }

thin lotus
#

I figured it out

#

nvm

meager gust
#

you also just joined 3 days ago

naive pawn
orchid wolf
#

I mean, I would use Update() or FixedUpdate() and count deltaTime for my timer

naive pawn
meager gust
orchid wolf
meager gust
#

godot is open source and wonderful, but unity is the more mature engine

naive pawn
orchid wolf
naive pawn
#

i'm not saying godot is better or unity is worse, but everyone has their own pre-made preferences

#

sometimes those align better with something else

naive pawn
viral bobcat
#

I am working on player physics of a FPS and I check cc.isGrounded before allowing a jump. For some reason I cannot jump at all whilst standing still (even after moving) and my jumps are far flatter than they should be when input whilst moving. Removing the cc.isGrounded == true condition allows a regular jump which moves much higher. Does cc.isGrounded just suck or is there something else I need to adjust?

frail hawk
#

post some code

eternal vale
#

hehe im back , and i enjoyed unity for time being :3

#

How do I complicately design this ui with custom stuff

#

it looks plain

#

and pain

naive pawn
#

design how you want it to look first, then implement it

#

also, this is a code channel

#

once you figure out what you want, if you're having issues, ask in #📲┃ui-ux

naive pawn
viral bobcat
austere kraken
solar hill
#

People who are active here are typically also working on their own projects at the same time

ionic zealot
#

Helloo, laddies! Im having some trouble using the animator. I have a few transitions but the main problem is that they queue. For example, if im reloading and am spamming the shoot button, itll wait for the reload to happen, then shoot as many times as i pressed, yk? how can i fix that?

frail hawk
#

if you have hasExitTime checked, the animation will play until the end

ionic zealot
delicate ferry
#

What are the conditions for onCollisionEnter2D to get called? I have two box collider2d's, one of them has a script with that method yet it isn't called

frosty hound
#

A rigidbody on one of them

#

Or specifically a rigidbody2D

viral bobcat
#

how can i paste code into discord properly?

frosty hound
radiant voidBOT
viral bobcat
#

thanks

#
using UnityEngine;

[RequireComponent(typeof(CharacterController))]
public class PlayerMovement : MonoBehaviour
{
    public float jumpHeight = 2.5f;
    public float gravity = -29f;

    // References
    private CharacterController cc;
    private InputHandler inputHandler;
    private Transform cameraTransform;

    private Vector3 velocity;
    private float currentHeight;


    private void Awake()
    {
        cc = GetComponent<CharacterController>();
        inputHandler = GetComponentInParent<InputHandler>();
        cameraTransform = GetComponentInChildren<Camera>().transform;
    }

    private void Update()
    {
        if (inputHandler == null) return;

        velocity.x = 0f;
        velocity.z = 0f;
        HandleJump();
        ApplyGravity();
        Debug.Log(velocity.y + "|" + cc.isGrounded);
        cc.Move(new Vector3(velocity.x, velocity.y, velocity.z) * Time.deltaTime);
    }



    private void HandleJump()
    {

        if (inputHandler.JumpPressed && cc.isGrounded) // && cc.isGrounded (makes jump flatter but prevents air jumps)
        {
            velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
        }
    }

    private void ApplyGravity()
    {
        if (cc.isGrounded && velocity.y <= 0)
        {
            velocity.y = -2f;
        }
        else
        {
            velocity.y += gravity * Time.deltaTime;
        }
    }
}
#

Removing cc.isGrounded in HandleJump() makes the jump higher but I do not understand why

#

Can somebody please explain why?

delicate ferry
#

Though why does it neeed a rigidbody?

frosty hound
#

Because physics?

delicate ferry
frosty hound
#

Use the OnTriggerEnter version instead, if you don't things to physically collide. You also have to set the IsTrigger flag on the collider.

naive pawn
#

you still need an rb