#💻┃code-beginner
1 messages · Page 736 of 1
On principle nothing wrong with it. The connection to exit isn't required you could reroute them back to the idle. But that's the animator component not the State Machine
Editor issue, just restart the editor
Which version of Unity are you on?
6000.2.5f1?
yas
That second issue is caused by the first set of red errors, if you look it's a GUI issue where it specifies it can't draw text
This also started to happen to me after I updated yesterday from the previous "Supported" one
So I am not alone I guess
will do
I'm still only using 6000.1.2f1
be glad
I have no reason to go further, I don't need UnityAI
This issue is persistent even with restarts btw, just checked
yeah i noticed!!
fun times
Okay, hadd to check, contact the Unity support team with some screenshots, its a issue where it wont draw the GUI properly, likely something to do with scripts having an issue loading and or refreshing

can someone plz help me the skeleton still wont attack
Ignoring the awful purple overlay... the issue states there is a method called GetName being called twice and a dictionary having a duplicate Key, it may well be a double script...
You have no attack logic in your attack state, I told you, it goes straight to idle
you have to actively tell it "okay now you go to attack state, the state does xyz" etc
do you use UI Toolkit?
Yes
if so, detach your UI document, start game, attach UI document, start game again
solved it for me
the purple overlay is intentionally awful
so i always know when i'm in play mode
and dont try to do shit in editor while i'm in play mode
I got >30 UI states and each of them got their own separate UI document 

i wouldnt wanna be you rn 
I figured, just hard to read lol
I have mine identical in both Editor and Play and 9/10 i often rewrite scripts forgetting im in play
you could maybe make a scriptableobject that configures your uidocument though
you can select them all and remove them all at same time
or possibly make a preset
They are all prefabbed into separate GOs
Good luck
like here
cant you prefab your entire UI doc
Generally what I do is
1 prefab then I child prefab and just change the master
So example I have
Master_Item prefab
then for each item I would do
Child_Item_Fish etc
I dont want to get into the details, but this was done to support mod overriding from asset bundles

This is the reason why I had to go this route
Im sure there must be a better way to do it...
Like submitting a bug report and hoping it will get fixed soon
Thats what I am doing rn
yes, lol offload
now i'm actually curious how supporting mod overrides from asset bundles works 
Coz as I have mentioned, this started happening with a single incremental update that I did yesterday
with >30 UI documents obviously
From 6000.2.4f1 to 6000.2.5f1
I remade a virtual filesystem akin to Source engine which allows overriding by same asset paths
This forces me to split UI states into separate filesystem entries (prefabs) for them to be individually overridable by mods that want to do so
ah, that somewhat makes sense
thanks for the insight
If I had a single monolith UI prefab this would make it impossible for 2 mods to change something in the hierarchy of the UI
Since they will be clashing for the same asset to override
oh so only 1 mod could override your UI
unless you did the leapfrog using temp variables
In my case - its 1 mod per each part of UI
what if the monolith prefab had all the virtual paths? 
One mod can override a console, another settings menu, another main menu, etc
Pretty much how I am handling this
See that square?
That does not display an entry count
without seeing the ccode...I couldnt much help potentially optimise it
Thats where those errors are comming from
I wasnt really asking for help, I was just explaining the though process for splitting everything into dedicated prefabs with unique documents per each part

glad to see i'm not the only one naming my UI script... UI...
talking of optimising, I need to double check some code
UIManager for a name?
well i just felt a bit uncreative
Adding Manager sometimes feels overly verbose
UI or UIManager doesnt change much
Im just thinking less risk of giving a name thats already been used
it is what it is
💀
better
Readding all states back to the list helped, all errors are gone 🥳

glad if i can help even though you guys are all doing so much greater or more interesting stuff than me 😄
what is this and why does this keep appearing on startup?
Don't put yourself down, every step is something. Focus on your projects and learning and you'll do great things I'm sure
thanks
my biggest problem is not that i don't have the coding skills, more that i do the things i do for the sake of doing it and not with an actual goal in mind
right now i'm porting my bezier curve visualizer from godot so that's a start i guess
I have no issues spending time with you going through everything, I started coding about 4 years ago, I bought books, courses, taught myself, and practiced many languages. All while holding down a job, trust me, you have the skills required and the desire, that's what's important
well my game dev projects always go like this:
- enthusiastic in cloning a game i really like
- get stuck on movement
- drop
- repeat in 4 months

