#💻┃code-beginner

1 messages · Page 740 of 1

carmine summit
#

did you most the code that handles this somewhere

dusty seal
#

yes. but thats not the case since it still levitates even before i try to grapple

carmine summit
#

if not that would be helpful

winged ridge
#

And your rigid body has gravity enabled and a decent mass on the object?

dusty seal
#

that was my whole point with why everything is so bugy

#

and im trying to find a work around

winged ridge
#

Add a rigidbody, as you shoot the grapple, disable the rigidbody, then when you get to the target re-enable it

#

Either that or you would have to calculate manually (code) the distance between your characters lowest point and the floor and decrease your position over time using a lerp

#

One reason it may glitch is as you are forcing the character up using the grapple, the rigidbody is forcing it down giving a jittering appearance. Either removing the gravity or disabling rigidbody helps

dusty seal
#

i dont have a rigid body on my character though

winged ridge
#

Yes so add one, the rigidbody is a quick way to calculate physics outside of doing it yourself

dusty seal
#

got that

#

I will try to do what you suggested tomorrow thank you

carmine summit
#

yeah you could have a rigidbody control the position of the object while the grapple occurs

#

you would have to stop the character controller from affecting the object's position while that's happening, though

#

and if you want i.e. for the player to be able to move or jump like normal while grappling that might get complicated

winged ridge
#

Unless you want to rewrite physics irl... I wouldn't lol

willow iron
#
    void Update()
    {
        if (bool == true)
        {
            bool = false;
        }

        if (bool == false)
        {
            bool = true;
        }
    }

im pretty sure that if this is run, bool will be true by the end of the update function. Is there a way to end an update function prematurely?

eternal needle
#

Or just else since bools can only be true or false

ivory bobcat
#
void Update()
{
    b = !b;
}```
pallid heron
#

If my partner pulls this branch, it deletes a bunch of meta files. If she pushes that, it creates them on my end. What's going on?

winged ridge
lament scarab
#

I know this isn't exactly code based, but I'm pretty stuck and would love some help..

I'm seeing this compiler error 'UnitRoot' AnimationEvent has no function name specified!. I'm using a SPUM prefab, trying to learn the basics of Unity. The only result I can find on Google is that it seems like maybe I created an event in my animation by mistake (which is possible, since I was playing with the animation stuff), but I can't figure out how to fix it. My animation window shows as fully blank, and I've clicked through all I can think of to try to locate the screwy event. Does anybody have any tips for this?

strong wren
pallid heron
#

I've edited and committed one thing in the Packages folder, but it wasn't a .unitypackage file

strong wren
pallid heron
#

So what's the point of unignoring unitypackages instead of just ignoring .unitypackage.metas?

#

neither of them seem useful to keep around

fallen cosmos
#

They managed to triage it and made a dedicated issue about this

#

You can check its status on a link above

oblique ridge
#

right but i don't think i want to be the guy messing with gameplay systems, scripting etc

hardy wing
#

Thanks for updating me on the matter 👍

inland thistle
#

Hi guys, i'm looking for make some prototype and test some character scripts, but i need a 3d prototype example. Any know a basic o 3d human model for prototype games? with animations and basic things?

inland thistle
#

thanks

silk night
# inland thistle thanks

Asset store in general is a good source for inspiration on how to solve things + free/cheap assets

fickle plume
#

!collab

bronze spruceBOT
# fickle plume !collab

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
• ** Collaboration & Jobs**

quartz nimbus
#

I just had a question would it be better to make all my coroutines in 1 script for example adding all my coroutines to a StatusEffectManager script and calling it in when need be or is it better to just have it all within the same script

naive pawn
#

but you should generally keep stuff where they're used

quartz nimbus
#

ok thx

dawn moth
#

why does it say > isnt a valid expression

nimble apex
#

im wondering do i really need this safeguard

previousCategory.onClick.AddListener(() =>
{
    if (categoryIndex < 1) //safeguard
    {
        categoryIndex = 0;
        return;
    }

    categoryIndex -= 1;
    FilterCategory(categoryIndex);
});


in FilterCategory():

previousCategory.GetComponent<Image>().enabled = category != Category.All;```
naive pawn
dawn moth
#

ohh i missed the i, thank you

naive pawn
#

your condition right now is just, "less than pages.Length"
that doesn't make sense. what is less than pages.Length?

dawn moth
#

yeah i got it, sorry about that

nimble apex
#

i think i will remove the safeguard first

naive pawn
earnest lion
#

do yall have any reccomendations on how to streamline learning scripting? i have some basic understanding of programming, but very brief and unpractical.
Usually how i go about learning new things, is i set myself a project to make and i learn things as i go, but i do not wanna watch "how to make character jump unity" as this usually wont explain the code to me, just a wall of text with a result ready

nimble apex
#

u see , there are previous and next button, im still building prototype so no graphics yet, thats not a problem

it is something like

< page 1 >

naive pawn
nimble apex
#

categoryIndex is just a global variable

