#💻┃code-beginner
1 messages · Page 740 of 1
yes. but thats not the case since it still levitates even before i try to grapple
if not that would be helpful
And your rigid body has gravity enabled and a decent mass on the object?
i dont have a rigid body
that was my whole point with why everything is so bugy
and im trying to find a work around
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
i dont have a rigid body on my character though
Yes so add one, the rigidbody is a quick way to calculate physics outside of doing it yourself
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
Unless you want to rewrite physics irl... I wouldn't lol
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?
In reality youd want an else if there. To answer your quesiton though, you can just return
Or just else since bools can only be true or false
void Update()
{
b = !b;
}```
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?
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator
May help
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?
You have unitypackages ignored, but not the meta files for them. I would just remove unitypackage from gitignore so everyone has these packages. A bit unclear to me why unitypackages are in github's Unity gitignore template.
Isn't that the point of the package lock? It just downloads the appropriate packages on your machine if you don't have them?
I've edited and committed one thing in the Packages folder, but it wasn't a .unitypackage file
For some types of packages, yes, but package manager is not automatically tracking files in assets. Unitypackage files are more like zip files and aren't inherently related to the package manager.
So what's the point of unignoring unitypackages instead of just ignoring .unitypackage.metas?
neither of them seem useful to keep around
They managed to triage it and made a dedicated issue about this
You can check its status on a link above
right but i don't think i want to be the guy messing with gameplay systems, scripting etc
🤝
Thanks for updating me on the matter 👍
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?
thanks
Asset store in general is a good source for inspiration on how to solve things + free/cheap assets
!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**
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
aren't those the same thing
but you should generally keep stuff where they're used
ok thx
why does it say > isnt a valid expression
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;```
you need a value on both sides of the comparison
ohh i missed the i, thank you
your condition right now is just, "less than pages.Length"
that doesn't make sense. what is less than pages.Length?
yeah i got it, sorry about that
i think i will remove the safeguard first
you haven't given any info on how categoryIndex is initialized or used
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
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 >
well, with a tutorial, you see code that works, and if it doesn't explain how/why it works, you could just research that (or perhaps find a different creator if their tutorials are consistently lackluster)
categoryIndex is just a global variable
private int categoryIndex;```
there's a character controller tutorial which goes in depth into everything it's doing and why really well by Sebastian Lague
that might not be what you want though
that isn't global, c# doesn't have globals
and that's not close to a global either, that's an instance member
its a member then
and when you call FilterCategory, you want to show the page associated with the index passed?
ill take a look at it thanks.
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
yes, they are numbers with names
then i dont need integer
you generally probably shouldn't though unless the enum is specifically made for it
enums are literally just ints in c# in like every way that matters yeah
exactly, id much prefer reading thru documentation for like specific commands but im haing a hard time navigating the unity documentation
(technically not, they're integrals, not necessarily int, but if the specific type isn't specified, it defaults to int - you can make enums that are backed by different integral types)
also googling how to do a specific thing is often helpful, since a lot of people will likely have the same question
Can anyone help me identifying the issue in untracked memory growth overtime ?
oh neat
well, you'll need a basis of what to look for/where to look
tutorials are a pretty good way of getting that
there's also the unity learn pathways
are those like tutorials made by unity? like their website? i think i remember looking at something simmilar long ago when i first tried picking it up
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
hold on
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
i think i need to rewrite the logic first
im not complaining btw, just curious
it's a lot of diverse content
you don't need to do everything - in fact, you probably shouldn't do everything there
there's like, stuff for vr, audio, ar, behavior, animation, ik, physics, scripting, etc
focus on the things you're currently trying to do
okay ill give it a try, thanks a lot
if u really wanted to become a game dev, u should have some motivation right? like u do want to make a specfic type of game, or a game similar to some other games u think its cool
so just focus on that game
i thought id start with a bunch of small projects first, to learn my way around the engine, and to gain the necessary experience to get started with the actual passion projects
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
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
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)
ok my college starts with flappy birds
maybe u wanna give it a try first?
I was actually staring with a simple 2d platformer
after u learnt the basics
at least thats where i am rn
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
my setup rn lol
good , so u have found ur way, then just keep going
yeah thats why i was saying - small projects first
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
really
yeah there are errors there that aren't highlighted
yeah i know its so annoying i couldnt figure out how to get the tips and all that
Input also isn't highlighted correctly
unconfigured IDE is almost as text editor
make sure you have the folder open as well, rather than just files
because i installed some unity c# addons for visual studio but it wouldnt highlight my text or anything still
doesnt help that you're in restricted mode where afaik all external plugins are disabled
at some point, probably i just dont remember which one xd
youre absolutely right lol i didnt notice
what do you mean "which one"
theres a bunch of versions you need to install sometimes for like older programs or mods and so on
there aren't, no
maybe im getting it confused with the widows redistrublahblah
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
i installed unity ages ago so i dont remember anything i did lol
well you clearly didn't do this part, at least not to completion
is it in extensions or ?
this isn't even a unity thing
that's an extension in vscode
looks installed to me if thats what were talking abt
got it, thanks
and then did you install .net with it

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
do you want the help or not. you're making it incredibly hard to help you right now
im trying to figure it out, as i said i do not remember
then say so instead of being obtuse, and then go try
it'll say it's already installed if it's already installed
thats what im doing
"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
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
that's why we have message history
It was what i was doing doe
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?
A timer that limits how often it moves when a key is held down
Not hard coding with keys would be the first change but having a delay is the way to go as mentioned by Nitku. (record the time the last move was made and allow a move only when X time has passed)
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
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
yup i get the idea
i've got a bunch of other timers going for other stuff
i just add a new one
If we store game time its a bit nicer than having some time value we need to decrease in Update()
there we go. worked like a charm. thanks
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
you'd have to find the part of the code that handles aiming down sights, and then you just have to watch a tutorial on how to add sound effects, there are many on youtube
i figured as much, but was wondering if anyone here knew in particular where it was
you can try ctrl+f across the entire project for the word "aim" or "sight" or something
surely that will find it
the project or in my code editor?
code editor
there should be an option to search all scripts
Finding out where this code exists is an excellent learning opportunity. Think about what you do in game to cause it to happen, then where you might be checking for that thing to happen in code. Then you can look there and see if anything looks like what you want, and if you don't find it, think of somewhere else it might be and check there
well, i click to ads, so i would guess it would be something to do with PlayerInputHandler.cs
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;
Literally just going off of the name, a function that returns a Boolean for whether the "Aim" input is held
so, is this what i'm looking for, and if not, where does it point to? or are we back to square one?
Presuming "Aim" is what you're looking for, you've found the function that checks whether that button is held.
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
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);
}
}
why are you setting your codeblocks to swift lmao
habit.
understandable
Okay, so what would you say is happening whenever this function reads the Boolean from the last function? When that's true, what do you see this script doing?
i see that if it's false, it seems to... play an animation?
Where are you seeing that?
remember, you're looking for where it's checking Aim
presumably the if statement? i don't know.
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
What are the conditions in the if statement?
IsAiming? so what would we write? IsAiming = true; ...
and IsAiming = false;
What would you say this function is actually doing to IsAiming? What is it getting set to? Where is it getting read?
m_InputHandler?
Let's back up. Which specific line or lines of code involve the GetAimInputHeld function
that one appears to be deciding that you can't reload if aiming, and if you're not aiming, it lets you reload
just these i think
Which ones? Can you identify which lines involve reading the Aim input?
uh, the highlighted one is 139, but i don't think that's what you mean.
there is also 143 through 145, i'm also not sure about.
Right now, I'm asking you to identify which line or lines involve reading the Aim input for demonstrative purposes. Which specific lines.
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?
i don't know, this one?: IsAiming = false;
Where is that line?
that is line 134
That means nothing to me, nothing you've provided has line numbers
But for now we were just looking at the function you provided
In that function
What lines involve reading the Aim input
you're asking me which lines determine if the player is aiming
No, I'm asking you which lines involve reading the Aim input
Which is why I asked that instead of something else
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.
Another word for "read" is "get"
So, what lines get the value of the Aim input
would it?
You can read the code as much as I can. What about those lines looks like it gets the aim input?
Keep in mind that right now we are just looking at this function.
"GetAimInputHeld" is what we found previously to connect the other script to this one. they both have it.
Right, so what lines in this script use that function
" IsAiming = m_InputHandler.GetAimInputHeld();"?
There we go. That's the line.
Now, what does this line do?
according to the comment, it "handles aiming down sights". but i think what it's doing is checking the player's input?
so is this not where we would add additional code?
Just, in a vacuum, what is this line doing? You know that GetAimInputHeld is a boolean for whether whatever button is assigned to Aim is held. What is it doing with that information?
i don't think it's doing anything, not from what i can see in this script.
Well, if this line truly isn't doing anything, you could remove it and the game would function exactly as it did before removing it. How about testing that hypothesis?
okay, so what this line does it exactly what it says, it handles the input, probably to tell the game what means aim.
without it, the aim function doesn't work
What does the line do with that input? If GetAimInputHeld returns true while the button is held, what does this line of code do with that information?
Where does it put that information?
the void? something called "update"? i don't know.
We're looking at just that line
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
m_InputHandler? does that not go back to PlayerInputHandler.cs?
That is the object it is calling GetAimInputHeld on.
What does it do with the result of that function
starts the reload animation?
What, in this line, starts the reload animation:
IsAiming = m_InputHandler.GetAimInputHeld();
We are looking at a singular line
What is this one line doing
if IsAiming is true, it GetAimInputHeld? or if GetAimInputHeld is true, it means IsAiming?
Where are you getting an if from?
Do you know what = means
probably not in this particular context, no. it means they're the same or correlate to the same thing, as far as i know.
i would be assuming that = is defining a name for something else
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
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?
yeah, but did you also know that the one on the left is a variable and the one on the right is a method that returns a bool which is what's being assigned to the variable on the left? if not then you probably should learn c# a bit more 😛
that's why i'm here, hoping someone can help me through it. i only asked where i'd go to make this change, but i suppose an acute understanding of what's going on is required before you can truly look at code and understand it.
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.
i'm sorry. thanks for trying to help.
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
what does failed to create device from file error message mean
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});
device files are files that pass data to devices when written to or give data from devices when read from rather than being actual files on disk
not sure about what the error is specifically about though
it is on my extenal hard drive
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
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
I like
we do something similar
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
!ide
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
Oh, it's called an IDE, thanks!
visual studio is the IDE. what you were referring to is syntax highlighting and intellisense
what do you mean by split damage type? could you give an example?
what does flags refer to? I've seen the term used before
like a weapon that does physical damage and magic damage
Ah I see
I guess in my case I'd just send two damage events, but you're right that it affects it a lot
In our case, it refers to extra things the damage can do/not do (such as counting toward another thing or not).
@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
could you give an example? is it like a class that has a bunch of boolean toggles for different things?
[Flags]
public enum DamageFlags {
None = 0,
NoHex = 1
}
flag enum, so enum where more then 1 bit could be set at any time
oh like a list of enums?
If you've dealt with rigidbody constraints from the code, you've seen them already
no
for example IsGrounded, OnWood etc
You can combine values with |
might be too tired tbh
No one said you have to. If you want to do game writing and world building, I'd look into creative writing, history, and English/literature, though, it would be smart to learn or know the engine and how to use it
Some schools have Game Design with narration and interactive storytelling, but those are rare . . .
MyEnum v = MyEnum.A | MyEnum.B
[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
@cosmic dagger u've studied game design?
as a result you can use bitwise math to read the value of indvidual ones
or combine then with bitwise math
well, thanks alot!
i am indeed studying unity pretty hard and i'm taking some extra classes in high school so i am better prepared in case i do want the technical route.
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
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.
not going to lie I sort of get what the bitwise math thing is now but this is still blowing my mind lol
also, that's a bit of an optimization. Usually you'd just do if (someChangedFlag.HasFlag(ChangedFull.Teleport))
https://unity.huh.how/bitmasks
Vertx's site has a fun little visualizer to mess with to see how it works
A bitmask is a representation of many states as a single value.
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) . . .
so a int is made from multiple bits, to represent 1 number, this is just reading those bits as a bunch of individual bools
i never think of that since i work in many langauges
Yeah, I went to school for it, though, or program didn't have much (at the time) . . .
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)
DamageType is the typical Normal vs other actual types of damage. Flags are just flags
like FromEnemy, FromPlayer, CausedByAoE, etc?
This is definitely a good start. I just did the same thing myself (and am working on a damage system as well) . . .
I like the mentioned architecture, but it's important to understand why it's good, otherwise it's bad 😛
really i feel most mostly important to just keep things simple and down to only what is required for the current situation
I think I get it, but I worded it poorly
If you are fine with the boxing that does, then sure (probably won't affect much unless done millions of times a frame ofc)
its basically having a list of bools... without having a list of bools - you only use what you need when you need it
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
right?
and the same weather on its ints or enum types
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
Yup! But mind that bool type is 1 byte -- NOT one bit -- even though its value (true/false) could be represented in 1 bit
in Enum flags we use EVERY SINGLE bit
do got to keep in mind the limitations though which will be based on what your enums subtype is
this is #💻┃code-beginner -- a little deeper than this and we're gonna melt the dude's brain xD
oh just pointing out, that you cant just pack hundreds in there, you are restricted to the bit size of the type
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
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
does ur picker have a Is Trigger Off?
yes
is this by default just wondering
what do you mean by default
show the code
https://paste.mod.gg/jtfjynpwgahk/0
getting a null reference exception on line 44
A tool for sharing your source code with the world!
And that's on PickUp
maybe player's Layer isnt exactly "Player"?
like when you make an enum is it always liek that or do you haeve to set it manually to 2 4 8 16 etc
where he has the collider
would mean setPositionButton is null
Nah. Cause I just added for testing the collider and rigidbody to player
And it works
So the name of the Layer is correct
but I have it set in the inspector
you have to set the values correctly, so the pow of 2 numbers or go with the bitshifting in the other suggestion #💻┃code-beginner message
add the layer where u have the collider
Player
So the layers are correct
alr ty
I have the inspector in the screenshot
the numbers are special since if you look at the binary for them, they are all 0's excpet for one bit
idk then
got multiple objects with this ?
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
five objects with the script but four follow the prefab one is different and there are two null refs
both for the same line
so is this primarily an optimisation thing. or are there other benefits?
or a organization thing, can pass a bunch of flags as 1 thing without making a struct for it
i more often use it for organization then anything
this is a design choice and consensus by machine architecture developers and programming language developers
also its convention you can see even in the standard library many things that take args as flags
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)
caring about alignment like that i feel is actaully advanced for most
so, bool is 8 bits to adhere to that minimum, so developers can align
for sure, I'm over here trying to remember whether byte or bit was the bigger one 😭
8 bits == 1 byte
it's actually the first lessons I give to any students I take lol. Together with the "REF vs STRUCT" topic
but most of your types are larger like int is 32bit so 4 bytes
even if they don't fully understand it, warming up their brain to core concepts of programming pays off 😈
Which line is 44?
i mean in contex of unity, your person with little programming expereince is not going to worry about if they are doing memory layout correctly and if they are wasting bytes to padding, or the structs are aligned
Or rather, is that the error line?
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
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
its all good now there were two gameobject with the script i forgot about
thanks for the lesson guys, I'll try to see if I can crack this bitwise stuff a bit better after some rest
ohh you meant if enum flags are primarily used as an optimization instead of using lists? 😛
no -- it's much less code to manage an enum rather than manage a list! And the named syntax makes it more readable.
could someone help, im stuck ngl
What is difference between Unity and UnityEngine namespaces?
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.
Hard question to answer. Namespaces don't really "do" anything - UnityEngine contains most of the "core" api and older packages. Newer packages seem to use Unity.
It doesn't make an actual difference to anything. It's just how Unity organized their types.
I get it. It is really confusing that there are Unity and UnityEngine namespaces
i've never used Unity before i dont believe
I suppose. It's not really something you need to think about too much
ya, thats what my IDE is for 🤪
if you've used Cinemachine since the 3.0 update then you have
yea, i was gonna add "unless i unknowingly have"
I just try to use Unity.Serialization package and line [Unity.Serialization.FormerNameAttribute] and [UnityEngine.Serialization.FormerlySerializedAsAttribute] killed me, because I didn't get why is there both "Unity"
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)
Unity.Serialization is the actual Unity Serialization package (com.unity.serialization).
UnityEngine.Serialization is just a namespace in the core library/API dealing with serialization stuff.
Yeah it's pretty confusing
I assume that SO use UnityEngine.Serialization because it is built in. I would like to cerate configs with HashSet/Dictionary. I found alchemy package. Is it usable inside SO if SO uses old serialization? I have tried several ways and it doesn't work properly. I don't get how to make configs that
- Visible in inspector
- Work with hashset/dictionary
- Placed in filesystem, not UnityObject in scene
Ok good talk. Thx.
Don’t wanna clutter the chat with a block of text so I will put my discussion post here https://discussions.unity.com/t/make-two-objects-not-be-able-to-overlap-in-a-list-of-possible-spawn-positions/1686128
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
SO or not is irrelevant to the Unity.Serialization package. Unity.Serialization uses attributes to decide which fields to serialize and how. But it's not for the inspector etc.
If you are just looking to get a serializable dictionary for the inspector/assets you could use something like https://github.com/azixMcAze/Unity-SerializableDictionary
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.
if you want random grid locations without duplicates you basically have two options:
- Store the used locations in a HashSet or Dictionary and check if they're used before reusing them. If used, try another random location until you find an unused one.
- Generate a list of all possible spawn locations, shuffle the list, then just iterate over the shuffled list.
(this is pretty much the same answer you got in your link btw, which is a good answer)
I used it, but now I need store config to create entities in runtime. I could create wrapper for SO to translate a list inside SO to hashset inside wrapper when game starts, then delete SO and use wrapper. But I need to create wrapper for any config I create and it irritates. So I thought to learn Unity.Serialization and make it "good". But it seems like there is no simple way to do it...
Could codegen+attributes be a way... (generates wrapper for SO automatically)
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
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
get rid of the constructor
at least the parameterless one
I removed parameterless, but it still doesn't work
Only one element
It looks like
Give me minute, I faced interesting thing
What type are you using as T?
i.e. hjow did you define the field e.g.
public HashSetWrapper<WhatDoYouHaveHere> mySet;```?
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;
}
}
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 ?
Ah. For a second what happens if you do HashSetWrapper<string>? does it let you put multiple?
- Bring the light in from a third bootstrap scene instead of having it in either of your two main scenes (you could put it in DDOL for example)
- Have your code destroy one of the lights as soon as the new scene is loaded
Oh okay, i think i'm gonna do the destroy solution one, thanks for your answer (:
nope
And I get infinite erro
Unity 6.2
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(); ```
Is there a way to get the component Light2D in a script? I mean I only have "Light", but not Light2D
make sure you have the right using directive
Just make sure you have the appropriate using directive https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@17.4/api/UnityEngine.Rendering.Universal.Light2D.html
There is no error, but I still can't add more than one object
very odd
Thanks guys
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
could be one of these inspector ones causing an issue
I will try to create default progect on stable Unity 6.0
Still doesn't work...
Should I write in unity community?
value is reserved word maybe you should rename it?
nope
even your IDE showing it is reserved word
I mean, it still doesn't work
value is not actually reserved so it's perfectly fine as an identifier. so are things like var and await
it is a keyword in certain contexts, but can otherwise be used as an identifier
also name
i mean, name isn't even a keyword
ye you can name variable as public or private it will also be fine
incorrect, public and private are both reserved
so why value is same color as private and public?
value is a special keyword that is only a keyword inside a setter in a property
because the syntax highlighting in discord doesn't differentiate between stuff like that, it just checks for keywords
What will you do if you have property that change the value inside the getter or setter?
what value will that property change:?
why are you so hung up on this one thing that isn't even related to their issue?
because u talking it is good practicing to use the value as field name
nobody said anything about it being good practice, i simply said it wasn't an issue
"it's perfectly fine as an identifier."
It is
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
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
simply having properties in the same class doesn't make it invalid. in fact, it's only an issue inside of a property's setter, and only if you don't specify which value you are using by using this. in front of it. just like if you have a field and a local variable with the same name.
Here we go
I created question in unity community, here is link
what elements you try to add to list?
You should probably ask your question here as well. Before providing any context.
It is already exists
Well, I sure don't see it
If your elements is equal heshset will only add one Unique element the copies will be ignored
It's up there it just got massively derailed by a tangent about whether something that compiles but is a bad idea means it's "a problem" or not
I understand what
spiney199 said. I asked about way to solve it. And he answered... Lets create custom drawer...
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
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
The difference between hashSet and list is that access by entity, removing and adding is O(1) vs O(n)
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.
The entire point of the code they've shown is to make a serializable hashset that will be stored on the SO
SO CANNOT STORE HASHSET IT IT IS STORE LIST OR ARRAY NOT HASHET THERE IS NO SUCH OPTION
...unless you create a new serializable type that is a HashSet that can be serialized, which they have
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
unity official version how to store dictionary in SO is stroring two arrays and binding to each other.
And what does that have to do with the issue at hand
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
Use jsone instead of SO
Is there tool to edit it in inspector?
Maybe you should stop suggesting massive rewrites of completely reasonable systems because you want to get a point in edgewise
You endup in converting list form Scriptable object to Hashset there is no other way
I know
Question is "where"
In middle class or in deserialization
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)};
But now you've made a potential pitfall, if you ever forget to cache this result somewhere you're wasting a ton of extra processing power for no benefit. Not to mention that now you need to propagate changes on the hash set back out to the list
Better to just serialize the hash set directly so the way the data is used is the same as how the data is stored
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
It is still creating new entity for each operation. Creating hashset based on list is O(n) (it is impossible less). Suggest I create 100 entities with several configs with complex data structure
If there hashset inside baked enity, you will skip cloning
I see your problem you wanna change the data stored in SO runtime?
I dont. I want just read. You suggest create entity per read
I think you should just continue with the custom inspector plan and stop trying to justify it to someone who just wants to bikeshed
Meh, Custom inspector can't be generic, so I need custom inspector per type
Why unity...
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????????
I use DI instead of singletons, but I get your idea. I will store this HashSet in custom attribute. It looks like simplest decision
So thank you guys. I am going to sleep
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
how did u guys learn to code?
pain
Ah fuck that's right. Making a custom non-Generic version of each possible type seems like the only solution but it's annoying
how tho
practice
gng how did u practice
Making stuff
like every other skills ? you learn it and do it over and over until "it clicks"
i wasnt askin like that i thought u had a practice routine😭
you sure about this?
naaa I'm not organized like that lol
if you want resources check pin.
also https://learn.microsoft.com/en-us/shows/csharp-fundamentals-for-absolute-beginners/
https://discussions.unity.com/t/custom-editor-for-generic-base-class/838558/9
i think this works?
[CustomEditor(typeof(BaseFeature<>), true)]
oh my gooooooooooooooooood
test first tho!
I am not going to sleep this night
It... WORKS
yay
gz
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)
Select the unit in scene and check if it is Mesh or Sprite
3D with an orthographic camera to remove perspective.
u sure is 3d? i heard that it was 2d with 3d pre rendered sprites
Okay, then it's 2D with pre-rendered sprites with an orthographic camera. 🤷♂️
hello
My bad bro i was just asking the pros😭 i don’t want to act like i know
It really doesn't make a difference in how you approach this. The logic for the gameplay and such is largely the same.
I would test it but i dont have an arena asset to check
You just need to decide if you want to make sprites out of 3D models (outside of Unity), or just use them directly.
i was thinking doing it in 3d with blender seems the most logic path i just really been having this issue not knowing if i the game is actually 2d or 3d as a whole
i know i need to set up the perspective
It can be done with an orthographic camera, yeah.
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
alright
Can someone help me I'm new
I don't know how to put a pictue in discord.
!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
ok
and each entry of the jagged array would also need to be initialized, not just the outer array
what do you mean
https://www.geeksforgeeks.org/c-sharp/jagged-arrays-in-c-sharp/
Example: Declaring a jagged array with 3 rows
int[][] jaggedArr = new int[3][];
// Initialize each row with different lengths
jaggedArr[0] = new int[] { 1, 2, 3 };
jaggedArr[1] = new int[] { 4, 5 };
jaggedArr[2] = new int[] { 6, 7, 8, 9 };
Can you not just new int[3][3];?
(and jagged arrays are generally better than 2D arrays, so don't use 2D arrays)
so essentially this is the same as Dictionary<int, List<Int>>() ?
It's a structure of structures, yes
Sorry Nicky saw something new didn't mean to hijack your question
Its ok.
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)
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?
It certainly does look like a rather wild piece of code, very manual and literal way of going about something
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?
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?
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!
Definitely use the profiler if you haven't yet
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.
Yes. Unless you're putting them in resources folder or marking as addresaables.
I am not familiar with either of those (yet!), so I will assume I am safe for now. Thank you!
Thank you! I didn't know about this feature and figured out the main source of lag was caused by EditorLoop and that led me to figuring out (through reddit) that the animator tab kills fps in the editor, and closing that fixed my problems!
What's causing my text assets to keep doing this? My bitmap.assets just keep changing themselves without me touching them.
you can change the font mode to static to stop this I believe
dynamic font mode changes shit when you view the font
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
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.
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
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) 🙁
guys is there some jitter when going down or am I going crazy?
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)
snake, breakout, pong, flappy bird, minesweeper
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
I think there is small jitter all the way, is your movement maybe framerate dependent?
I am not sure, I am changing the Rigidbody2D linear velocity in FixedUpdate
mhh then that should not be a problem
Can you show your movement code?
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Who has it? Bitchat
could you elaborate on what your question is
Who has it downloaded bitchat
tf u talkin about?
is this some weird scam
this is a unity server my guy
Doesn't matter
its a messaging app no idea why he's asking though
i gathered as much from google... the fact that he's asking seems fishy though lol
yep same thought
anyone got giftcards 🤪
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
that's not a requirement either, it'll just show the fields that are serializable
i got a $5 unity plus giftcard i can send to you, you'll have to pay the $50 shipping though
as long as u include ur DOB and SS number
(bitchat is a very unfortunate name)
yo guys how do i make a button that writes to the console i made a clickevent but it aint workin
You have to make sure event is registered to whatever you're clicking on
Some code snippet might help recognise the issue
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);```
They're basically just checking if the game is paused
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
Bumping this up as it's still unanswered
Occlusion culling is a rendering optimization, it doesn't change what the final camera image is
Also this isn't a code question
Thought I would have to change something via code, my bad
Tho it does change the what final camera sees in my case idk why
Yeah, I feel like it's almost useless. My guess is they are trying to smooth the falling effect even more, but the game runs with barely any difference even without that part
idk why you wouldn't want occlussion culling but anw turning off use occlusion in camera should have been enough. Can you record the problem
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
start very easy. smth like catching balls falling from sky+
It has nothing to do with smoothing. All it does is freeze the player when the game is paused.
yeah sure, just give me a moment, creating a thread in #1390346776804069396
Posted now
Did you edit the name in project as well?
you can see the file names in the screenshots provided
It gradually changes the vertical position's value until it reaches zero, that is what it's trying to do.
Sure, the condition statement implies that it only runs when the game is not paused, but that logic is done elsewhere. The game can run without that else if
Help, crouching is doing this weird thing, it teleports me underground and throws me in the air
Can you show the scene view of the player too
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
done
take a screenshot
it was now underground
So, your selected object is there. Pivot shows the position of the specific object you're selecting
yeah so everything inside your player isn't centered
this stuff is so confusing ;-;
how can i recenter that?
just set the position of the hitbox model and stuff to 0 (local position so it would be the same position as the player gameobject)
then move it up and down or whatever you want
thank you so much that fixed my problem!
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
create the templates for your IDE instead of the editor
ohh thats smart 👍
How do I disable all shadows through script for performance boost I need it for in-game graphics setting
If urp there should be a setting on the renderer asset for URP or you could swap to the preset that has it off already. I think there's one called performance
hellooooooooooo
i want to make a 2d fighting game
but im completely new to unity
i seek guidance
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
tysm
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
I've reinstalled Unity among other things numerous times now
I think I've put in the work necessary to finally give up and just ask
So.... ask
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
What method is it saying is not implemented
Idk, it just said something isn't implement but won't actually specify what
It also crashed my machine at one point
It does specify. What line does the error say its on
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;
}
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
it should. all the camera movement and such are working properly.
verify that is it, don't make assumptions
Use some logs or breakpoints to determine what is and isn't being run
yeah, i initially put it there to avoid errors, but i can remove it now as there's waitforseconds, good catch
I got a new error now that didn't show up the previous times
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
will do
Looks like there's a problem with the autodesk fbx package. It might need to be removed or upgraded.
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...
Do you have any errors in your console
Removed it, errors are gone, but I know if I installed it again, the errors would show up again
also show where the code is being run from
Yes. Something with the input handler.
Input code differs between the built-in Input Manager and the Input System, and changes are required.
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
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.
With it removed, try deleting your package cache from AppData/Local/Unity/cache and then re-add it
Should Unity be shutdown before I deleted it?
i personally recommend using the "new" input system (it's like 6 years old at this point so not really new, just referred to as such everywhere). it has a steeper learning curve than the input manager (which uses that Input class), but lends itself to potentially cleaner code and is a lot more versatile
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
I guess I'll go back to whatever version this was written for because I don't know how to resolve it.
you can just change that setting mentioned in the link i sent to make it work in the version you are using
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...
Alright I forgot that AppData is usually hidden so I just unhid it, anyway, upm right?
I should delete that folder in it's entirety?
You can just delete the contents of the cache folder, anything still needed will be re-downloaded as necessary
Where?
The bottom of the thing?
Idk, I barely understand Unity, this isn't the engine I usually work with
Click on that, look at the full stack trace. See what function it's saying isn't implemented
Just show the stack trace, the top thing should tell you what file and function is the problem
Ha well thats not good
The thing I sent?
gltf exporter does work so maybe thats worth trying?
Yea its clear that something in the package was not impemented 😐
God damn it Unity
any updates for the package?
Hey folks, Im having a problem with my detection system
But there's no like, actual ''Hey there's an update available''
may be due to your editor version
I used the fbx exporter a couple months ago, in 6.0.47ish without any issues.
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
I'm on 6.2
show code
!code
Slowly but surely taking back everything I've said about Source Engine all thanks to this exporter shit
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:
alright, thanks, can you help me here or do you need more stuff ?
Do you think if I downgrade it'll just suddenly work?
I haven't tried that low
I am low on storage so I don't wanna download so many versions
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
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
which was when..?
I got it a few years ago
I wanted to develop for the Wii U
Then Nintendo closed the program
having it and using it aren't the same thing - if it was, I've played all 400+ games in my Steam account!
I've messed with it on and off since, just not my main engine so I don't use it daily
you need to get vs code configured before you can receive help here. so once you have it fully configured and you see proper syntax highlighting and intellisense (like auto complete for unity types) i'll point out what's wrong with your code
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
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
My Source goals is Gmod and also developing for platforms you usually don't see Source on
look into things like the A* algorithm for pathfinding. there are a couple of really good free implementations for it available, like aron granberg's A* Pathfinding Project on the asset store (there's a paid version of that available too, but the free version is sufficient), and the NavMesh Plus package on github that makes unity's own A* implementation work with 2d
Mission accomplished, I downloaded the extension
downloading the extension isn't the only thing required. did the colors in your code change at all? if not, then you missed something
https://unity.huh.how/ide-configuration/visual-studio-code
are there any guides on how any of these work? i want to make sure that they would work properly with the code for jumping i have (sets the velocity until a time limit is reached or the input is released)
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
depends on your skill, it's also time consuming
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?
I just use Aaron Granbergs A* solution
there isn't a free version, afaik
oh
A* is a standard path finding algorythm.
Aaron's asset is an implementation of that.
i was told there was a free version
oh thank you
there you go - I've only ever looked for it on the store
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?
there's documentation and stuff on his site as well
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?
Thanks
anyone know why this is not working https://paste.mod.gg/hgluwvnojqek/0
A tool for sharing your source code with the world!
You're gonna need to be more specific.
What's not working?
are we supposed to be mind readers or..
It's a quiz I guess.
sorry yall abt that the issue is that its not giving any results ie it never buys anything or upgrades anything even if it has 10k
I can give scripts
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
You must follow this for posting code
I see not 1 log.. start logging / use debugger and see what the values are and where it goes wrong
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
it would help if you show the Action mode you selected for it
try flow field pathfinding https://www.youtube.com/watch?v=tSe6ZqDKB0Y&list=PLancv1xTskfQ-xPCUDJCVDIDagN2Zco-1&index=33
📌 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...
Ok
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.
A tool for sharing your source code with the world!
A tool for sharing your source code with the world!
would like to know whats causing the issue, havent had much time as of late to work on learning this stuff due to work
you pretty much answered your own question there
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
don't overwrite the y in the move script
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)?
Universal 3d is basically 3d(urp). Just a little name change.
Ah okay perfect thanks!
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?
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
you would make a reference to whatever it is you want to move
learn asm for your first language
How do I make a reference? Would it be fine if you can provide an example?
declare the type you need/want and assign it
eg https://unity.huh.how/references/serializing-component-references
https://unity.huh.how/references
Choose the best way to reference other variables.
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
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
hi im new in unity can anyone tell me which course i should chose
Is there way to make SO work with Unity.Serialization?
Might want to provide some context. Work with it in what way? What are your trying to do? What doesn't work?
The beginner pathways on Unity learn.
Add some logs in that inner if block and see if they print.
Okay, I will try to right now
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
Why?
it helps out a lot
Okay
it's thus a requirement to get help here
Unfortunately, it doesn't work somewhy
Everything must be ok, Collider2D is both on the objects, tried to do without one connected to NPC, still doesn't see the collider
Try removing the player check and see if it prints then.
But if I discard "AttackRay.collider.gameObject == Player", this works
Yep! It works without "AttackRay.collider.gameObject == Player"
Then what Player references is not the same object that moves in the scene.
But I'm trying to make it work so NPC wouldn't see its collider itself
Or at least not the same object that has a collider/rb attached.
I think I've set them up properly
oky is it good ?
have you tried it ?
Can't say anything about it without seeing it. 🤷♂️
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
}
When I started learning, there were no beginner pathways, but I think they're good, yes.
i want to knoe another thing like which language is used in unity
so where did you learn from
SO by default works with UnityEngine.Serialization. It only provides ISerializationCallbackReceiver, but I can't inherit HashSet with it, only use wrapper
Then you'll need to delve into attributes and serialization hooks. But honestly, I think you're just over complicating it...
C#, if you mean programming language.
yeah i mean programing language
Reading the manual, watching tutorials, trial and error.
I am interested in low level, it is good occasion. Also using wrappers/copying all methods like Add(T e) => HashSet.Add(e)/creating middle classes manualy e.t.c hurts my eyes
When you get a hit, log the collider.gameobject name and reference. And the same for Player.
Like Debug.Log?
Yes
Like this?
Low level is a bit out of scope for this channel. Maybe start a thread in #1390346827005431951 with a lot of details on what you're trying to do and what doesn't work.
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.
anyone know how to fix this weird jumping?
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
You must post code this way
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 :
A tool for sharing your source code with the world!
is that right
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
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;
}
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)
OH! is that how smoothdamp works? i've been using lerp mainly.
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.
I see, thank you so much, i understand it better now.
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
GunBarrel is Transform
it is? that's weird, you might have to show more then
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?
here
You cannot modify a single axis, you have to construct a new Vector3 and assign it back.
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
Of course they're using pathfinding. The same that would be used by any entity in the world that is moving around.
so keep the rest as transform.eularangles.x , 0, transform.eularangles.z
Yep
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
So my game doesn't have any AI and the world is pretty massive, seems kinda like overkill to bake out a navmesh and use pathfinding for this one little thing. Is there any alternative?
#1390346776804069396 is for shader questions, but yes, that's how spritesheets work. You would adjust the tiling/offset values so that only one of the sprites in the sheet is visible.
- Teleport
- Create a spline/baked path that goes around the car and then move the character to the nearest point and then follow it around to the target point that is the drivers side
I guess Im baking the navmesh, oh well thank you for your input!
Personally I'd use the spline, it keeps it local.
but then if there is an obstacle on the spline the player will just phase through it
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.
What type of other edge cases? 😮
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
?
Like trying to enter the car if the door is against a wall.
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
Honestly when I run into this problem I send chatgpt a link to the docs and ask for an example
sometimes it works sometimes it doesnt
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
if i wanted to make a 2d game do you recommend unity or some other engine like game maker studio 2
Not the channel for this kind of convo. but the answer to this is: try the various different engines, and see which you get on with the best
okay
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
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