but this time i have the goal in mind to not overcomplicate things, especially in terms of visuals, and just focus on mechanics, then take care of the rest later
I mean, I can throw together a few basic movement scripts for you based on the popular movement methods if you'd like, but in general if you get stuck on one aspect move onto another and circle back
that might help in future projects but for now i think i'll just focus on getting movement going and not spending 7000 hours on the """perfect""" movement
Jank first, Refinement at the end
- Get Ideas
- Plan out a general concept
- work on simple mechanics
- create test environments
- design better mechanics etc
- design better environments
- bug fixes
etc
Only times you pause for bug fixing is if it literally blocks you moving forward, if its a "I dont like this but I can move past and circle back" do so
hi. any ideas why this Physics.OverlapSphere returns 2 colliders when there's only 1 collider in scene?
Floor collider and the collider for the other capsule maybe?
they are in different layers, does that cause any problems?
if it is recognising "Collider" it will check for any and all colliders, regardless of layer usually
uhh i dont think it should look like this
public class LineRendererInitializer : MonoBehaviour
{
[SerializeField] private Color[] _colors;
[SerializeField] private float _width;
private void Awake()
{
for (var i = 0; i < _colors.Length; i++)
{
var color = _colors[i];
var child = transform.GetChild(i);
var lr = child.GetComponent<LineRenderer>();
var startColor = new GradientColorKey(color, 0.0f);
var endColor = new GradientColorKey(color, 1.0f);
var colorKeys = new[] { startColor, endColor };
lr.colorGradient.colorKeys = colorKeys;
lr.widthCurve.keys = new[] { new Keyframe(0.0f, _width) };
}
}
}
shouldnt this work?
Let me check my line renderer
lineRenderer.material = new Material(Shader.Find("Unlit/Color"));
lineRenderer.material.color = colour;
I have a material attached based on the standard unlit color material
thanks. but the Debug.Log($"Hit {hitCollider.name} with close attack."); says the collider name is "Player" . theres only 1 Player object in the scene which im really confused
Is the script on more than one object?
very cool, 6000.2.5f1
it is, but i changed the layermask of that on ther objects
disable the script on the other object and retest
still not right
Outside of the method finding 2 colliders
these are the usual suspects:
- Double script being called
- flaw in logic
- Method being called 2 times etc
I assume the sword has a collider attached, the sword that is attached to the player with a collider... Try disabling the sword
is there a google document for a 2d game guide where it tells you animation simple code and stuff, if not I want to make one of my own for a school project
and a quick circle back to this...You are not doing any layer checks in your code that I can see, you are doing Collider check
Best bet look at UnityDocs
I want to make one thats just 2d games and simple compnents and code, nothing else
wait isnt the third parameter of Physics.OverlapSphere for the layermask?
Theres a few, but for now, disable sword. As far as im aware the layermask in that is an optional variable
this is the only thing out here, because I wanna make my own simpler verson for a school project
That is the best thing out there for Unity2D as its them themselves. But why dont you have a read, get the idea and do your own for your project
Thanks imma do that
nope it still returns 2 colliders
btw there any legal concerns with making your own document, wont be coppying online but could there be issues
@fallen cosmos what version did your stuff work on again? 
As long as it is your own words, and you are not planning on selling a document and or claiming to be the original source, since its for educational use there shouldnt be any issues
Thanks
the thing is
not even the width applies
But that is a good point ill raise. Anyone who wants to publish anything, few things to remember
If its not your own work/Asset, get written confirmation by the original creator and/or prove without doubt you have attempted on multiple occasions, to contact said person before you go forwards with selling it in your product
is the colour fixed at least for now
no
its all white
which is the default color
lr.colorGradient = new Gradient();
lr.colorGradient.colorKeys = colorKeys;
lr.widthCurve = new AnimationCurve(widthCurve);
lr.material = _material;
ah
with this it works
Does Destroying a game object that includes a particle system cause this error for some reason
Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!
just make sure ur colors have alpha
all of these are set to 0 in the Alpha / Transparency slot
u can tell by the Black bar underneath...
hello?
apparently cant send my image 
ah now
ah right because "uhh" is blacklisted on this server 
wanted to send the image with "uhh" as text
yeah found the issue with color
man this 6000.2.5f1 bug is obnoxious
welcome to bug fixing, where you solve one and a hundred more pop up in its place
Do I need to stop particles before destroying their parent?
if it helps any.. I noticed an issue with my quest system, and thought meh instead of 10 scripts I'll redo it in 4, and got over 20 bugs
it's more fighting with engine than fighting with bugs which makes it kinda annoying
fuck it, i'll use your solution by setting material color
i dont know why setting colorKeys on a LR doesnt seem to work
Foreach loop through the keys, and foreach loop through the colours you want and then take the ones you want and tell each one which colour it is to be
well i just set lr.colorKeys which should be fine?
Or since it's an array,a nested for loop works too
Guys, would you recommend any 3rd person camera follow-target smoothing techniques?
Cinemachine has some built in you can use
I’ve done it with Vector3.Lerp and a curve (distance vs max Lerp)
It does not work for my setup.
just use cinemachine
I am using Cinemachine. But it is not configured to use it. And I didn’t like it
I’ve tried Vector2.SmoothDamp (x-z position, y is instant or separately lagged)
Remember, camera updates are LateUpdate
Is that necessary if I manually call cam.UpdateStuff()
After the other every frame stuff
I have Cinemachine on manual update too
Is that bad for getting an even frame rate? 😅
Highly recommended unless you can change how unity handles the frames per second and order the methods get called
I see. But, I have every Update manually bro yeah
cinemachine gives you perfectly smooth camera motion, to get the same level of smoothness you need to grind out many edge cases yourself.
I use the De Occluder but I’m on Hard Look At
if you mess with cinemachine internals in the wrong places, you will ofc break that smoothness
So calling .ManualUpdate every frame isn’t essentially what Cinemachine does?
you can look at the code to see what it does exactly. the update logic is fairly complicated
In effect 1 FPS is 1 frame of action in a second, the second it gets from your computers internal clock. So if it's running at a 60 FPS it is doing 60 frames of an action within a second, so between 1sec and 2sec it will have had to divide 1 by 60 to allocate a frame per. Then send the data back to the program for an update.. mess up your maths in 1 part and it's all gone
How to do in my game so if a player is wearing a hat, the hair won't show except for coming out of bottom of hat?
Should I draw separately top_hair and bottom_hair sprites and then disable top hair when wearing hat?
Sounds best, even better if you have a sprite that is 'part bald' with hair on the bits not covered by a hat so it appears to stick out
Yeah sprite is bare to begin with. I'll do the top hair and bottom hair thing. Nice
isnt it closed source
or is it one of the few cases where you can actually see whats going on
You can always look, can't edit if I remember
pretty much everything in unity thats not part of the core engine is open source
its all in your /Packages or /PackagesCache folder
cinemachine is fully open source and documented in code.
private void DrawHelperLines(float t)
{
var positions = _points.Select(p => p.position).ToList();
for (int i = 0; i < (_points.Count - 1); i++)
{
int n = _points.Count - i;
var lr = _lineRenderers[i];
lr.positionCount = n;
for (int j = 0; j < n - 1; j++)
{
DrawLine(j, lr, positions[j], positions[j + 1]);
}
for (int j = 0; j < n - 1; j++)
{
positions[j] = Lerp(positions[j], positions[j + 1], t);
}
}
}
private Vector3 LerpBezier(Transform[] points, float t)
{
var positions = points.Select(p => p.position).ToList();
for (int i = 0; i < _points.Count; i++)
{
int n = _points.Count - i;
var lr = _lineRenderers[i];
lr.positionCount = n;
for (int j = 0; j < n - 1; j++)
{
DrawLine(j, lr, positions[j], positions[j + 1]);
}
for (int j = 0; j < n - 1; j++)
{
positions[j] = Lerp(positions[j], positions[j + 1], t);
}
}
return positions[0];
}
How do I get rid off code duplication here ahhhhh 😩
make a function
extracting what?
the bits that are duplicates