private int categoryIndex;```
carmine summit
#

that might not be what you want though

naive pawn
#

and that's not close to a global either, that's an instance member

nimble apex
#

its a member then

naive pawn
carmine summit
#

tbh unity is a big and complicated engine, i'm not a fan of "watch this four hour youtube video where they write the code for one specific system!" but if you can find tutorials where you understand the why i think it's a good way to learn how to apply the concepts of the engine to achieve a goal you have in mind

nimble apex
#

wait u can directly subtract and add enum?

#

nice

naive pawn
#

yes, they are numbers with names

nimble apex
#

then i dont need integer

naive pawn
#

you generally probably shouldn't though unless the enum is specifically made for it

carmine summit
#

enums are literally just ints in c# in like every way that matters yeah

earnest lion
naive pawn
carmine summit
#

also googling how to do a specific thing is often helpful, since a lot of people will likely have the same question

plucky sentinel
#

Can anyone help me identifying the issue in untracked memory growth overtime ?

naive pawn
#

there's also the unity learn pathways

earnest lion
naive pawn
#

yeah

#

!learn

radiant voidBOT
nimble apex
#

hold on

earnest lion
# naive pawn !learn

that looks like its a couple weeks worth of learning. is it worth investing my time into? Ik its a way to learn, im just wondering if its a good one

nimble apex
#

i think i need to rewrite the logic first

earnest lion
#

im not complaining btw, just curious

naive pawn
#

there's like, stuff for vr, audio, ar, behavior, animation, ik, physics, scripting, etc

#

focus on the things you're currently trying to do

earnest lion
#

okay ill give it a try, thanks a lot

nimble apex
#

so just focus on that game

earnest lion
#

my motivation for learning game dev was reignited when i was hit with the frustration of finding out how little good local coop games there are haha

#

and just coop games in geeral

nimble apex
#

ok so its coop games , what coop games u think its cool? among us?

#

anyway, u will make that as a target , and keep trying

earnest lion
#

i actually have two ideas. a sci fi tps, think OG star wars battlefront II, but with more emphasis on team play (classes that benefit from playing together and helping each other out), and a 2d souls like, thinking castle crashers meets dark souls precise combat lol

#

my problem with most modern shooters is that unless its a battle royale (or cs), you and your buddies just basically just join the same game and play alongside each other instead of actually interacting in meaningful ways for the team

#

(im thinking EA battlefront especially lol)

nimble apex
#

maybe u wanna give it a try first?

earnest lion
#

I was actually staring with a simple 2d platformer

nimble apex
#

after u learnt the basics

earnest lion
nimble apex
#

plz dont start with big projects unless ur very sure u have at least one year , 12 months and with loyal and devoted teammates backing u up

#

u ofc, are devoted as well

earnest lion
#

my setup rn lol

nimble apex
#

good , so u have found ur way, then just keep going

earnest lion
naive pawn
#

!ide

radiant voidBOT
nimble apex
#

really

naive pawn
#

yeah there are errors there that aren't highlighted

earnest lion
naive pawn
#

Input also isn't highlighted correctly

nimble apex
#

unconfigured IDE is almost as text editor

naive pawn
#

make sure you have the folder open as well, rather than just files

earnest lion
naive pawn
#

have you installed .net?

#

via the .net install tool

rich adder
#

doesnt help that you're in restricted mode where afaik all external plugins are disabled

earnest lion
#

at some point, probably i just dont remember which one xd

earnest lion
naive pawn
earnest lion
#

theres a bunch of versions you need to install sometimes for like older programs or mods and so on

naive pawn
#

there aren't, no

earnest lion
earnest lion
naive pawn
#

those aren't different versions even, those are different releases

#

but also, this is why i said to use the .net install tool

#

that's an extension in vscode

#

it does the work for you

earnest lion
#

i installed unity ages ago so i dont remember anything i did lol

naive pawn
#

well you clearly didn't do this part, at least not to completion

earnest lion
naive pawn
#

this isn't even a unity thing

naive pawn
earnest lion
earnest lion
polar acorn
#

Go through this guide, step by step

earnest lion
#

got it, thanks

naive pawn
earnest lion
naive pawn
#

you gotta
install .net install tool (& other c#/unity extensions) -> install .net itself -> restart vscode
and then make sure you have the project folder open, external tool and packages in unity are correct, and perhaps regenerate solution if it's not working

naive pawn
earnest lion
#

im trying to figure it out, as i said i do not remember

naive pawn
#

then say so instead of being obtuse, and then go try

#

it'll say it's already installed if it's already installed

earnest lion
naive pawn
#

"it depends" does not mean the same thing as "i don't remember"

#

say what you actually mean so people can understand you

#

now stop deflecting and go do it

earnest lion
#

Actually something came up and I have to go unfortunately, thankful for everyone's help though

#

I will be back in an hour or two but I don't expect anyone to wait around for me hah

naive pawn
#

that's why we have message history

earnest lion
fast heron
#

quick question - how do people usually handle movement in a tetris clone? I've got the following

        if (Input.GetKeyDown(KeyCode.UpArrow))
            PieceRotate(1);
        if (Input.GetKeyDown(KeyCode.DownArrow))
            PieceMove(Vector2Int.down);
        if (Input.GetKeyDown(KeyCode.LeftArrow))
            PieceMove(Vector2Int.left);
        if (Input.GetKeyDown(KeyCode.RightArrow))
            PieceMove(Vector2Int.right);

but I don't like how you have to constantly tap the key to move right / left. I'd like to be able to hold down the left / right arrow to move side to side, but GetKey() causes it to move too fast. what's the solution here?

keen dew
#

A timer that limits how often it moves when a key is held down

grand snow
fast heron
#

ok another timer it is then

#

yeah< i probably should use the new input system i'm guessing

#

I just followed a tutorial to get this far and haven't bothered

grand snow
#

its easy, you store the time of the move and each move attempt checks if lastMoveTime + delay < Time.time

#

yea with the new input system its easy

fast heron
#

yup i get the idea

#

i've got a bunch of other timers going for other stuff

#

i just add a new one

grand snow
#

If we store game time its a bit nicer than having some time value we need to decrease in Update()

fast heron
#

there we go. worked like a charm. thanks

silk sleet
#

hi so i am messing around with the microgame that comes with the unity fps tutorial, i want to add a sound effect for entering aiming down sight (ADS) and exiting it, but not sure where to start

cosmic quail
silk sleet
cosmic quail
#

surely that will find it

silk sleet
cosmic quail
#

there should be an option to search all scripts

polar acorn
silk sleet
polar acorn
#

Seems like a decent place to check.

silk sleet
# polar acorn Seems like a decent place to check.

found this there. what am i looking at?

c bool GetAimInputHeld()
        {
            if (CanProcessInput())
            {
                bool isGamepad = Input.GetAxis(GameConstants.k_ButtonNameGamepadAim) != 0f;
                bool i = isGamepad
                    ? (Input.GetAxis(GameConstants.k_ButtonNameGamepadAim) > 0f)
                    : Input.GetButton(GameConstants.k_ButtonNameAim);
                return i;
            }

            return false;
polar acorn
#

Literally just going off of the name, a function that returns a Boolean for whether the "Aim" input is held

silk sleet
polar acorn
#

Which seems like something that would be used by something that happens when you hold the button

#

So, follow the trail. Find where this is used

silk sleet
# polar acorn So, follow the trail. Find where this is used

in PlayerWeaponsManager.cs, i found:

        void Update()
        {
            // shoot handling
            WeaponController activeWeapon = GetActiveWeapon();

            if (activeWeapon != null && activeWeapon.IsReloading)
                return;

            if (activeWeapon != null && m_WeaponSwitchState == WeaponSwitchState.Up)
            {
                if (!activeWeapon.AutomaticReload && m_InputHandler.GetReloadButtonDown() && activeWeapon.CurrentAmmoRatio < 1.0f)
                {
                    IsAiming = false;
                    activeWeapon.StartReloadAnimation();
                    return;
                }
                // handle aiming down sights
                IsAiming = m_InputHandler.GetAimInputHeld();

                // handle shooting
                bool hasFired = activeWeapon.HandleShootInputs(
                    m_InputHandler.GetFireInputDown(),
                    m_InputHandler.GetFireInputHeld(),
                    m_InputHandler.GetFireInputReleased());

                // Handle accumulating recoil
                if (hasFired)
                {
                    m_AccumulatedRecoil += Vector3.back * activeWeapon.RecoilForce;
                    m_AccumulatedRecoil = Vector3.ClampMagnitude(m_AccumulatedRecoil, MaxRecoilDistance);
                }
            }
naive pawn
#

why are you setting your codeblocks to swift lmao

naive pawn
#

understandable

polar acorn
silk sleet
polar acorn
#

remember, you're looking for where it's checking Aim

silk sleet
#

there is a boolean (i think) that does handle aiming, but it doesn't really seem to do anything under it

#

is that where i'd make changes?

#

where there's currently nothing there

#

or is this pointing to another piece

polar acorn
silk sleet
#

and IsAiming = false;

polar acorn
silk sleet
#

m_InputHandler?

polar acorn
#

Let's back up. Which specific line or lines of code involve the GetAimInputHeld function

silk sleet
polar acorn
silk sleet
#

there is also 143 through 145, i'm also not sure about.

polar acorn
silk sleet
#

i'm thinking

#

i might be stupid

polar acorn
#

Remember that code is just words. You can read the words in the functions to get an idea of what they mean.

#

Which lines look like they get the value of the Aim input in any way?

silk sleet
polar acorn
silk sleet
polar acorn
#

But for now we were just looking at the function you provided

#

In that function

#

What lines involve reading the Aim input

silk sleet
polar acorn
#

Which is why I asked that instead of something else

silk sleet
#

i'm afraid i'm not sure what you mean by reading

#

the input must be connected in some way, but i don't know how.

polar acorn
#

So, what lines get the value of the Aim input

silk sleet
#

which lines retrieve the input

#

let me see

#

would it be one of the if statements?

polar acorn
#

would it?

#

You can read the code as much as I can. What about those lines looks like it gets the aim input?

polar acorn
silk sleet
polar acorn
silk sleet
polar acorn
#

Now, what does this line do?

silk sleet
#

so is this not where we would add additional code?

polar acorn
silk sleet
polar acorn
silk sleet
#

without it, the aim function doesn't work

polar acorn
#

Where does it put that information?

silk sleet
polar acorn
#

the line you identified

#

what does that line do

#

It calls a function that gives it a boolean value

#

what does it do with that bool

silk sleet
#

m_InputHandler? does that not go back to PlayerInputHandler.cs?

polar acorn
#

What does it do with the result of that function

silk sleet
polar acorn
#

We are looking at a singular line

#

What is this one line doing

silk sleet
polar acorn
#

Do you know what = means

silk sleet
#

i would be assuming that = is defining a name for something else

polar acorn
# silk sleet probably not in this particular context, no. it means they're the same or correl...

If you don't know what = means in code, then you do not have enough basics to write anything.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/assignment-operator

Consider doing the tutorials in the pins or Unity Learn.

#

Trying to explain how to read code is pointless if you literally don't know the basic building blocks of a line of code

#

I'm trying to guide a journey of self-discovery but if you just cannot understand the words in front of you I'm not going to be able to

silk sleet
#

i apologize.

The assignment operator = assigns the value of its right-hand operand to a variable, a property, or an indexer element given by its left-hand operand.

so, i was... somewhat correct, i guess? it's assigning what's on the right to what's on the left. or am i still wrong?

#

so if this is what you call an "assignment operation", then i assume the "assignment expression" would be what comes of the right, which would be the left. meaning it's defining "m_InputHandler.GetAimInputHeld();" as a value?

cosmic quail
silk sleet
#

i had asked where i'd go if i were to modify it, but i haven't the slightest clue where to look or how i'd modify it. so i got the steps backwards.

silk sleet
boreal cargo
#

hey ! how are yall ?
I have a little problem :
My goal is to activate/desactivate the animator to create a ragdoll effect
the problem is when i reactivate the animator component, when i switch state like from moving to jump, everything breaks, like the character return to default pose
Why ? when i desactivate activate the component in the inspector, everything is good and fixed
But when i do it in a script, here is where all animations break

chilly vigil
#

what does failed to create device from file error message mean

strange jackal
#

I loaded up the CloudSaveSample that comes with Cloud Save. I am getting obsolete errors on DeleteAsync code
await CloudSaveService.Instance.Data.Player.DeleteAsync(key, new DeleteOptions{ WriteLock = writeLock});

naive pawn
#

not sure about what the error is specifically about though

chilly vigil
#

it is on my extenal hard drive

rancid tinsel
#

is this good practice for passing damage info, and are there any ways I could improve it?

#

the idea is for it to scale well with quest or achievement systems (Deal 1000 damage, Deal 500 damage to X Enemy Type etc)

#

or something like a combat log

shell sorrel
#

i feel its a pretty common way of doing things, and has no issue if it suits your needs

#

how simple or complex you go depends on your game, like this would not work for split damage types for example

#

as far as a combat log or something i would just make sure all of your implementors of TakeDamage invoke a event the log or the achievement system can sub to

grand snow
#

I like

zenith cypress
#

we do something similar

blissful violet
#

Hi! I'm following a tutorial for programming in Unity, and I noticed that GameObject should be a different color, and the text should autocomplete, but it's not. The rest of the code is kind of like that, and I'm not sure what this problem is called, and I would like to know how to fix that.

For context, I'm using Unity 6000.2.6f1, and my code editor is Visual Studio 2022 version 4.8.09032

slender nymph
#

!ide

radiant voidBOT
blissful violet
#

Oh, it's called an IDE, thanks!

slender nymph
#

visual studio is the IDE. what you were referring to is syntax highlighting and intellisense

rancid tinsel
rancid tinsel
shell sorrel
#

like a weapon that does physical damage and magic damage

rancid tinsel
#

I guess in my case I'd just send two damage events, but you're right that it affects it a lot

zenith cypress
shell sorrel
#

@rancid tinsel i think what you got is a good start and i would not copy other peoples approaches directly and just add to yours as the need arrises

rancid tinsel
zenith cypress
#
[Flags]
public enum DamageFlags {
    None  = 0,
    NoHex = 1
}
shell sorrel
rancid tinsel
#

oh like a list of enums?

short hazel
#

If you've dealt with rigidbody constraints from the code, you've seen them already

shell sorrel
rancid tinsel
#

for example IsGrounded, OnWood etc

rancid tinsel
#

😢

short hazel
#

You can combine values with |

rancid tinsel
#

might be too tired tbh

cosmic dagger
short hazel
#

MyEnum v = MyEnum.A | MyEnum.B

shell sorrel
# rancid tinsel oh
[Flags]
private enum ChangedFull
{
    Unset = 0,
    Position = 1,
    Rotation = 2,
    Scale = 4,
    Childed = 8,
    Teleport = 16,
}

notice the pattern with the numbers they are all power of 2 so each one only uses 1 bit

grand badger
#

@cosmic dagger u've studied game design?

shell sorrel
#

as a result you can use bitwise math to read the value of indvidual ones

#

or combine then with bitwise math

oblique ridge
shell sorrel
#

like Position | Rotation | Teleport would create one that is all of those at teh same time

#

then you can check for individual bits using bitwise and &

#

if ((value & ChangedFull.Position) != 0) { // do stuff if positon bit is set

grand badger
#

A better way to define flags (even without fully understanding it), is this:

[Flags]
enum ChangedFull
{
    Unset    = 1 << 0,
    Position = 1 << 1,
    Rotation = 1 << 2,
    Scale    = 1 << 3,
    Childed  = 1 << 4,
    Teleport = 1 << 5,
}
#

the advantage is that you don't need to do the math yourself except basic counting lol.

rancid tinsel
#

not going to lie I sort of get what the bitwise math thing is now but this is still blowing my mind lol

grand badger
polar acorn
cosmic dagger
# zenith cypress we do something similar

I'm curious, what's the difference from DamageType and DamageFlags? I literally just created a damage system, and asked about having attacks with multiple damage types, like blunt (physical) and fire (magic) . . .

shell sorrel
shell sorrel
cosmic dagger
grand badger
#

the a & b != 0 is MUCH faster -- by nanoseconds -- so I wouldn't advise using it unless working on a performance-critical system (typically game engine or networking etc)

zenith cypress
grand badger
#

like FromEnemy, FromPlayer, CausedByAoE, etc?

cosmic dagger
grand badger
#

I like the mentioned architecture, but it's important to understand why it's good, otherwise it's bad 😛

shell sorrel
#

really i feel most mostly important to just keep things simple and down to only what is required for the current situation

rancid tinsel
zenith cypress
rancid tinsel
#

its basically having a list of bools... without having a list of bools - you only use what you need when you need it

shell sorrel
#

to me the bitwise & is actually just more readable since its the same in all languages, not even a perf thing just a pattern recognition thing

rancid tinsel
#

right?

shell sorrel
#

and the same weather on its ints or enum types

grand badger
#

yeah I'm almost always fine with boxing ^^ I even unsafe-cast around base-type parameters if it reduces complexity or makes code more readable hehe

#

it's really hard to run into performance issues without using actual anti-patterns/anti-practices haha

grand badger
shell sorrel
#

do got to keep in mind the limitations though which will be based on what your enums subtype is

grand badger
shell sorrel
#

oh just pointing out, that you cant just pack hundreds in there, you are restricted to the bit size of the type

earnest wind
#

hey guys, im going insane, when i draw on a layer (by using SetPixels) everything is fine - can draw anywhere

now i delete that layer, so i try save it

var removedLayer = new Texture2D(TextureLayers[n].width, TextureLayers[n].height, TextureFormat.RGBA32, false);
        removedLayer.SetPixels(TextureLayers[n].GetPixels());
        removedLayer.Apply();
        changeStack.Add(new LayerDeleteChange(n, removedLayer));

where it saves

class LayerDeleteChange : IChange
    {
        int index;
        Texture2D layer;
        Image image;
        TextureDrawingLayerUIItem ui;

        public LayerDeleteChange(int idx, Texture2D l)
        {
            index = idx;
            layer = l;
        }

its an interface class

now i try to bring it back with the undo system, everything is okay, until i try to draw in that layer again, now i cant draw anywhere where it was already drawn

#

now lets say i delete it and bring it back agai

#

what is happening help

#

wait i think i might know, it actually does draw, but it doesnt show me

#

thats really weird

#

i cant figure it out honestly

#

but i know that the texture is fine

#

something else is wrong

quartz brook
#

Hey, quick question. I have such scenario.
My player that have Character Controller, runs into pickup which have Rigidbody with Collider and I want to detect that collision from pick up perspective. I used the OnCollisionEnter but it dosen't detect player (only floor) and OnControllerColliderHit is not detecting anything.
Basicly why it's not working? XD

earnest wind
quartz brook
cerulean bear
shell sorrel
earnest wind
quartz brook
cerulean bear
quartz brook
earnest wind
cerulean bear
earnest wind
shell sorrel
quartz brook
#

And it works

#

So the name of the Layer is correct

cerulean bear
shell sorrel
earnest wind
quartz brook
#

So the layers are correct

cerulean bear
shell sorrel
earnest wind
shell sorrel
#

may not be from the object you think it is

#

also log it before the null ref and toss the go name in the log with it

cerulean bear
#

five objects with the script but four follow the prefab one is different and there are two null refs

#

both for the same line

rancid tinsel
shell sorrel
#

i more often use it for organization then anything

grand badger
shell sorrel
#

also its convention you can see even in the standard library many things that take args as flags

grand badger
#

the current machine architecture systems (HARDWARE -- e.g. CPU) can only read 64 bits at a time -- no more, no less

#

and because BYTES are established as a medium (NOT bits), to avoid confusions, the minimum amount of memory an object will take is 1 byte (8 bits)

shell sorrel
grand badger
#

so, bool is 8 bits to adhere to that minimum, so developers can align

rancid tinsel
grand badger
shell sorrel
#

but most of your types are larger like int is 32bit so 4 bytes

grand badger
#

even if they don't fully understand it, warming up their brain to core concepts of programming pays off 😈

ivory bobcat
shell sorrel
ivory bobcat
grand badger
#

oh yeah definitely -- I wouldn't bring this up if they didn't ask 😄

#

or I misunderstood their question.. idk.. I'm a bit baked rn xD

shell sorrel
#

also it makes sense if about memory size, but often your are best off just splitting your structs into arrays for perf over array of structs if you are dealing with a lot of data

cerulean bear
rancid tinsel
#

thanks for the lesson guys, I'll try to see if I can crack this bitwise stuff a bit better after some rest

grand badger
#

no -- it's much less code to manage an enum rather than manage a list! And the named syntax makes it more readable.

earnest wind
delicate laurel
#

What is difference between Unity and UnityEngine namespaces?

nova stratus
#

Hi, at my wits end trying to use addressables. The builds seem to randomly break every few coding sessions without my even intending to change anything about the addressable setup.

What do people use to create dlc? I just want modders to be able to create levels for my game, drop a package in the right place on a quest 3 and the game loads it and that's it... in as bulketproof a way as possible in all aspects. Addressables seem evil to me.

wintry quarry
delicate laurel
rocky canyon
#

i've never used Unity before i dont believe

wintry quarry
#

I suppose. It's not really something you need to think about too much

rocky canyon
#

ya, thats what my IDE is for 🤪

slender nymph
rocky canyon
delicate laurel
rocky canyon
#

ya, i get you.. i'd want to know too

#

just for curiousity sake

slender nymph
#

the Unity namespace is typically used by packages whereas UnityEngine is primarily used by stuff built in (or things that originally were and then were migrated to a package like the UI package)

wintry quarry
delicate laurel
nova stratus
#

Ok good talk. Thx.

cinder storm
#

I’ve been staring at my code trying to think of a way to do this for hours 😭

#

And apologies for my over commented code mess

wintry quarry
#

It's also very straightforward to just define a List or Array of the data you want and load it into a Dict/HashSet in Awake

#

I would recommend the last one if you are only doing this once or twice in your project.

wintry quarry
#

(this is pretty much the same answer you got in your link btw, which is a good answer)

delicate laurel
#

Could codegen+attributes be a way... (generates wrapper for SO automatically)

wintry quarry
# delicate laurel I used it, but now I need store config to create entities in runtime. I could cr...

You can just call Instantiate on your SO if you need to make a copy.

If you need it to work for serialization AND deserialization you can use this: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/ISerializationCallbackReceiver.html

And BTW the package I linked for serializable Dictionary does exactly that.

It sounds like what you want is both for it to be serializable in the inspector AND to be able to custom-serialize and deserialize as needed

#

you can do this either with two separate classes (the runtime one and a DTO), or by making your SO class handle both, but you'll need to fol,low all the rules of your serialization framework as well as the builtin unity serializer

delicate laurel
# wintry quarry You can just call `Instantiate` on your SO if you need to make a copy. If you n...

I have tried to make HashSet with ISerializationCallbackReceiver like

using System.Collections.Generic;
using UnityEngine;

namespace Data
{
    [System.Serializable]
    public class HashSetWrapper<T> : ISerializationCallbackReceiver
    {
        [System.NonSerialized]
        public HashSet<T> value;
    
        [SerializeField]
        private List<T> _serializedList; 

        public HashSetWrapper(IEnumerable<T> collection) 
        {
            value = new(collection);
            _serializedList = new(collection);
        }

        public HashSetWrapper() 
        {
            value = new();
            _serializedList = new();
        }

        public void OnBeforeSerialize()
        {
            _serializedList.Clear();
            _serializedList.AddRange(value);
        }

        public void OnAfterDeserialize()
        {
            value = new HashSet<T>();
            foreach (var item in _serializedList)
            {
                value.Add(item);
            }
        }
    }
}

But I can't add to list more than one item in inspector

wintry quarry
#

at least the parameterless one

delicate laurel
#

Only one element

#

It looks like

#

Give me minute, I faced interesting thing

wintry quarry
#

i.e. hjow did you define the field e.g.

public HashSetWrapper<WhatDoYouHaveHere> mySet;```?
delicate laurel
# wintry quarry What type are you using as T?