I've already gotten this far brother
I wouldn't ask if the solution was apparent to me
nobody can help you if you can't see the duplication
It looks like the only difference is whether you use _points or an array passed in as points, so just get rid of the first one entirely and call LerpBezier(_points, t)
why answering then
ah i just noticed
the code is wrong
LerpBezier is actually not drawing, just calcing
in effect, the entire for loop seems to be a dupe, you can extract that as a method and call it
yeah the problem is
it's effectively the same code except in one case i need to call DrawLine a few times
maybe i can re-code it into manipulating the array
and then i repeat the array manipulation
private void StepBezier(Vector3[] positions, int from, int to, float t)
{
for (int i = from; i < to - 1; i++)
{
positions[i] = Lerp(positions[i], positions[i + 1], t);
}
}```
turns out life can be so easy 
code usually works out that way, sometimes theres easier paths than ones we make.. hence why I spend so long trying to find the most efficient
Just something, if you are thinking you may want to do a call to this method from another script, look at making it public (not required if its internal only)
best to just make it work and readable first, no point trying to go for perf till its regnozined as needed
So I discovered the Editor has a checkbox “VSync (Game view only)” 
Now it says 60 FPS even if I do Application targetFrameRate = -1
Cinemachine update mode didn’t have an effect. I’m still getting dropped frames in any case.
Maybe it’s a Unity 6.2 thing. I’ll try in Unity 6.0 LTS and report back another time.
I meant like an Editor Game view issue. I’ll try building project too!
and deriving the other code from this was also rather easy
public static Vector3 GetBezieredValue(Vector3[] positions, float t)
{
for (int i = 0; i < positions.Length; i++)
{
StepBezier(positions, 0, positions.Length - i, t);
}
return positions[0];
}
Honestly, I can spend a couple months on a mechanic, writing scripts, testing, ensuring it works with the other components I have already etc
why is my unity codeword vector3 not appearing on vs 2019
are you using the using statement? Did you capitalize the V
yeah i am but unity is not reconizing it under vs 2019
I feel like I just did that (though it was on-and-off, primarily at random). I can finally say I've finished today . . .
Its okay, im working on audio and getting annoyed that for some reason my value on slider when 0 sets the volume back to normal instead of silent lol
Ouch, that's definitely not intended. I'd check where it's assigned or track any events/listeners when the value is changed . . .
are you using the log formula to calculate the decibels? if so, your slider should bottom out at 0.0001
Mathf.Log10("stringHere", value) * 20
the slider bottoms at 0 and then decibles go back to 0 and carries on lol
if it helps any Mixer Group is being used
You need to configure your ide.
!ide
!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
here is an explanation for why your slider should have a minimum of 0.0001 rather than 0 https://stackoverflow.com/a/68100286
then you can just round the display so the user sees 0 but the math will actually be right
The user wont see actual values, but graphical representation, the slider at 0.0001 I shall test against now
yep that was it, thank you folks.
and by visual representation
this is what I meant
It's usually the log formula . . .
it works for now, refinement can come later, I will note that though
Made the change, yes that is better, thank you..if i didnt change it the code would have annoyed me
Hi, I haven't coded anything in my project yet, but pressing play will freeze the game for a few seconds every single time.
Even when I stop the play before the freeze happens, the editor does the few second freeze, and this loading pop-up comes up saying something "unity synchronization execute tasks."
How can I figure out what's causing this? I'm assuming it's from an asset I imported but I don't know how to find where because the console doesn't really indicate anything to me that would be an infinite loop or something
How many assets did you import at one single time?
Quite a lot 😅 Would the best way be to disable them one at a time to see which is causing it?
For now...yes
Gotcha, ty! 😔
Generally import assets 1 by 1 ensuring they don't break anything..
I have two identical statments
if (!locker && releasekey)
{
move.movementEnabled = false;
transform.position = LockerGameobect.GetComponent<Locker>().enterPoint.position;
transform.rotation = LockerGameobect.GetComponent<Locker>().enterPoint.rotation;
locker = true;
} else if (locker && releasekey)
{
move.movementEnabled = true;
transform.position = LockerGameobect.GetComponent<Locker>().exitPoint.position;
transform.rotation = LockerGameobect.GetComponent<Locker>().exitPoint.rotation;
locker = false;
}
The first if statement works perfectly, teleporting the player to enterpoint and disabling there movement
but the second if statement does not teleport tehm to the exit point. The if statement goes through. i know this because the player movement is unlocked and the locker bool is set to true, but the transform is not changed, they are just dropped where they are
(i may go to sleep and re ask this in the morning but if you have any suggestions they would be appreciated!)
Try logging some data to see if the second if statement is true:cs Debug.Log($"Locked: {locker} | Release Key: {releasekey}", this);
hey everyone total noob to unity here, i was following a guide to making a script for a player char, and unity is not having it but the code at least to me should work am i wrong?
You should configure your visual studio so you get error highlighting etc.
!vs
If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
The error is caused by the semicolon at the end of your if-statement
So the compiler thinks it is an empty statement
i was reading something on that as well, so how can i go about fixing it? cuz if i remove the semicolon it also does get upset
cuz im assuming changing else to like else if wont do anything since there is no other if statments to look for right?
Start with this
will do thank you, im sure ill be back in a bit xD
alright so i looked into it i found the error with a bit of help since i had a semicolon at the end of line 13 and my small sleepy brain slapped that on the end like a dumdum, but i do appreciate the help and the addition to vs it will definitely help me not make such small mistakes
ha, already better
i rolled my project back to 6000.2.4f1 until the UI problem gets fixed
how can i make dynamic collision boxes and destroy them after a point of time , need it for attacks , will overlay the animations later on top of it
Okay.... My prof didn't approve of 2D animation game, they wanted 3D but I don't think my laptop can handle development like that
I've searched up and saw the term low poly, how does that work?
What are you actually struggling with?
how can i make dynamic collision boxes and destroy them after a point of time , need it for attacks , will overlay th
And are there videos showing how to make them?
cant find a tutoriual for that , just did the basics for now
i have
only
done the input system basics for movement and jump
This is a coding channel, you can also Google to find topics related to low poly in unity very easily
Low poly just means, a mesh has a low poly count resulting in that specific visual style. There are tons of free assets even in the asset store to paly around with in low poly, and what bawsi said. #💻┃unity-talk might be a better place to ask this stuff in the future
@lament halo this
you might want to think about what you need and then google for those topics. Get rid of the habit to find exactly that one tutorial covering exactly that one thing you want to achieve.
fair enough let me check the docs for hit detection and temporary collision boxes that die after a few frames
how do i access the downloaded documentation
you might want to think about, what "temporary collision boxes, that die" covers in terms of mechanics/components. You need a gameobject to be created, it needs to have a collider of some point, oyu have to check the collision being dynamic or static, you need to check on the events that get fired to be able to detect collisions and react to them.
ok
but how do i access the downloaded documentation lol 0-0
Did you download this? https://docs.unity3d.com/6000.2/Documentation/Manual/OfflineDocumentation.html
yes 0-0 , from the unity hub applicatiosn
Never worked with the offline version. you can locate it when you click in unityhub on installs and three dots and reveal in finder/explorer. There should be some contents/documentation folder. I am not on windows, so dunno
3D objects are meshes. Meshes are mostly just vertices that are connected via edges that make up faces. Low Poly basically means less vertices, less edges and less faces. You can look it up and see how it looks. It's basically looks a bit more edgey and simplistic instead of round and detailed.
You don't necessarily need a separate gameobject for the hit checks, you can use physics queries such as Physics2D.BoxCast/OverlapBox/CircleCast/CapsuleCast/Raycast etc.
https://docs.unity3d.com/6000.2/Documentation/ScriptReference/Physics2D.html
These are not objects - they are just methods you call to check for colliders in a specific area
since i couldnt figure out how to make it work with non-UI elements i just detected whatever i click with a regular cam to worldspace raycast
It should just work. event system + raycaster + matching collider and use of IPointer interfaces
make sure the layer mask was not changed on the physics raycaster
quick question, not really about scripting itself.
How do game devs scale game objects in unity 2D??
I try to search and search and it just showing about Ui instead.
You can alter scale on Transform, did you mean something else?
initial sprite size is based on the pixels per unit value configured for the sprite/spritesheet asset
I mean like.. scale with the screen resolution.
Oh well thats based on the camera orthographic size
the size of gameobjects dont change, just the size of the area the camera shows
so I have to adjust the camera's size based on the device's resolution?
ortho size should be consistent for height always regardless of resolution
width will show/hide stuff. You can use cinemachine to have a camera auto size to fit some objects
Alright, thanks. I'll search up about it.
I am currently talking to a unity rep about this
Hopefully this will get fixed
what is a unity rep?
representative i suppose?
ye
I went though with proper filing of this yesterday and now we are trying to narrow down the cause
is there a form or something or how can you get in contact with somewhat urgent things?
I just used this thingy
the exception pops up if you attach IDE to unity so maybe you can figure out the cause that way
you can report a bug via that or if you have enterprise then you can use premium support
If its an engine bug though making a bug report is the way to go to get it looked at and fixed
so you have premium support if you were able to get in personal contact?
oh nvm you're not withaust 
When you are troubleshooting a bug you get a person appointed to you to triage your issue
That is who you are talking to
oh thats cool
its not garuanteed theyll be responsive
Yeh, they are usually quite fast. Depends on the problem too I guess
anyways, this is what i figured myself but i was too lazy to look into the specifics
plus the entire UI code would just overwhelm me anyways so probably better that way
well this problem in particular is probably just annoying
not sure if it's in the way of anything
for now just looks annoying
Does Unity have a feature to disable or at least give a warning by console to user who try to override MonoBehavior functions like Start(), Awake(), Update(), etc in child class?
public class Parent : MonoBehavior
{
private void Awake()
{
// Do some stuff
}
}
public class Child : Parent
{
private void Awake()
{
// This actually overrides stuff that Awake() does in parent class
// I dont want this happen
}
}
you could make it public/protected
(and optionally, explicitly sealed)
If it is protected in the parent class you get a warning (with most IDEs)
sealed is only available when its defined as override isnt it? Those monobehavior functions are not
that was told by my IDE
no
it's probably saying that sealed is unnecessary when it's not overriding a virtual member?
ah, no, you're right
the SO answer i was referencing was slightly vague on that, mb.
no worries
you don't need sealed, if it were allowed it'd just make the behavior explicit
so its not possible then?
yea amazing, protected defines the warning console, this is not quite I looking for since you cant custom the log, but at least it will tell the users that Awake is currently used by parent
ty sir
ty sir
if you make it virtual your IDE should tell you that you are hiding methods from base class
making it virtual also allows you to call base version from derived version
Make it virtual and do proper overrides
If it's virtual you'll get an error if you don't explicitly override it
dont think it errors?
it just warns iirc
because it thinks you're doing private new void Awake() implicitly
at least thats what i recall
nope it gives an actual error: https://dotnetfiddle.net/EJRhXL
Test your C# code online with .NET Fiddle code editor.
Ah that's amazing to hear 🥳
hey, i wanna look into procedural dungeon generation in unity, for example with a wave function collapse algorithm, and im wondering what the best way to do that would be. every room as about 50+ props in it and a grid with the floor tiles and im not really sure if its optimal if i have an individual grid/tilemap for every room in the dungeon. is this actually the best way or do you guys have an idea how i should do it? thanks in advance
really depends how your game works
for example is every "room" like its own scene where the player can't see other rooms (like in Hades?)
or something else?
yeah more or less. but i feel like switching scenes every 30 sec or so isnt a very good solution or?
I'm just talking about mechanics here for the moment, not implementation
basically it sounds like the overall "world map" of rooms should be separate from how you store the actual contents of the rooms
pretty early screenshot of a bunch of assets i drew mashed together but i can imagine having a short fade out fadein effect when switching to the next room would work really good actually.
i think it would fit the game
also are the rooms themselves randomly generated (like the contents)? Or just the arrangement of the rooms in the dungeon?
no i really dont plan to get in that deep maybe randomize size/position/rotation of some assets to add variation but i really want it based on like "presets". i feel like it would be more controllable too
then yeah each room should basically be a prefab or prefab variant
and you can have an algorithm that just generates a dungeon from your library of available rooms
but you don't need to actually instantiate the prefabs until the player walks into the room
ok thank you! so ill basicly delete the room from the scene when im out and move on to the next during the transition right?
hey lads,
im working on unity6 2D project and i want have bloom/glow effect on specific object not all the objects in the scene
i have tried (2 camera solution, shader solution) but still i cant get
thank you in advance
this is a code channel
Bloom is a full screen effect.
The way to have it only affect certain objects is to make only those objects brighter than your bloom threshold
The only other options are:
- writing a custom bloom psotproccesor using a stencil shader or something
- rendering the different objects on different cameras
Also #1390346776804069396
There's some more interesting stuff going on in the DoNonFixedUpdate but it doesn't really seem complicated. Just a few if statements handling different camera modes
Far as I can tell, unless you have multiple cameras or some desire for FixedUpdate(), simply calling myCamBrain.ManualUpdate() seems to be equivalent to Smart Update or Late Update 🤷♂️
using UnityEngine;
using System;
using System.Collections.Generic;
public class CarController : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
[SerializeField]
public enum Axel
{
Front,
Rear
}
public struct Wheel
{
public GameObject wheelModel;
public WheelCollider wheelCollider;
public Axel axel;
}
public float maxAcceleration = 30.0f;
public float brakeAcceleration = 50.0f;
public List<Wheel> wheels;
float moveInput;
}
Why does the wheels list and Axel not show up in unity editor?
Wheel needs to be marked Serializable, and Axel won't show up anyways, it'll just be the type of any given wheel's axel
(btw, it's spelt Axle)
oh right thanks
But what if the game is about figure skating 
enum wont show up on editor, it was enum "variables"
it shouldnt show up
this is enum
enum Fruit { Apple, Orange ....etc}```
after u declared the class, u will do something like
```cs
Fruit fruit; // = Fruit.Apple```
this is called enum variable
just fyi, it's an enum not a class
the only "enum class" is System.Enum which is not actually an enum
Am I able to destroy a gameobject that has a nested particle system within it?
I seem to be getting an error when I do it
I keep getting this error right here
Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!
should be fine so something weird has happened
Is this to my problem?
was there a stack with that error? If not its probably some internal unity error.
Yes,
Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate! 0x00007ffa24f0341e (Unity) StackWalker::ShowCallstack 0x00007ffa24f12d29 (Unity) PlatformStacktrace::GetStacktrace 0x00007ffa261835ce (Unity) Stacktrace::GetStacktrace 0x00007ffa267599cf (Unity) DebugStringToFile 0x00007ffa24690fc4 (Unity) ThreadsafeLinearAllocator<0>::Deallocate 0x00007ffa24693bc1 (Unity) ThreadsafeLinearAllocator<1>::TryDeallocate 0x00007ffa246a31f2 (Unity) MemoryManager::TryDeallocateWithLabel 0x00007ffa246a4c03 (Unity) free_alloc_internal 0x00007ffa2567604f (Unity) ParticleSystem::DeleteClearedFences 0x00007ffa269febe9 (Unity) ParticleSystemGeometryJob::EndFrameCallback 0x00007ffa267e36e2 (Unity) GfxDeviceWorker::RunCommand 0x00007ffa267ed19c (Unity) GfxDeviceWorker::RunExt 0x00007ffa267ed2cf (Unity) GfxDeviceWorker::RunGfxDeviceWorker 0x00007ffa24c28e0e (Unity) Thread::RunThreadWrapper 0x00007ffafe1ee8d7 (KERNEL32) BaseThreadInitThunk 0x00007ffafef28d9c (ntdll) RtlUserThreadStart
hi, so i followed a tutorial on how to add jumping and this is the code
it checks if the groundcheck box under the player is touching anything with the ground layer
thing is it doesnt work with the tilemap im using
regular 2d sprites work
and i have no idea where to start fixing
you need whichever object(s) have the collider(s) to have a layer in your layermask
with a tilemap that'd be the TilemapCollider/CompositeCollider2D
btw your else if seems wrong - I would guess that's something you want to do only while you're in the air already. But right now it's only happening when grounded, where it's pointless
no its supposed to work when grounded
it's also weird when the veloicty is negative - it'll slow your fall
I'm also getting a ton of these
Internal: JobTempAlloc has allocations that are more than the maximum lifespan of 4 frames old - this is not allowed and likely a leak
again as I said what matters will be the object with the Collider2D
you need to find whichever object that is and make sure the layer is correct
show screenshots
one sec
- What groundLayer is set to
- the objects with the colliders
what compoinents are on the Grid object?
just these
looks fine, there's no reason your OverlapBox call wouldn't work with that
perhaps you're doing it in the wrong position or something
idk bruh
i threw in a regular 2d sprite square and set its layer to the specific one
it worked on that square
but not this grid
the tutorial i followed was made in 2023 so maybe some updates changed something?
show where your ground check is
nah
wait you are using a negative value for the size
it worked
WHY DID I HAVE IT NEGATIVE
i need to reconsider my life choices
thank you though
@hazy tiger No off-topic images, please