namespace Data.Stored.Configs
{
    [CreateAssetMenu(fileName = "FrontSetConfig", menuName = "Scriptable Objects/FrontSetConfig")]
    public class FrontSetConfig : ScriptableObject
    {
        [SerializeField] public HashSetWrapper<FrontConfig> value;
    }
}
    [CreateAssetMenu(fileName = "FrontConfig", menuName = "Scriptable Objects/FrontConfig")]
    public class FrontConfig : ScriptableObject
    {
        [SerializeField] public string frontName;
        //1indexed
        [SerializeField] public int awakeningDay;
        [SerializeField] public Location location;
        [SerializedDictionary("Tag", "Value")] public SerializedDictionary<Tag, bool> requirements;

        [SerializeField] public List<StageConfig> stages;

        [SerializeField] public string fiascoText;
        [SerializedDictionary("Tag", "Value")] public SerializedDictionary<Tag, bool> fiascoEffect;
    }
}
half notch
#

Hey, I have two scenes. Both have a global light 2D. When i change the scene with a load scene async, i have a warning error which tells me that i cannot have two global lights on the same layer in the scene (There is one global light on each scene). I think the warning might be due to the parallel of the two scenes given by the async loading. Is there a way to fix this properly ?

wintry quarry
wintry quarry
half notch
#

Oh okay, i think i'm gonna do the destroy solution one, thanks for your answer (:

delicate laurel
#

And I get infinite erro

#

Unity 6.2

wintry quarry
# delicate laurel And I get infinite erro

Change:

        [System.NonSerialized]
        public HashSet<T> value;
    
        [SerializeField]
        private List<T> _serializedList; ```
to:
```cs
        [System.NonSerialized]
        public HashSet<T> value = new();
    
        [SerializeField]
        private List<T> _serializedList = new(); ```
half notch
slender nymph
#

make sure you have the right using directive

delicate laurel
half notch
#

Thanks guys

wintry quarry
delicate laurel
# wintry quarry are you using any plugins?

Here my manifest except com.unity:

{
  "dependencies": {
    "com.annulusgames.alchemy": "https://github.com/annulusgames/Alchemy.git?path=/Alchemy/Assets/Alchemy",
    "com.codewriter.triinspector": "https://github.com/codewriter-packages/Tri-Inspector.git",
    "com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
    "com.scellecs.morpeh": "https://github.com/scellecs/morpeh.git?path=Scellecs.Morpeh",
  }
}
#

On no

#

There is additional

wintry quarry
delicate laurel
#

I will try to create default progect on stable Unity 6.0

delicate laurel
#

Should I write in unity community?

valid violet
#

value is reserved word maybe you should rename it?

delicate laurel
valid violet
#

even your IDE showing it is reserved word

delicate laurel
#

I mean, it still doesn't work

slender nymph
#

it is a keyword in certain contexts, but can otherwise be used as an identifier

delicate laurel
#

also name

slender nymph
#

i mean, name isn't even a keyword

delicate laurel
#

So what should I do

valid violet
#

ye you can name variable as public or private it will also be fine

slender nymph
#

incorrect, public and private are both reserved

valid violet
#

so why value is same color as private and public?

wintry quarry
#

value is a special keyword that is only a keyword inside a setter in a property

slender nymph
valid violet
#

What will you do if you have property that change the value inside the getter or setter?

#

what value will that property change:?

slender nymph
#

why are you so hung up on this one thing that isn't even related to their issue?

valid violet
#

because u talking it is good practicing to use the value as field name

slender nymph
#

nobody said anything about it being good practice, i simply said it wasn't an issue

valid violet
#

"it's perfectly fine as an identifier."

polar acorn
#

It is

slender nymph
#

because it is. that has nothing to do with whether it is good practice or not, that is simply stating the fact that it is a valid identifier

valid violet
#

absolutely perfectly fine evne if you have properties in the same class

polar acorn
# valid violet absolutely perfectly fine evne if you have properties in the same class

In those cases it's no different than having a field named public int bingus = 7 and making a function with an int bingus = 4. You can have the same name in a smaller scope in C#, that's a thing that's perfectly allowed to do. No one is saying that this is good practice, just that it's irrelevant to the problem at hand, and is not actually a reserved keyword

slender nymph
delicate laurel
#

Here we go

delicate laurel
valid violet
#

what elements you try to add to list?

teal viper
teal viper
#

Well, I sure don't see it

valid violet
#

If your elements is equal heshset will only add one Unique element the copies will be ignored

polar acorn
delicate laurel
valid violet
#

why don't you just use List inside scriptable object do you really need to serialize HashSet just to be able to use it in scriptable object?

#

the difference between HashSet and List is not so big. You can just use Distinct() .

#

or do not add element if your list already contain it

delicate laurel
# valid violet why don't you just use List inside scriptable object do you really need to seria...

Because I will need translate each list inside SO to the hashset. I use SO for configs, so each SO means "config SO". Code should work with some class instead of SO. The only difference between this class and SO is that it translates list to HashSet. If my code works with translating SO to class, I need to create for each SO additional class, even if SO doesn't have HashSet (othervise code will be ambiguous whether I use original SO or translation class). It is iritaing

delicate laurel
valid violet
#

Scriptabl objects is data file and it will store Lists or Arrays because it cannot stroe hashset it can convert from list to HashSet when you grab data from SO. So why don't you just store List or Array in your SO and conver these List or Array to HashSet on getting data from SO.

#

You will convert Array/List to hashset any way.

polar acorn
valid violet
#

SO CANNOT STORE HASHSET IT IT IS STORE LIST OR ARRAY NOT HASHET THERE IS NO SUCH OPTION

polar acorn
#

The solution here seems to be what was suggested on the forums - a custom inspector

#

The code for making the serializable hashset seems to be working

#

or it wouldn't be in the inspector at all

valid violet
#

unity official version how to store dictionary in SO is stroring two arrays and binding to each other.

polar acorn
#

And what does that have to do with the issue at hand

delicate laurel
# valid violet Scriptabl objects is data file and it will store Lists or Arrays because it cann...

I need my config in runtime. Each time converting list to hashset when I access it? I mean, I create entities based on config. For example I need 100 entities. I will 100 times converting list to hashset? It would be better to create translated class and get hashset directly from it
Game reads config SO -> translates to class with hashset -> other classes read class with hashset instead of config SO
But to create this middle class, I need to create additional class at least for each SO with hashset. I don't like it

valid violet
#

Use jsone instead of SO

delicate laurel
polar acorn
valid violet
#

You endup in converting list form Scriptable object to Hashset there is no other way

delicate laurel
#

Question is "where"

#

In middle class or in deserialization

valid violet
#

I don't think it is waged operation to convert LIst to hashset each time u want to grab hashset form your scriptable object you can just add one method to SO: public HashSet<T> GetHashset(){return new HashSet<T>(MyList)};

polar acorn
#

Better to just serialize the hash set directly so the way the data is used is the same as how the data is stored

valid violet
#

sorry but if you runtime changing your scriptable object that is not created to change data dynamicly but just to store ReadOnly Data than you make something wrong

delicate laurel
#

If there hashset inside baked enity, you will skip cloning

valid violet
#

I see your problem you wanna change the data stored in SO runtime?

delicate laurel
polar acorn
delicate laurel
#

Why unity...

valid violet
#

I do not suggest create entity per read you have One Singletone for example where is all of your SO strored and you just call YourSingletone.Instance.Config1.GetNeededHashset(). wIll it create new entity of SO????????

delicate laurel
#

So thank you guys. I am going to sleep

valid violet
#

yes you can even just inside your DI take SO and store all needed fields as new hashsets and when your code need acess hashet you point it to that hashset

lilac hornet
#

how did u guys learn to code?

delicate laurel
polar acorn
lilac hornet
#

how tho

rich adder
lilac hornet
polar acorn
#

Making stuff

rich adder
lilac hornet
#

i wasnt askin like that i thought u had a practice routine😭

rich adder
#

naaa I'm not organized like that lol

sour fulcrum
delicate laurel
sour fulcrum
#

test first tho!

delicate laurel
#

I am not going to sleep this night

delicate laurel
sour fulcrum
#

yay

valid violet
#

gz

weak trail
#

Hello i need help with something important so im currently going to start my project wich is a copy of clash royale basically and im really confused about if is 2D or 3D? I dont know wich template to use im so confused

#

I know the troops are 3D ( i think) but i really dont know how to set up the camera like this and if to use 2d or 3d (im a beginner btw)

valid violet
#

Select the unit in scene and check if it is Mesh or Sprite

frosty hound
# weak trail

3D with an orthographic camera to remove perspective.

weak trail
frosty hound
#

Okay, then it's 2D with pre-rendered sprites with an orthographic camera. 🤷‍♂️

weak trail
frosty hound
#

It really doesn't make a difference in how you approach this. The logic for the gameplay and such is largely the same.

weak trail
frosty hound
#

You just need to decide if you want to make sprites out of 3D models (outside of Unity), or just use them directly.

weak trail
#

i know i need to set up the perspective

frosty hound
#

It can be done with an orthographic camera, yeah.

valid violet
#

Load the scene in Hierarchy find the unit and check if it contains sprite renderer or Mesh filter if Meshfilter = 3d if sprite renderer = 2d

frank rover
#

Can someone help me I'm new
I don't know how to put a pictue in discord.

radiant voidBOT
# frosty hound !ask a question

: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

frank rover
#

It says that cardx1y1 is not set to an object.

north kiln
#

2D arrays of any kind are not serializable

#

so you never initialize it

frank rover
#

ok

north kiln
#

and each entry of the jagged array would also need to be initialized, not just the outer array

frank rover
#

what do you mean

north kiln
languid pagoda
north kiln
#

it's jagged, not 2D

#

so no

languid pagoda
#

oh ok

#

ah right in c# its [,] for 2d arrays

north kiln
#

(and jagged arrays are generally better than 2D arrays, so don't use 2D arrays)

languid pagoda
#

so essentially this is the same as Dictionary<int, List<Int>>() ?

north kiln
#

It's a structure of structures, yes

languid pagoda
#

Sorry Nicky saw something new didn't mean to hijack your question

north kiln
#

And I wouldn't declare the array as the example does, if you want it to be square just initialize the first axis and then use a for and initialize the inner arrays of the other axis to the same length

#
var jaggedArr = new GameObject[3][];
for (var i = 0; i < 3; i++)
  jaggedArr[i] = new GameObject[3];

(untested, written in discord)

languid pagoda
#

I could be way off base because I am not sure what you're doing but I really feel like there is a better way to handle whatever you're trying to do Nicky and do not think this will lead to very readable code. Does the prefabs have to be assigned to this jagged array?

north kiln
#

It certainly does look like a rather wild piece of code, very manual and literal way of going about something

languid pagoda
#

I guess if it works it works.

#

I am trying to make a get in car system and I cannot really figure out a way to determine which door to play the open animation on based on what "entrancePoint" the player is at. I know one option would be I could just assign references in the inspector but honestly not possible. I am using an editor script to create them based on information provided in a ScriptableWizzard so the references will not persist in the prefab it outputs.

#

Right now you can just assign a vector3 in the cars local space that represents the place the player should stand when they open the door. I thought about having a naming convention but I hate using Find to find objects by name. Any other options?

wintry panther
#

I'm not sure if my pixel art game is blurry or not lol. im bad at noticing things like that. My friend said the art looked blurry when moving. Is there a way to make the pixel art less blurry when moving?

knotty inlet
#

I'm having some performance problems caused by a 2d physics material for some reason? I'm making a pixel art platformer using a composite collider for my tileset, and of course trying to jump on the wall causes the player to stick to it since the player still has friction, but as soon as I add a frictionless material the fps tanks. This is really weird to me as I've used 2d physics materials in plenty of other projects (on the same computer), yet none of them have dropped my fps that much. I don't know if it has to do with interference with specific code, or my computer just sucks, but if anyone has any ideas thank you!

wintry quarry
lament scarab
#

Will Unity only 'package' used assets at Runtime?

I'm wondering if I should avoid over-importing assets, only taking the models that I'm using, or if it's okay to keep 'extras' in the assets.

teal viper
lament scarab
#

I am not familiar with either of those (yet!), so I will assume I am safe for now. Thank you!

knotty inlet
pallid heron
#

What's causing my text assets to keep doing this? My bitmap.assets just keep changing themselves without me touching them.

rocky wyvern
#

dynamic font mode changes shit when you view the font

rocky wyvern
#

just keep it on dynamic and deal with pushing stuff like that imo

#

static doesnt work with special unicode characters for example I think

#

unfortunate downside of tmp

pallid heron
#

Hrm. I really don't love pushing a file back and forth and having it constantly show up in my working tree. But I guess I can't ignore it. That's lame.

north kiln
#

It does suck, TMP's design is silly there, it really should operate like any other asset and have that stuff saved in the Library, but it doesn't

faint sluice
#

Hello, I have 2 camera in my scene, 1 for player and 1 for map, my map camera output's the scene world to a render texture

I don't want my map camera be affected by occlusion culling, how do I achieve that?

#

I have "use occlusion" disabled on my map camera, but it still does occlusion culling anyway (or rather does not show full map) 🙁

serene adder
frozen aurora
#

Hi everyone i want to devlop a game , it was my first game. so suggest me a concept which type of game i can devlop. (Need ideas for project)

naive pawn
#

snake, breakout, pong, flappy bird, minesweeper

frozen aurora
#

somthing differrent?

eternal needle
# frozen aurora somthing differrent?

this is a coding channel. also people are going to suggest things to help you learn for your first game, that has more resources to learn from since stuff like flappy bird have lots of tutorials.
its up to you to come up with a creative idea otherwise

silk night
serene adder
silk night
#

mhh then that should not be a problem

Can you show your movement code?

serene adder
naive pawn
radiant voidBOT
cyan gulch
#

Who has it? Bitchat

naive pawn
cyan gulch
#

Who has it downloaded bitchat

rocky canyon
#

tf u talkin about?

naive pawn
#

is this some weird scam

naive pawn
cyan gulch
#

Doesn't matter

silent escarp
naive pawn
#

there is no off-topic chat here

naive pawn
rocky canyon
#

anyone got giftcards 🤪

nimble apex
#

can you serialize a struct and make it visible on inspector?

#

assuming all the fields inside a struct are primitive type or enum

#

oh u can

#

nice

naive pawn
naive pawn
rocky canyon
#

as long as u include ur DOB and SS number

polar dust
#

(bitchat is a very unfortunate name)

strange cliff
#

yo guys how do i make a button that writes to the console i made a clickevent but it aint workin

faint sluice
#

Some code snippet might help recognise the issue

hot wadi
#

I've been trying to figure how this code works (online demo from asset store).
This is part of the Update() function of the code that controls the character's movement. It updates the vertical position of the character only.
What I don't understand is the purpose of the !AudioListener.pause condition.
Does anyone have any idea?

{
    if (trackManager.isMoving)
    {
        // Same as with the sliding, we want a fixed jump LENGTH not fixed jump TIME. Also, just as with sliding,
        // we slightly modify length with speed to make it more playable.
        float correctJumpLength = jumpLength * (1.0f + trackManager.speedRatio);
        float ratio = (trackManager.worldDistance - m_JumpStart) / correctJumpLength;
        if (ratio >= 1.0f)
        {
            m_Jumping = false;
            character.animator.SetBool(s_JumpingHash, false);
        }
        else
        {
            verticalTargetPosition.y = Mathf.Sin(ratio * Mathf.PI) * jumpHeight;
        }
    }
    else if(!AudioListener.pause)//use AudioListener.pause as it is an easily accessible singleton & it is set when the app is in pause too
    {
        verticalTargetPosition.y = Mathf.MoveTowards (verticalTargetPosition.y, 0, k_GroundingSpeed * Time.deltaTime);
        if (Mathf.Approximately(verticalTargetPosition.y, 0f))
        {
            character.animator.SetBool(s_JumpingHash, false);
            m_Jumping = false;
        }
    }
}

characterCollider.transform.localPosition = Vector3.MoveTowards(characterCollider.transform.localPosition, verticalTargetPosition, laneChangeSpeed * Time.deltaTime);```
wintry quarry
#