Good Morning,
Anyone have any tips for movement similiar to warcraft 3 movement? any articles to read?
similar how? Like the point and click part?
I have all of that part figured out, but the smoothness of warcraft 3, and the pathfinding is very hard, right now if there is a tiny bit of space between two monsters, the character will pathfind through the space and push them apart
really want to get it smoother too in terms of movement and attack
I am currently using a particle system for my fireball prefab. It's a projectile. I am creating a new instance of the prefab on every shot of the projectile. Could this be causing the memory leak?
If I just spam fireballs?
"Smoothness" often comes down to high quality animations and transitions
right now I am just using place holders, its the movement of them that are weird
Sounds like the path finding needs to have some width? To prevent that
if you never destroy them and/or if you keep a reference to them all forever, it can yes.
I will try that
If it's not built in, maybe there's some SphereCast stuff to do or... I'm not 100% sure
hjow are you doing the pathfinding? NavMesh handles this kind of thing automatically
Could be really expensive to detect that 'pathway too thin' kind of situation
private void OnCollisionEnter(Collision collision)
{
Debug.Log(collision.transform.root);
Debug.Log(owner);
if (targetHit)
{
return;
}
if(collision.transform.root == owner)
{
return;
}
else
{
targetHit = true;
}
if (gameObject == null)
{
return;
}
if (collision.gameObject.GetComponent<BasicEnemey>() != null)
{
BasicEnemey enemey = collision.gameObject.GetComponent<BasicEnemey>();
enemey.TakeDamage(damage);
}
if (collision.gameObject.GetComponent<PlayerMotor
>() != null)
{
PlayerMotor player = collision.gameObject.GetComponent<PlayerMotor>();
player.DamagePlayer(damage);
}
ContactPoint contact = collision.contacts[0];
//Instantiate(particleEffect , contact.point, Quaternion.identity);
DestroySelf();
}
I am destroying them when they collide with something. When I remove the particles it seems like everything works smoother but with the particles everything starts to go crazy
and if they never collide with anything?
and do you ever destroy the particle object?
yes
void Update()
{
if(Vector3.Distance(startPos, transform.position) > maxDistance)
{
//Instantiate(particleEffect, transform.position, Quaternion.identity);
DestroySelf();
}
}
The game started using 8gb of memory, I honestly got no clue what's happening
using Update for this is going to be pretty heavy. You could just do Destroy(this.gameObject, <some amount of seconds here) in Start
and they'll automatically get destroyed after that number of seconds
Makes sense, I'll implement that
Each of these projectiles have it's own rigidbody and colliders
If I spam a bunch at once could that possibly break the game?
i mean everything has limits
it really depends on how much "a bunch" is and your hardware
Many thousands? Entities starts to be a good idea or a single manager to update them all
if you spawn 50,000 at once, that's going to be a problem
I'm definitely not doing that much
I'd say there definitely isn't more than 20 that exist at a time since they are also getting destroyed
up to a few hundred is usually fine, depending on your target platform
might be rough on mobile but fine on PC
that's not a problem
man I honestly might just be better of restarting at this point
you can use the memory profiler to see what's using memory
Hi, from this problem, I tried to disable things in my hierarchy to try and figure out what might be causing it. I even ended up disabling everything in my hierarchy and the freeze is still happening.. is there another way I should be disabling my assets to find what might be causing this issue? Or maybe it's an external problem or my hardware causing it?
@wintry quarry
It doesn't actually tell me what it is. The section that keeps going up is the untracked
which version of Unity are you using?
I've also gotten this
Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate! 0x00007ffa24f0341e (Unity) StackWalker::ShowCallstack 0x00007ffa24f12d29 (Unity) PlatformStacktrace::GetStacktrace 0x00007ffa261835ce (Unity) Stacktrace::GetStacktrace 0x00007ffa267599cf (Unity) DebugStringToFile 0x00007ffa24690fc4 (Unity) ThreadsafeLinearAllocator<0>::Deallocate 0x00007ffa24693bc1 (Unity) ThreadsafeLinearAllocator<1>::TryDeallocate 0x00007ffa246a31f2 (Unity) MemoryManager::TryDeallocateWithLabel 0x00007ffa246a4c03 (Unity) free_alloc_internal 0x00007ffa2567604f (Unity) ParticleSystem::DeleteClearedFences 0x00007ffa269febe9 (Unity) ParticleSystemGeometryJob::EndFrameCallback 0x00007ffa267e36e2 (Unity) GfxDeviceWorker::RunCommand 0x00007ffa267ed19c (Unity) GfxDeviceWorker::RunExt 0x00007ffa267ed2cf (Unity) GfxDeviceWorker::RunGfxDeviceWorker 0x00007ffa24c28e0e (Unity) Thread::RunThreadWrapper 0x00007ffafe1ee8d7 (KERNEL32) BaseThreadInitThunk 0x00007ffafef28d9c (ntdll) RtlUserThreadStart
yeah i don't think this is directly related to your fireballs etc
Are you using any plugins/assets?
It's definitely related to the particles in the fireball
and yeah
hmm maybe a bug in the particle system then
what components are on the particle system prefab
Could be, I'm pretty lost
RigidBody, Sphere Collider
and I have a projectile script
on the particles?
its on the parent that holds the particles
the particles have Rigidbody and collider?
Cna you show all the components that are on the partticles object and its children?
I don't have any components on the fireball particle thing itself
It's using a material that uses a shader
there's no ParticleSystem component anywhere?
oh yeah hold on
sorry do you mean like what I have enabled within the particle system?
I just want to know which components you're using
This is the prefab, and the sphere and flare are the exact same except different sizing
These are the components on the prefab
how can i lock mouse pointer in 0 0 so mouseX or mouseY will output movement since last frame?
how are you actually checking the input? because with the most common ways that is the default behavior
Lock the cursor
but uh - yeah it already does that
how do i do that
but note that locking the cursor has nothing to do with whether the way you query your input is a delta from the previous frame
Indeed, but it's an answer to the first part of the sentence
Any good recourses to learn unity?
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Already
already what
and i want for mouseX and mouseY to become 0 at the end of each frame
alr locked
what are mouseX and mouseY?
Are those your own custom variables?
If so, then to make them 0 you would assign them to 0 yourself
mouseX = 0;
or simply don't make them member variables at all
axises
then your question makes no sense
show the code
so i want to teleport mouse to 0 0 each frame after i read it
show the code
mouse position comes from Input.mousePosition
Mouse delta comes from the Mouse X and Mouse Y axes
show your code indeed
anyone know how to make it so the animation plays fully and i cant play the animation again during it: IEnumerator Shoot()
{
canShoot = false;
animator.Play("M1911_Shoot", -1, 0f);
yield return new WaitForSeconds(animator.GetCurrentAnimatorClipInfo(0)[0].clip.length);
canShoot = true;
}
imo much easier to use Animation Event or Statemachine Behaviour
can someone help me? i am absolutely new at this of unity and an error in the app doesnt me create nothing
!ask
the thing is i dont know what they are or do
: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
thats when you usually research https://docs.unity3d.com/6000.2/Documentation/Manual/script-AnimationWindowEvent.html
i am 15 and i just want to become a programmer
perdon oe hago lo mejor que puedo
english only server
this error is not related to Coding question
most likely you have a permission issue going on with Hub and your pc
check logs to confirm
im sorry
i just join to the server looking for an answer
!install - Install into non-system folder, see the checklist. And ask general questions in #💻┃unity-talk next time.
- Make sure you have enough space including on
C:drive. - Check that it's not being blocked by antivirus/security programs.
- Look through the logs for a real reason why the setup fails they are pinned [here](#💻┃unity-talk message).
If you still have issues, perform a clean install in another location:
- Install the Hub and Unity in a non-system drive or a clean new folder in the root of
C:drive. - Failing that use the recovery Refresh option or reinstall OS entirely then repeat the previous step.
Im trying to call an outside script with a variable, is it possible to do something similar to what Im attempting here? ```using UnityEngine;
using UnityEngine.UI;
public class DungeonSpawners : MonoBehaviour
{
[SerializeField] private BoxCollider2D spawnerArea;
public string spawnerName;
[SerializeField] private SpawnManager spawnManager;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
spawnerArea = GetComponent<BoxCollider2D>();
spawnManager = GetComponent<SpawnManager>();
}
// Update is called once per frame
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("Entered");
spawnerArea.enabled = false;
spawnManager.SpawnManagerProper(spawnerName);
}
}
error: ```No overload for method 'SpawnManagerProper' takes 1 arguments```
"call an outside script" ?
what does that even mean
scripts don't get called... methods do
Im trying to activate a function in a different script while bringing over a varible
Seems like SpawnManager doesn't have a function named SpawnManagerProper that takes 1 argument
thank you
so do that?
The errors say these things, you can just read em
I know, I just needed someone to phrase it differently for it to click
yea it makes more sense when you know about method overloading
(you can use the same name with different args/return type)
hm? I was just explaining the language feature
How would I approach making my own canvas-like component, so a component that I can interact with and make it draw lines, arcs, circles. Whatever it needs. It shall be a generic component since I am doing multiple mathematical projects and plan to use it in all of them. An idea I had was using a LineRenderer but that wouldn't work with discontinuous lines. Say I a canvas where I am able to draw multiple non-connected lines. A solution would be multiple LineRenderer's but then I'd just be spamming Hierarchy with 7000 Line Renderer's which I don't expect to be very performant.
And no, a UI component is not an option. I want this to be happening in world space like LineRenderer's are too.
have you tried it to see how many line renderers the game will handle? otherwise your other options here wouldnt be so beginner friendly. you would be drawing these manually if the built in components dont work for your case.
I am just starting to think about it conceptually, so I have not tried the first variant, no.
What other options are there? I don't mind to make deep dives and reading up more complicated topics. But what are they anyways?
What do you mean by drawing manually? How do I draw manually? Are you talking about shaders? Render textures? Other options I don't have in mind?
you can look into Geometry shader or GL library?
you should first try it before jumping to solutions you might not even need. The solutions depends what you need exactly too. Havent used the GL api before but I know it should be pretty easy to draw 1 pixel lines with it
start jotting them down in a notepad or a post-it note on ur wall lol 🙂
you'll come across most typical errors during a project
im sure you're familiar with some of them such as the Null Reference Exceptions but heres a little cheatsheet of Typical Unity Console Errors
- NullReferenceException → Using something that’s null (not assigned).
- Type Mismatch / Cannot Convert → Wrong data type (e.g., float into an int).
- Index Out of Range → Accessed a list/array slot that doesn’t exist.
- No Overload for Method → Called a method with the wrong number/type of arguments.
- Name does not exist → Misspelled variable/method or used it out of scope.
- MissingReferenceException → Object was destroyed but code still tries to use it.
thats all i can think of off-hand that most people run into.. I'll add to it as i think of more
am I stupid or why doesnt any tutorial about movement work, I tried for unity6 and didnt worked so now I try for unity 2022 LTS and I have some bugs
copying things you dont understand leads into poor setup / broken
be more specific about what is going wrong
they all work but its probably ur Input
if ur Active Input Handling is set to New and ur trying to use the old Input. class
ik I need to actually learn but I am going insane I just want a stupid movement :(((
for example u wouldnt receive inputs... Debugging the values of those variables would let u know
and ik about the new input
with actions and all that stuff
right now I am watching for camera looking
ok cool.. just checking cuz when i first installed 6+ it was defaulted to New and none of my older scripts would work
yeah, still a good thing i'd say
although i'm not sure why unity resets the setting when migrating projects
yessir... took me a while to embrace but im finally using it
or did you just use scripts from older projects in a fresh project?
i just changed the Version in the Hub and re-opened my old project
for w/e reason it didn't keep the Active Input setting
yeah then ^
can I swear is the server (not to someone but to a problem)
hell no.
I mean you used hell
i didn't fucking either 👀
lol. u can say whatever you want to say..
k so u can but not explicit
just don't be cussing other people 😄
cuz WTF is this
Movement isn't stupid tbf
Especially "good movement"
😭
that would be a falling rigidbody that doesn't have its Constraints locked on the X and Z
guessing
you mean position no ?
Your capsule fell on its side. Maybe you've forgotten to apply a step from the tutorial.
I putted now freeze position
why would you freeze position..
if its rotating forward with AddForce then you lock the rotation
still same
It shouldn't be if you've frozened the x and z rotations.
does anyone have a good tutorial ?
!learn
that explains slow
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
then you're only going to find shit tutorials that you don't understand
ohhh bad
here for example
godot color theme in unity 
nope Unity pathway theme
I watched that part and I can say the colors are stupid
harder to see text
Hi, I've been having this issue where Unity completely freezes for 5 seconds after I press play, even after I stop and resume the editor. There's no console messages for it and the only information I've gotten is this window that only shows if I stop the play before the freeze happens.
I've tried reimporting the entire project's library and also tried deleting absolutely everything in the scene, but the error still happens.
Does anyone have any ideas what I can check next to find out what's causing this problem? I haven't coded anything.
https://cdn.discordapp.com/attachments/497874004401586176/1419551763140444361/image.png?ex=68d2d4da&is=68d1835a&hm=603becd12e6e358ee4ba7e1322077b70f7f001398e980d55850b9b9e2326db51
can i ask for help with unity hub here or is it in a different chat
its great that Unity lets u change practically everything
considering it says code channel. no
so back to the subject how to I make the camera work
whats not working about it?
What is supposed to be making it do that
third person perspective right? player in center, or off to side like in shooters?
it has a cameraHolder
FPS
Have you tried looking up the issue with a search engine (Google)? Maybe provide extra info. Some folks have found that it's to do with some code they've written. Try an empty project/scene etc
https://discussions.unity.com/t/editor-stuck-at-unitysynchronization-executetasks/250083
I made it kinda KINDA work still weird but better
step by step 😉
k so on full screen it works
I still have to problems
first is it good if when mouse is moved up the camera to look down ?
and the sensitivity is big but I can change that
Subjective. Some games have an option to invert the behavior.
what is better
yes
Your mouse had gone up to click the play button within the Editor. It'll likely not be an issue with the build release. You could always opt for delaying input or entering the application from the title scene etc.
it doesnt happen anymore cuz it takes a while to start and I put in center
but ow do I make when the player is moving mouse up to look up
right now mouse up means look down
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerCam : MonoBehaviour
{
public float sensX;
public float sensY;
public Transform orientation;
float xRotation;
float yRotation;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxisRaw("Mouse X") * Time.deltaTime * sensX;
float mouseY = Input.GetAxisRaw("Mouse Y") * Time.deltaTime * sensY;
yRotation += mouseX;
xRotation += mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
orientation.rotation = Quaternion.Euler(0, yRotation, 0);
}
}
this is the script
Take whatever code is making it do that and flip it
Don't scale mouse input by Time.deltaTime. Learn why...
📃 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.
k so now no more Time.deltaTime
nope it is worst now no more sensitivity now without it
please read all of the information presented to you instead of seeing one thing and making that change with no other changes
Did you look at the page that was linked
It's literally in a big box with a yellow warning sign on it
I don't know how it could have been made more easy to spot
vertx probably needs to add subway surfers gameplay to the sidebar for anyone to actually pay attention to it
your sensitivity should be closer to 1
is still kinda fast but WAY better
I will try 0.5
0.7 is best
so now how do invert the look up down
think about how you are currently handling rotating up/down. then using basic math, how could you reverse that
transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
orientation.rotation = Quaternion.Euler(0, yRotation, 0);
this is what I have
for rotation
that is not the entirety of it
ik
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerCam : MonoBehaviour
{
public float sensX;
public float sensY;
public Transform orientation;
float xRotation;
float yRotation;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxisRaw("Mouse X") * sensX;
float mouseY = Input.GetAxisRaw("Mouse Y") * sensY;
yRotation += mouseX;
xRotation += mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
orientation.rotation = Quaternion.Euler(0, yRotation, 0);
}
}
here's a little hint for you: that last message was a hint that you need to look before those lines you sent
also again share code correctly
!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.
it's been less than 10 minutes since i last used it for you
oh sorry :(((
so you want the up/down to be inverted
yes
I'd have a variable to turn that on/off... right? some users won't want / need it
public float y_invert = -1.0f; usually how i do it
Then, in one of your parts.... Multiple by that
xRotation += mouseY * y_invert;
I dont want to hear math right now I had 2 hours at school that burned my braincells
... Brother we're flipping the value...
then you don't want to hear the answer right now
If it's not that one, multiply it to the other one
spoiler alert... math is part of everything..especially gamedev
ik :(((
Trust me, sooner than later, get very literal about what the computer is doing
if you're just here to get spoonfed answers, then kindly fuck off. if you want to actually learn what you are doing, then you need to actually engage with the information presented to you.
finally it worked thanks for all guys
Cheers bro, for homework assignment flip the left/right too 😉
ik but my brain is burned after school
Late nights, we are all burning our brains man
I had 7 hours 😭
You just get used to it, get addicted to it
well, take a break ¯_(ツ)_/¯
that's a personal problem. don't make it everyone else's problem. we're not here to babysit you
How cracked do you wanna be? Drawing diagrams of Update Loops and stuff?
I try to make 8-10 learn
Matrix math?
👀 my first year was like 4-5 hrs learning and then the rest of the day implementing.. 1 hr doesn't seem like enough tbh
I did it I putted - at a multiply
I have school
Yes. You could set up public float x_invert = 1.0f; the same way we did the y_invert
and the dumb schedule of goig at 13
lol.. i have job and family.. gotta do what u gotta do
I like more to go to school from 8
I think what everyone's trying to say, is to develop the skill to break things down and understand them at a more simple level
good luck guy
I putted -
thanks
i mean, that's certainly one way to do it. alternatively you could have changed your += to -=
so right now I am 15 so I wont go into making games like schedule one but like small games
oh yeah that too
k so now movement I need to go into
for example in this case it would be "every frame, the computer adds the difference in mouse position, and moves the camera accordingly"
hence the solution is
"every frame, invert the mouse Y delta value so that up instead goes down"
after that a collectable pizza with task up
or enemy AI
with the idle chase shoot
so better to do the simpler one
Jason Weimann git-amend
They have videos on those things. And they're usually pretty solid in the strategies they use
and after both of them menu and only need to think about a more complex idea for the game jam
its in 17 days so I want to prepare
oh yeah the horror game? thing
yes
anyway going off-topic here. Wish u luck, make sure to check out those YouTube channels because they'll probably answer 90% of what you need
what part
Thanks for the response! Yeah, I saw that result, but I assumed it wasn't something to do with code since I haven't written any yet and it still occurs in brand new scenes with nothing placed. I'm also unsure how to debug where the freeze would be happening since the console doesn't have any information - is there a way I can check what code is being ran on play? Because I do have a bunch of assets imported
Hey all, new to Unity.
I’ve recently started learning Unity since the weekend; I’ve started the Unity learn pathways (essentials & junior programmer). I am kinda picking things up but often find myself overwhelmed by the amount I’ve got to learn.
Realistically, where can we somewhat expect to be after the junior programmer course Unity offers for free?
Great question
So the junior pathway offers you chances to learn the principles of the engine, combine it with the creative core, you will have the basic understanding to make games such as railway surfer, if you do some of their other courses, Tanks a top down 2D strategy game. It also allows you the chance to experience and decide which path of game dev you want to focus on, letting you understand the things you may need to research going forwards.
It does however at the moment miss out on certain aspects of C# programming, but I'm sure there are plans
Do you know the best places/ creators to learn C# from?
Outside of paying
YouTube or W3Schools
there are beginner c# courses pinned in this channel
Ok, I think via profiler I found that the hanging is being caused by GC.Alloc, so I'll try and find out how to work with that, thanks 🙏
legends, thank you!
I have two Input System action maps: one for gameplay and one for UI. Both maps have a left click action. Is there a built in way to ensure that clicking on a UI element only triggers the UI action map and not the gameplay action map?
private void OnLeftClick(InputAction.CallbackContext context)
{
if (EventSystem.current.IsPointerOverGameObject())
return;
// the gameplay logic/input
}```
you can use the Event System to gatekeep the logic
https://discussions.unity.com/t/ispointerovergameobject-inputaction-callback/946169/5
EventSystem's .IsPointerOverGameObject()
You can also Disable / Enable actionmaps
input.Player.Disable()
input.UI.Enabled()
hey anyone know why my unity does this?
i just recently reinstalled and it just did this
if the UI ur talkin about is like a Menu or something that u toggle then u can just disable the Game Input when its open #💻┃code-beginner message like nav said
but if its something like an overlay thats always on the screen u can check the event system and use a bool or something to early return
usually a graphics-card driver issue
#💻┃unity-talk
try updating your gpu drivers?
alright thanks
my bad i didnt notice that channel
thanks tho
another thing could be DX11 / 12 issue.. sometimes changing that API will fix it.. but i've never seen that in the Hub only in the actual Editor
its built on Electron right?
whats that?
directx?
its this but like i said.. only ever seen that affect the Editor and not the hub
https://github.com/electron/electron/issues/4380 their image looks the same
alright thanks man
the hub? lol no clue.. you probably know more about that than i
if so, TIL 🙂
I knew it was built on JS just not sure whic framework
work wonders, thanks!
thanks!
wait whats the fix cause i cant find it on here
oh i just meant this not the fix
do you have an nvidia gpu
yep
i just updated it too
so its not a driver issue most likely
this has been happening with vs code too for a while
psychedelic 🫠
meltinnn
are you on win?
coincidentally vscode also a electron app
lol.. the evidence is mounting
yeap
check out that entire thread.. also google unity and vscode visually glitching
and also i just noticed we're in code channel.. take it over to #💻┃unity-talk if u need to keep troubleshooting
alrighty
i guess this works for now
now i just need to find a way to convert virtual space into world space
can someone help me add animations to this model? i downloaded a model from unity asset store and it came with animations but they dont work when i press play, i followed every tutorial i could but it wont work
is that question code related? if so, you should consider sharing the code
No sorry.
Hi! I'm wondering if anybody could help me optimize/tidy my code? 🙂
IEnumerator LoadSession()
{
audioMixer.GetFloat("Master", out float mixerVolume);
animator.SetBool("isActive", false);
float currentVol = 0;
float audioFadeStep = 0.025F;
for (float i = 0F; -79F <= i; Mathf.SmoothStep(0F, -80F, i -= audioFadeStep))
{
currentVol = i;
yield return audioMixer.SetFloat("Master", currentVol);
}
int sceneToLoad = UnityEngine.Random.Range(1, SceneManager.sceneCountInBuildSettings);
yield return new WaitForSeconds(4);
SceneManager.LoadScene(sceneToLoad);
}
Is there a problem with it
it's fine, i just want to learn better code practices when it comes to writing code
i posted in #🔊┃audio because i was struggling with getting the audio mixer to work in a coroutine but i got it working on my own eventually
it just didn't seem appropriate to ask the above question in that channel!
The most important practice is to not agonize over nothing. If it does what you want and there's no obvious problems then you're done
i just don't want to hit potential tech debt or struggle to sight-read my code down the line because it's part of a much bigger project (i've just never worked with unity audio before now)
the only thing I can maybe think is why is mixerVolume unused?
Volume scales logarithmically, you should probably use Log10()
float linear = Mathf.Lerp(start, end, t);
float db = Mathf.Log10(linear) * 20f;
audioMixer.SetFloat("MasterVolume", db);
overall it looks fine? if you want to save yourself any sort of future struggles, as it works, do not touch the method again until a time in the future when you need to change it
thank you both!
for context i work in the games industry as a tech designer and want to pivot into gameplay engineering, so these are good things to know
why does Log10 need to be multiplied by 20 btw?
note that with that formula the min value should be 0.0001 so that it's -80, if it goes to 0 it will be negative infinity and unity will just treat it as full volume
Mathf.Log10(0.0001f) equals -4
-4 * 20 = -80 (the lowest value of the audio mixer)
and that value goes closer towards 0 (full volume)
Why it is that way I don't know. (You should also start you fade in with 0.0001f since starting with 0 might cause problems)
Then for what it's worth, the only recommendation here is to add comments to your code - if you are concerned with its longevity and readability.
thanks a lot for explaining all 😄
This sent me on a little bit of a quest to answer this question for myself, so I thought I would share an answer I found on Reddit:
[jayd00b writes]:
The answer to your question involves a bit of history and a bit of mathematics. The decibel was originally used to describe 10 "bels", a unit of measurement that came out of Bell Laboratories in the 1920s. While rarely used on its own, one bell is simply the base-10 logarithm of a ratio of a measured power to a reference power:
1 bel = log10(w / wRef)
Thus a decibel (deci- prefix meaning 10) is 10 times that logarithm:
1 decibel = 10 X log10(w / wRef)
So why do we use 10 X log10(w / wRef) for power ratios and 20 X log10(p / pRef) for amplitude ratios? You can look up a formal derivation, but take my word for it when I say that acoustic intensity (or power) is proportional to pressure squared.
w ~ p2
If we take our decibel equation for a power ratio and substitute in p2 for w, we get:
dB = 10 X log10( p^2 / p^Ref2 ), which using rules of exponents becomes:
dB = 10 X log10( (p / p^Ref)2 )
Using this rule of logarithms: log( A^n ) = n X log(A), we get:
dB = 2 X 10 X log10(p / p^Ref), or more simply put:
dB = 20 X log10(p / p^Ref)
https://www.reddit.com/r/Acoustics/comments/aiqdeo/comment/eeq16k5
tl;dr acoustic power is proportional to the square of the sound's pressure. Rewriting the base10 log of (x^2) gives you a 2 out, and then it's multiplied by 10 because it's literally just "deci"-bels, and so you arrive at the factor of 20.
Latest
Unless you have some special reason
im a complete beginner i have a project in mind
is a copy of clash royale
in simp,e terms
You should probably install the newest version of Unity 6 and then look at some of the "Learning" Projects from within Unity Hub. You'll probably want to learn how to use the AI Navigation Package at some point as well if you have that game in mind as a goal.
Beware that Editor performance is tricky
Remember this one for later! Where the game resolution options are, there’s a VSync (Game View Only)
Thank you so much for the help! Im currently downloading the latest version
What do u recommend me to do
Just keep that info in mind it’ll be helpful later
On desktop platforms, Application.targetFrameRate is unreliable. It’s in the Unity Docs
i think this is the best i can do rn
So for easy VSync to your monitor, definitely use that check box. For built executables it can be configured in project settings or in code QualitySettings.vSyncCount = 1
Do you have tips on what should i focus as im starting into devving
Yeah I certainly do. You want to make a Clash Royale right?
We can analyze that a bit and break down what’s required
Yess there was a game called jungle clash that was made with unity and it was so cool and unfortunately it got shut down but it had the features of 2018 clash royale wich is what i want to make
The camera is uhh… Orthographic I think right? Not isometric tilted, but, no perspective either
Yeah vertical
Maybe, every character on the field has its own state?
Can i add you ? Maybe u can give me some feedback if i need to
If it’s moving, waiting, attacking.
It’s better to chat here, everyone can gain from the knowledge 🙂
As I understand it, there’s some fundamental things to solve there
Like, how to “deploy” a new unit right
That’s gonna be Object Pooling right there. Unity has its own built in version
This was made with unity
How does each unit know what to be doing at a certain time? That could be done with State.
And there needs to be some Physics checks happening, like for proximity to other units etc
Someone else said NavMesh / AI path finding before, that’s another topic to know
Are you familiar with OOP? Composition vs Inheritance? Dependency injection? Singletons?
Scriptable Objects as shared data containers
No im actually completely new into this but willing to learn i believe on the project i have in mind
Polymorphism! Interfaces. Huge one. That’s how any enemy in the game can “take damage” from any source
That’s also usually how State works. You’ll see what I mean when you look into State Machines
The best advice I can give you, is start collecting knowledge know and keep it organized
Folders of screenshots, website bookmarks, your own writing or diagrams
Everything I just said ☝️ too
Yeah i see its very complex i need to learn C# also right?
A little bit of python
Okay. It’s really not bad once you get the main idea of what Unity really does
Might i ask how many years u been into programming?
U seem very knowledgeable
Im gonna have to keep everything organized and learn step by step i already have the idea in mind i just need to figure how to execute it
Probably your first few steps are…
- Download some Kenney NL assets and get a level design going, get some character models in
- Maybe a bit of lighting research, HDRI perhaps, or free procedural sky asset on UnityAssetStore
- Get the models to “spawn in” probably on like a timer, or a coins system whatever (Object Pooling!)
- Get the models to walk towards the enemy tower
A good while, but in Unity I’m under 1 year. The helpful people on here know way more than me
Also gotta make elixir work wich is like every card is gonna cost a certain elixir to drop also gotta set a core of different abilities and how they affect characters like Poison that damages a bit per second in the range also air troops
There is a lot into it
Sounds like Scriptable Objects will be valuable here. And State Machines, and Polymorphism
Yes in the sense i have to make troops to deploy if theres enought elixir available if not then u cant place them , they always gotta move forward or near the enemy when its on range and theres also troops that only focus to hit the towers so they gotta ignore other cards
It’s surprisingly straightforward to make different units do different kind of stuff.
But that’s only after you have all the necessary strategies in place.
Strategies or technically Game Dev Patterns are basically the “accepted efficient way” to get things done in some problem solving situation
Or in some cases, the value of the Coding Pattern is that it makes your code easier to work with, easier to add stuff to.
Yes and since most characters have their own abilities if i set a general system of the core abilities like
-Splash Damage
-Slowdown Effect
-Stun if hit
Etc adding the cards are gonna me more easy since the effects are already coded righr?
Yes, sharing functionality is essential when building these kinds of games
For example you have 2 enemies on the map… Goblin, and Wraith
They can both do a Splash Damage attack, but with totally different parameters
- Splash Damage Radius
- Damage Type (instant or over time)
- Damage Dealt
Instead of coding 2 different Splash Damage effects
You would have these parameters be set by the unit itself
Yes that is what i was thinking setting this its gonna make it more easy to just add more cards later
So they all use the same exact code, just configured how each character needs it.
Because im just gonna copy the abilities of the clash royale cards already existing just make my own characters
I want to add also arenas Also a leaderboard badges for top placements i have a lot in mind
You need to just write all this down and worry about one thing at a time
Yes write all the knowledge and terms down for later. I g2g, wish you luck on this journey. Be sure to ask us here when things get confusing!
Yes i have a journal where im gonna write everything down
Tutorials are wrong sometimes but. I can recommend Jason Weimann and git-amend on YouTube
Thank you so much💪🏻🫡
Not sure this is the right place for this, but when i try to open a project in unity hub, the loading screen pops up but then closes and the project doesnt open
i also tried to make a new project, but after i made it it didnt show up in the projects view
Check the editor logs
!logs
Editor logs
Windows: %LOCALAPPDATA%\Unity\Editor\Editor.log
MacOS: ~/Library/Logs/Unity/Editor.log
Linux: ~/.config/unity3d/Editor.log
Unity Hub
Windows: %UserProfile%\AppData\Roaming\UnityHub\logs
Mac: ~/Library/Application support/UnityHub/logs
Linux: ~/.config/UnityHub/logs
Errors or messages telling what happened.
right kk
Hi, so ive made an enemy that patrols an area but i wanted to make it so that they chase the player if they are seen. this is my coding but it doesnt chase the player. any tips?
📃 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 they are seen” what is the detection method?
I’m only seeing that you start a Coroutine… when the program starts ?
So.. Where is that code? Or that isn’t written yet
That's still not a valid wat to share code... Read the bot message.
This video seems to show some of that kinda stuff.
Oh I think I get it. So that Coroutine you start in... Start() - that's the patrol one right? So they start patrolling from the beginning.
Well okay good night! and good luck 
would this be the channel to ask about help with visual scripting? :o
no, that'd be #1390346878394040320
Yup, why I often say "tutorials get things wrong sometimes"
You suggest a square - would that be placed always at the enemy transform.forward? So it would automatically only detect things in front.
I was thinking a sphere trigger collider and the angle check. Theoretically if there's some "max detection range" the sphere collider is shaped such that, well, that works
With the front-facing square, it does eliminate the detection of things "not in view" / behind the enemy. But to enforce some max detection range I think Vector3.Distance is inevitable?
Depends what you're going for, but if you have a max distance then overlapbox with uniform sides. OverlapSphere should work similarly, but a box can give you the full 180 without any extra maths, while you can get 360 with the sphere similarly, but you'd also be doing check behind the character so that may not be needed
I once saw some project that did 1 raycast per frame, with angle shift. So it'd cover a range of let's say 45 degrees total, over 9 frames or something. 9 raycasts, 5 degree difference each frame
I wonder, if that yields better performance than overlapbox, overlapsphere, sphere trigger collider, etc
Like a, rotating looping Raycast sweep thingy.
I'd still use a single raycast after doing the angle check, if it passes -> raycast to check if LOS is blocked
Hm. Yeah right? I feel like the Physics detection is more valuable than the raycast
It's easier to decide what to do, once nearby [thing] is detected
basically you get the dot product between the two then I think the cos gives you the angle? Been a second but Unity usually has methods to shortcut it
It may be faster to do it in a math way, but yeah there's like Quaternion.AngleAxis or Vector3.SignedAngle etc
Ah right SignedAngle would work
gn 💤 🧀
!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.
https://paste.mod.gg help me please tryinging to follow code monkey's grid system
A tool for sharing your source code with the world!
You'll need to provide more info/context and explain what issue you have exactly.
I am trying to create an text based world system on the grid for the a* pathfinding because I have not figured out the node based a* path yet I am following code monkey a* tutorial that is my goal
Still not clear what the issue is.
A proper way to describe an issue would be:
I want A to happen(the relevant code is on line xyz), but instead B happens.
Adding a screenshot or a video can be helpful too.
The create world In Text is working somehow or I forgot a game object
If it's not an actual issue but a question about implementation, you'd ask:
I want to implement a feature/mechanic/system, where xyz happens. How do I approach it?
Sharing some examples from existing games can be a helpful addition.
thank you!!! couldnt find it in the channel directory haha
sounds like an #🔀┃art-asset-workflow or a #🖼️┃2d-tools question?
ok thanks!