They're saying "if the game isn't paused, move the character"

#

I wouldn't really say it's good practice to do this, but they're doing it because it's convenient

faint sluice
wintry quarry
#

Also this isn't a code question

faint sluice
hot wadi
silent escarp
rocky canyon
#

i removed and re-added the script and it still showing the wrong name..

#

weird.. never had that happen before.. even after refreshing... (i guess i'll need to delete the meta for the script)

#

hmm weird

charred monolith
eager elm
faint sluice
faint sluice
hexed terrace
hot wadi
fast helm
silent escarp
#

My guess is the center of the player is below the player, that's why when you scale down your character to crouch you gets underground and when you uncrouch you teleport upward

fast helm
silent escarp
fast helm
silent escarp
#

take a screenshot

fast helm
#

it was now underground

polar acorn
silent escarp
fast helm
#

this stuff is so confusing ;-;
how can i recenter that?

silent escarp
#

then move it up and down or whatever you want

fast helm
rocky canyon
#

is there a way to make a global script templates folder.. that u know, loads up for every editor version,

  • like i know you can make presets(color swatches and whanot), layouts via the appdata folder
    but i think i can only find/exists the script template folder per unity install
slender nymph
#

create the templates for your IDE instead of the editor

rocky canyon
#

ohh thats smart 👍

silent escarp
#

How do I disable all shadows through script for performance boost I need it for in-game graphics setting

rich adder
merry mica
#

hellooooooooooo

#

i want to make a 2d fighting game

#

but im completely new to unity

#

i seek guidance

polar acorn
#

!learn

radiant voidBOT
merry mica
#

tysm

unique moss
#

Hi, I have an issue but idk where to ask for assistance

#

It's an issue I couldn't find a solution for online, I am also relatively new to Unity

polar acorn
unique moss
#

I think I've put in the work necessary to finally give up and just ask

polar acorn
#

So.... ask

unique moss
#

FBX Exporter isn't working, no matter what I do, I keep getting an error
''NotImplementedException: The method or operation is not implemented.''
I can't swap between Blender and Unity due to this

#

I've reinstalled, downgraded, etc

#

Nothing

polar acorn
unique moss
#

Idk, it just said something isn't implement but won't actually specify what

#

It also crashed my machine at one point

polar acorn
tender mirage
#

i've always had trouble with running a another function inside of a coroutine and i'm curious about why StartStage(); code never runs. do functions not work here?

public IEnumerator PreStage()
{
    //Scene prestage
    Scene = Scenes[2];

    //Hide UpgradeUI
    UpgradeUI.SetActive(false);

    //Dísable collision
    Transform[] MainCameraColliders = MainCamera.gameObject.GetComponentsInChildren<Transform>();
    
    foreach (Transform MainCameraCollider in MainCameraColliders)
    {
        //safely check
        if (!MainCameraCollider.CompareTag("MainCamera"))
        {
            BoxCollider2D CameraBoxCollider2D = MainCameraCollider.GetComponent<BoxCollider2D>();

            CameraBoxCollider2D.enabled = false;
        }
        
    }
    
    // Move Camera Up
    float Elapsed = 0;
    float Duration = 2f;

    Vector3 StartPosition = new Vector3(0, 0, -10);
    Vector3 TargetPosition = new Vector3(0, 12, -10);

    while (Elapsed < Duration)
    {
        Elapsed += Time.deltaTime;

        float Progress = Elapsed / Duration;

        MainCamera.transform.position = Vector3.Lerp(StartPosition, TargetPosition, Progress);

        yield return null;
    }


    yield return new WaitForSeconds(3);

    //Move Camera down
    float ExitElapsed = 0;
    float ExitDuration = 2f;

    while (ExitElapsed < ExitDuration)
    {
        ExitElapsed += Time.deltaTime;

        float ExitProgress = ExitElapsed / ExitDuration;

        MainCamera.transform.position = Vector3.Lerp(TargetPosition, StartPosition, ExitProgress);

        yield return null;
    }

    //enable collision
    foreach (Transform MainCameraCollider in MainCameraColliders)
    {
        //safely check
        if (!MainCameraCollider.CompareTag("MainCamera"))
        {
            BoxCollider2D CameraBoxCollider2D = MainCameraCollider.GetComponent<BoxCollider2D>();

            CameraBoxCollider2D.enabled = true;
        }

    }


    StartStage();
    yield return null;
}
slender nymph
#

functions obviously do work, on account of all of the others you call working. make sure the code actually reaches that point though

#

also the yield return null at the end is pretty much pointless

tender mirage
#

it should. all the camera movement and such are working properly.

slender nymph
#

verify that is it, don't make assumptions

polar acorn
tender mirage
unique moss
#

Error encountered importing asset at path 'Packages/com.autodesk.fbx/Editor/Plugins/UnityFbxSdkNative.bundle', with GUID '0a29d269aa30eda4cb23ebe41b124f23'
Note: If this Assert is triggered, it may be necessary to add a new extension to the list of skippedPaths in Modules/AssetDatabase/Editor/Public/PreviewImporter.cpp

tender mirage
polar acorn
ornate kraken
#

I have cs horizontalInput = Input.GetAxis("Horizontal"); declared and the script applied to the player. It has worked for me in other exercises but when I apply this and test it out in Game mode pressing left/right or A/D does not change the values from 0 to either positive or negative. Not sure what I did wrong...

polar acorn
unique moss
slender nymph
#

also show where the code is being run from

ornate kraken
slender nymph
#

6.1 changed the default input handling to the new system so older versions that Input class still works by default, 6.1+ you have to change a setting if you want to use it

ornate kraken
#

What is input handler is recommended to use for new projects? I'm just going through Unity Learn at he moment and doing the basic tutorials. Only like 2 days into learning this stuff.

polar acorn
unique moss
#

Should Unity be shutdown before I deleted it?

slender nymph
polar acorn
#

And if you've ever tried to implement gamepads or controller remapping on the original input manager you'll see why they saw fit to change it

ornate kraken
#

I guess I'll go back to whatever version this was written for because I don't know how to resolve it.

slender nymph
#

you can just change that setting mentioned in the link i sent to make it work in the version you are using

ornate kraken
#

Yea I changed it to "Both" in the Project Settings. Which I think I did in the previous tutorial.

#

Figure this input system is something I will learn more about later and is noise for now...

unique moss
#

I should delete that folder in it's entirety?

polar acorn
#

You can just delete the contents of the cache folder, anything still needed will be re-downloaded as necessary

unique moss
#

Alright done

#

I'm gonna start up Unity again

#

Still getting a NonImplementException

polar acorn
unique moss
#

Idk, I barely understand Unity, this isn't the engine I usually work with

polar acorn
unique moss
#

It's giving me directories

#

7 files in the same directory

polar acorn
unique moss
#

Is that the stack trace?

grand snow
#

Ha well thats not good

unique moss
#

The thing I sent?

grand snow
#

gltf exporter does work so maybe thats worth trying?
Yea its clear that something in the package was not impemented 😐

unique moss
#

God damn it Unity

grand snow
#

any updates for the package?

unique moss
#

There's an old version and a new version

#

I keep swapping between them

bitter bobcat
#

Hey folks, Im having a problem with my detection system

unique moss
#

But there's no like, actual ''Hey there's an update available''

grand snow
#

may be due to your editor version

hexed terrace
#

I used the fbx exporter a couple months ago, in 6.0.47ish without any issues.

bitter bobcat
#

Im having this thing where it only works if I press the e button from a specific side of the item its supposed to detect

unique moss
#

I'm on 6.2

bitter bobcat
#

catch

slender nymph
#

!code

unique moss
# unique moss I'm on 6.2

Slowly but surely taking back everything I've said about Source Engine all thanks to this exporter shit

radiant voidBOT
slender nymph
#

also you need to get vs code configured 👇

#

!vscode

radiant voidBOT
bitter bobcat
#

alright, thanks, can you help me here or do you need more stuff ?

unique moss
#

I haven't tried that low

#

I am low on storage so I don't wanna download so many versions

hexed terrace
#

I would just go on the latest 6.0, I'm on .47 because there's no need to update every week and I haven't needed any feature/ bug fix

#

It might work.. it might not. We're guessing here, we don't know the cause

unique moss
#

What's the most annoying thing you've had to deal with on Unity, since I'm currently dealing with this

#

Atm, this exporter stuff is the most annoying

#

Anway, I'm installing a 6.0 build

#

I've used many engines and they all do have their moments, but Unity is currently having moments ever since I started trying to use it

hexed terrace
#

which was when..?

unique moss
#

I got it a few years ago

#

I wanted to develop for the Wii U

#

Then Nintendo closed the program

hexed terrace
#

having it and using it aren't the same thing - if it was, I've played all 400+ games in my Steam account!

unique moss
#

I've messed with it on and off since, just not my main engine so I don't use it daily

slender nymph
unique moss
#

My main engine is Source

#

My main goals for Unity is developing for like, fairly old platforms, like the Wii U, just ever since Nintendo shut that down I can't really do anything there, but I also would like to make stuff for older IOS devices

limber turtle
#

how should i make pathfinding in my 2d platformer game? there are some enemies meant to be stupid that just run towards the player when in detection range, but some smarter enemies need to get into line of sight with the player to hit their shots but i'm not sure how to do that. some enemies fly but some others will be on the ground

unique moss
slender nymph
bitter bobcat
#

Mission accomplished, I downloaded the extension

slender nymph
limber turtle
limber turtle
#

i may need a little more help with pathfinding algorithms

#

i looked up aron granberg on the asset store but could only find the paid assets

#

how difficult are they to make from scratch? if it's too much of a hassle i'll probably find some implementation of it online but it may be nice to learn

hexed terrace
#

depends on your skill, it's also time consuming

limber turtle
#

ah

#

well i'm still not particularly good at this and i'd prefer to spend more of my time on other things in the project

#

do you have any resources i could use?

hexed terrace
#

I just use Aaron Granbergs A* solution

limber turtle
#

i can't find the free version on the asset store

#

i may not be looking hard enough

hexed terrace
#

there isn't a free version, afaik

limber turtle
#

oh

hexed terrace
#

A* is a standard path finding algorythm.
Aaron's asset is an implementation of that.

limber turtle
limber turtle
slender nymph
limber turtle
#

oh thank you

hexed terrace
#

there you go - I've only ever looked for it on the store

limber turtle
#

i'll import that into my project and see what to do from there

#

is there a guide i will need for it, or any other assets i would need for support?

slender nymph
#

there's documentation and stuff on his site as well

drowsy flare
#

I added a particle system with a particle system force field.
In the editor the particles are spinning around and looks really good. When running the game, they just move like a pixel or so a bit randomly. Any suggestions?

drowsy flare
cerulean bear
polar acorn
rich adder
teal viper
#

It's a quiz I guess.

cerulean bear
polar dust
#

!code

radiant voidBOT
polar dust
#

You must follow this for posting code

rich adder
fading marten
#

Anyone think they can help me? I'm trying to use an input actions editor and I can't get 2D Vector Composite to show up

rich adder
ember tangle
# limber turtle do you have any resources i could use?

📌 Download the project files from this video: https://tmg.dev/UnityFlowField 📌
📹 Intro to Flow Fields Video: https://youtu.be/zr6ObNVgytk 📹
👇 See below for time stamps and C# scripts 👇

📃 Individual Scripts 📃
Cell.cs - https://pastebin.com/nj7fhkTM
FlowField.cs - https://pastebin.com/vbjysW5z
GridController.cs - https://p...

▶ Play video
tacit prism
#

wondering why my movement script is not compatible with my jump scirpt. I assume its because of the line "rb.linearVelocity = moveDir.normalized * plyMyspd" since it directly affects the same rb.velocity that the jump script is using.

#

would like to know whats causing the issue, havent had much time as of late to work on learning this stuff due to work

rich adder
tacit prism
#

i dont know how to circumvent it though :(

#

while dabbling i learned i cant just make another rb variable, just does nothing if i assign the same rigidbody to both

rich adder
#

don't overwrite the y in the move script

tacit prism
#

i completely forgot i did that, its been about 2 weeks

wintry panther
#

im following CodeMonkey's Kitchen Chaos tutorial and he said to use the 3D (URP) template but im using unity 6.2 and there's no such option

#

what template should I use?

#

should i use Universal 3D or 3D (Built-In Render Pipeline)?

teal viper
wintry panther
north beacon
#

Hello, I am very new to Unity, and one of my classes is a introductory class into game scripting. I would like to ask for help regarding an assignment but first, is this the appropriate place?

north beacon
#

Apologies, I'll ask away!

My assignment is to create a directional pad with four arrow keys that would move the player character to the corresponding direction when clicked. I think I've managed to set up the script enabling the click interaction, but when I press play and click the arrow key, the arrow key moves instead.

I am aware that I need an event that designates the player character as the object that needs to be moved, but I don't exactly know how to do that, or know the appropriate script relating to the matter

rich adder
potent wren
#

learn asm for your first language

north beacon
rich adder
north beacon
#

Thanks, I'll take a look at the links.
If you don't hear from me, then consider my issue solved unless I come back

haughty lion
#

Hi guys! I'm new to Unity

I can't understand here a little bit, why when my object goes through the ray no reaction occurs

narrow lodge
#

hi im new in unity can anyone tell me which course i should chose

delicate laurel
#

Is there way to make SO work with Unity.Serialization?

teal viper
teal viper
teal viper
# haughty lion

Add some logs in that inner if block and see if they print.

haughty lion
naive pawn
#

!ide

radiant voidBOT
haughty lion
naive pawn
#

it helps out a lot

haughty lion
#

Okay

naive pawn
#

it's thus a requirement to get help here

haughty lion
#

Everything must be ok, Collider2D is both on the objects, tried to do without one connected to NPC, still doesn't see the collider

teal viper
haughty lion
#

But if I discard "AttackRay.collider.gameObject == Player", this works

haughty lion
teal viper
haughty lion
#

But I'm trying to make it work so NPC wouldn't see its collider itself

teal viper
#

Or at least not the same object that has a collider/rb attached.

haughty lion
narrow lodge
narrow lodge
teal viper
haughty lion
#

Here it is

delicate laurel
# teal viper Might want to provide some context. Work with it in what way? What are your tryi...

There is still question with serializing HashSet. I don't want wrapper with public propertiy HashSet<T> HashSet and private List<T> _serializationLIst. I want to work with field directly, I mean

public class SomeConfig : ScripatableObject
{
   public SomeType<Tag> Tags; //serialize it as List, but in runtime returns HashSet
}

Withoud creatig additional properties something like

public class SomeConfig : ScripatableObject
{
   [SerializeField]
   private List<T> _serializedData;
   [NonSerialized]
   public HashSet<T> Tags => GetHashSet(_serializedData) //one time creates HashSet(_serializedData) and then return its instance. It could be stored in attribute kinda [ToHashSet]
}

I don't want write additional code inside SO, I want just write property, attribute and work with it, so this is perfect variant

[SomeAttributeForClass] //if needed
public class SomeConfig : ScripatableObject
{
   [SomeAttribute]
   public SomeType<Tag> Tags; //serialize it as List, but in runtime returns HashSet
}
teal viper
narrow lodge
delicate laurel
#

SO by default works with UnityEngine.Serialization. It only provides ISerializationCallbackReceiver, but I can't inherit HashSet with it, only use wrapper

teal viper
teal viper
narrow lodge
teal viper
delicate laurel
teal viper
# haughty lion

When you get a hit, log the collider.gameobject name and reference. And the same for Player.

haughty lion
#

Like Debug.Log?

teal viper
#

Yes

haughty lion
#

Like this?

teal viper
teal viper
# haughty lion Like this?

No. Log the actual object names, and pass the references ass the second parameter so that you can get redirected to the object in the editor. Check the debug log documentation for more details.

haughty lion
#

Ohh

#

Okay, thanks mate

acoustic trench
radiant voidBOT
polar dust
#

You must post code this way

teal pebble
#

Hi there ! I'm having trouble with a ninepatch sprite : i did the slice correctly and everything is going smooth in editor, but in build (android) the sprite seems stretch weirdly (screenshot incoming). Anyone has any ideas of the little thing i might be missing...? build settings maybe?

#

you can see the top and bot slices are going well, but not the middle. And again, in unity, everything is ok :

acoustic trench
#

is that right

teal pebble
limber turtle
#

aron granberg's pathfinding project doesn't support platformers apparently

#

i'm reading the docs

#

is there something i can do or will i need to find my own solution?

#

i was told to use his a* solution but i don't think i can anymore

#

actually i may not even need complex pathfinding, just something that lets an object find the player and not shoot/run into walls

tender mirage
#

Does anyone know why my camera wont move up? am i doing something wrong with smoothdamp?

// Move Camera Up
float Elapsed = 0;
float Duration = 1f;

Vector3 StartPosition = new Vector3(0, 0, -10);
Vector3 TargetPosition = new Vector3(0, 12, -10);

while (Elapsed < Duration)
{
    Elapsed += Time.deltaTime;

    MainCamera.transform.position = Vector3.SmoothDamp(StartPosition, TargetPosition, ref Velocity, Duration);

    print(Velocity);

    yield return null;
}
thorn urchin
#

IEnumerator MoveCameraUp()
{
float Elapsed = 0f;
float Duration = 1f;

Vector3 TargetPosition = new Vector3(0, 12, -10);
Vector3 Velocity = Vector3.zero;

while (Elapsed < Duration)
{
    Elapsed += Time.deltaTime;

    MainCamera.transform.position = Vector3.SmoothDamp(MainCamera.transform.position, TargetPosition, ref Velocity, Duration);

    print(Velocity);

    yield return null;
}

// Assure que la position finale est bien appliquée à la fin
MainCamera.transform.position = TargetPosition;

}

#

// Ensure the final position is set
MainCamera.transform.position = TargetPosition;
}

#

StartPosition never changes inside the loop — it’s always (0, 0, -10)

tender mirage
#

OH! is that how smoothdamp works? i've been using lerp mainly.

thorn urchin
#

Lerp (Linear Interpolation):
It transitions between point A and point B by moving a fixed fraction each frame.
Simple to use, but it can feel a bit mechanical or abrupt if you don’t manage the timing parameter well.

SmoothDamp:
It creates smooth movement with a damping effect — it simulates a spring-damper system, so the motion starts quickly and then naturally slows down as it approaches the target.
Additionally, it uses a velocity variable passed by reference to keep track of the current speed, making the transition very smooth.

tender mirage
#

I see, thank you so much, i understand it better now.

rugged kestrel
#

why is this happening

tender mirage
# rugged kestrel why is this happening

You forgot to get the transform from the object first
to modify the position component of a gameobject, you gotta first get their Transform property shown on the screenshot right here

Gunberrel.transform.rotation
Gunbarrel.transform.eulerAngles
tender mirage
#

it is? that's weird, you might have to show more then

languid pagoda
#

So you know how in GTA when you press enter vehicle it walks you close to the vehicle then plays the get in car animation? Are they just using pathfinding to move the player model or do you think they're doing something else?

frosty hound
# rugged kestrel here

You cannot modify a single axis, you have to construct a new Vector3 and assign it back.

tender mirage
#

oh right, you can't directly modify values like that. you gotta first chop them up into sections

#

and reapply them

#

same goes with things like color as well

frosty hound
rugged kestrel
half notch
#

Hey, i'm writing this here because i didn't see a shader graph channel (i'm sorry if there's one), but i would like to know if it's possible to link a texture as a spritesheet to a shader graph and have some formula with the UVs, to appear only one sprite of the spritesheet in my base color output

languid pagoda
frosty hound
frosty hound
languid pagoda
frosty hound
#

Personally I'd use the spline, it keeps it local.

languid pagoda
frosty hound
#

Yeah, but at that point you're going to then have to consider a myriad of other edge cases. Even AAA games just accept some clipping/shortcuts if it means the player can actually do the thing they need.

languid pagoda
gloomy void
#

I'm trying to get started with the Unity IAP package but the the docs seem to be kind of useless. There is virtually no example code anywhere and the concepts are explained at such a high level that it's not particularly useful. The only "tutorial" is "Define your products" but then what?

https://docs.unity.com/ugs/en-us/manual/iap/manual/define-your-products

Can anyone point me to a good resource that describes the full flow of

  • defining products
  • visualizing them in some UI
  • making a purchase
    ?
frosty hound
languid pagoda
#

I guess what I could do is have a spline and at anypoint while the player is pathfinding to an entrance if the players in the same spot for 2 or 3 frames I could then change the entrance point to the other side of the vehicle

languid pagoda
#

sometimes it works sometimes it doesnt

gloomy void
#

yeah ChatGPT and Claude both are giving me deprecated code. But I did not try specifically linking the docs 🤔

#

I can kind of piece together some of the flow using the v5 upgrade guide which actually has code

polar acorn
#

You could just... read the docs

#

The docs you're already providing

merry mica
#

if i wanted to make a 2d game do you recommend unity or some other engine like game maker studio 2

hexed terrace
merry mica
#

okay

limber turtle
#

i don't know how to apply aron granberg's pathfinding package to my 2d platformer, would it be best if i just use it on the flying enemies and use more basic logic for grounded enemies? i still don't really know how i'm going to be mapping out my levels because i want to do it on a room-by-room basis since i plan on making a procedurally generated roguelike

#

i suppose i only really need complex movement patterns for more dangerous enemies. i may need some help for how to properly make flying shooter enemy behaviours

#

right now the one i have only moves left or right based on how far/close the player is

#

too close, moves away. too far, moves closer

#

nothing else

hexed terrace
#

you can bake the navmesh (I forget what the correct term is for Aaron's A*) at runtime, so proceduraly gen your level then bake the nav area.. that's not a problem

limber turtle
#

oh i may not have explained it right

#

you know how tboi has preset rooms and then randomises a map using those rooms at random?

#

i was kinda thinking that but platformer