#💻┃code-beginner
1 messages · Page 737 of 1
It's a 2D scene so just up and down
Ah, so you want to move your camera on y-axis?
Ya
What did you try so far?
can get the scroll delta add it to the camera position
if its not smooth enough can do a vector3.smoothdamp
I didnt. I just asked for conceptual ideas of implementations.
anyone know why this keep appearing when i try to install the unity editor?
And calcing target position by number of scrolls and lerping to that was my approach
Since I didnt try it out as I'm not in the engine rn I just wanted to get feedback if there are better ways in terms of feel.
#💻┃unity-talk might be the better place to ask
I can recommend Vector2.SmoothDamp or Mathf.SmoothDamp if only 1 value is needed
ok ty
i have a Locale locale and locale.code or .locale came up nothing ?
make sure you assigned that
asigned? drag drop?
its a class property i dont see how it would change but im reference one rn
make sure you assigned the locale itself
Hello guys, can you help me clarify the different routes to have shared Events? I'll start below and please help me fill out the list / correct where I'm wrong. Or suggest something better if it's not on here, please 
- Event on MonoBehaviour (to share elsewhere, you would need a direct ref to the MB.)
- Static Event, static class (this... Always exists? Between scenes, it retains, I think.)
- Event on a Singleton (kinda same as above but requires instantiation for example a "Singletons" GameObject in the Scene that holds all the Singleton scripts)
- Scriptable Object Events (just need ref to the SO itself, pretty simple drag & drop)
what do you mean by "shared" exactly? shared listeners/shared event for the type?
Well, ease of access, subscription, to some Event. For example so multiple GameObjects in the scene can react, or the UI, etc.
I'm tempted to just do Static Class & Static Events, but I'm aware that Scriptable Object Events have some advantages over that. But, I don't really know what they are! 🤷♂️
i tend to just lean on static events, though no need to also make a static class for it
Why not a static class? Do you instantiate the class then? Where / when?
well i define the events on the things that would invoke the event
if things care about exactly which instance did so, i will just pass that as the first arg on the event
So... It's basically the MonoBehaviour method I described above
a static event field is different to a static class (where you cannot make an instance of the class)
You need a reference to that specific MonoBehaviour, to work with the Event
you do not
Oh because the Event is static?
only need the type to access a static event
So you would do ClassName.MyStaticEvent
Because no instance of the class is required, for the static things to exist
Ahh okay pretty cool. That's not so bad
public class Item : MonoBehaviour
{
public static event Action<Item> OnItemCollected;
public event Action OnCollect; //per instance
What do we gain going the Scriptable Object route?
As I understand, unless we were to do a lookup on Awake by like uhh searching Resources folder or whatever, basically we need [SerializeField] myEventSO anywhere we want to react to the Event
And we drag & drop the SO itself before runtime
the scriptable object way is worse as unity may make a new instance and really confuse things
Wdym by make a new instance? Wouldn't that only happen with ScriptableObject.CreateInstance<MyScriptableObject>();
Static keep it simple, no worries about timing or finding the instance on sub
Easy to invoke
no if the asset is loaded there is not guarantee its the same instance if the asset was "unloaded"
I've never seen an SO duplicate itself. Not sure what loaded / unloaded means but, I'll keep an eye out
I'll research more about the benefits of SO Events and report back
Unity can unload and reload scriptable objects between scene loads if nothing is referencing them, so the non-serialized fields in it, like events, can get cleared.
But I'm pretty sure if you have a subscription you haven't removed, that will count as a reference and it will keep the same instance.
I dont know if an event on the scriptable object not being null is something that is checked
Its handled like an asset after all
Oh, gosh. Well I dont need my scriptable objects re loaded, darn!
Wait so… if I have a GameObject with a MonoBehaviour, in 2 different scenes, with same SOs plugged in
Then it won’t be reloaded right because there’s always a reference
Maybe... I can't find a source that proves it one way or the other. Behavior in editor and build can differ as well.
Thanks for the knowledge! I’ll probably go with Static Events until there’s some reason I need the other methods.
Not that it bothers me too much, but does anyone have any idea why public Sprite[] overlayTiles; ends up looking like this? https://puu.sh/KBe0J/3c6e94d5b1.png
I don't see a p oblem
Is it the v character? What if you try adding another one in the name, overlayOverlayTiles?
I feel like I've seen strange issues like this come from misbehaving custom editor stuff. Some editors modify the built-in GUIStyles without reverting.
If Unity restart fixes it, it might just be that.
this is most likely a UI glitch, last time i got it it affected fonts rather than characters
so like, it wouldn't show v at all, not just that position
what version?
I just changed it back to overlayTiles and now it seems to work fine.
Strange..
schrodinger's issue
Hi guys, is this problematic to create a new instance of an InputActions in Awake? Like when it comes to, scene reloads specifically I guess.
QualitySettings.vSyncCount = 1;
// Application.targetFrameRate = -1;
playerInput = new PlayerInput();
}```
I suppose, since the player's input will be relevant the entire game, maybe it should be Static? Perhaps even a Static class not just the member variable.
its fine doing it in awake
No that's the name generate class yes
ah lmao
I keep doing that oops
new UI system has code gen for your actions and action maps
i'm aware
you can access them either by refs or via this type it creates
So it's like, deleted & re created on a new Scene load?
is it always called this?
Seems a little weird. Shouldn't I prefer Static in this case?
it really does not matter, and there are reasons and usecases to have multiple instances of it at times
Ohh yeah like to support split screen Co-op right?
other reasons too, depending on how controls are setup for different parts of a game
I have it set up so an InputReader.cs just captures the input. It's on all other scripts to use that input, however is needed
so if you want to handle thigns that way i would just make InputReader DontDestroyOnLoad
Sorry, can you clarify what exactly happens on scene reload with the Awake() instantiation?
so it survives scene reloads
Oh okay. So that prevents Awake() from like, duplicating the PlayerInput instance? When a new scene opens
(Sorry I'm really clueless on this topic)
yes, since calling DontDestroyOnLoad would put it in its own scene that never unloads or gets loaded again
But without DontDestroyOnLoad,
does Unity auto destroy the previous scene's PlayerInput instance?
it would be tied to the lifetime events of the scene its in
since if the scene onloading the objects you create it in wouldbe gone so it would be gone
Okay so. Unity would be deleting the previous scene's instance and then creating a new one in Awake() of the new scene
got it! Thank you 
is it possible or adviseable to use both rigidbody and charactercontroller? i want a controllable gameobject to be more responsive than rb addforce would provide, but i would like to make events where the object is subjected to physics
no and no
they will fight for control over the transform
you could have both at separate times if you have specific cutscenes with physics in mind i guess? but you can't use them at the same time, no
character controller is kinda rubbish anyways i would use something like KCC then in your logic for it define how to react to your physics events
more responsive than rb addforce
you can also control the velocity yourself, btw.
i was thinking more like, a somewhat believable pushback from an explosion, for example
definitely true, i just saw that charactercontroller is just less bothersome. i'll test around with both
here's my findings bro
- Rigidbody non-Kinematic
Have to use AddForce and AddTorque to maintain Interpolation (welcome PID controllers unless you want slippery movement & overshoot)
Fully in the Physics system, applying and receiving forces - Rigidbody Kinematic
Have to use MovePosition and MoveRotation to maintain interpolation
Only applies forces to Physics objects, does not receive - Character Controller
Easiest to use, for natural Physics interactions you can add a bit of code, but it's tricky because you have to determine where to inflict or receive force.
[Range(0.0f, 800.0f)]
public float rbCollisionPush = 4.0f;
void OnControllerColliderHit(ControllerColliderHit collision) {
if (collision.rigidbody == null) return;
Debug.Log("Collided with rigid body");
// TODO look at Collision Normals to determine which direction to push object instead of just using characterVelocity
// Or use CharacterController collision flags to determine if top, middle, or bottom of the capsule was hit - might yield more basic results
collision.rigidbody.AddForce(characterTotalVelocityVec3 * rbCollisionPush, ForceMode.Impulse);
}
Here's some basic code that applies a force, from the CC, to a Rigidbody when it's hit.
There's way more to do here, like perhaps take into consideration the Normal of the collision that happened, or less complex "which part of the Character Controller" was hit. See image below
Its really not suggested to spoonfeed stuff, especially when its not asked for. This code isnt particularly good either.
i'll try both with rbs and not since frankly i'm mostly exploring what CAN be done. what i do know is that 3d math is terrifying
The 3d math isnt hard at all, unity has functions implemented to do most of the actual hard math. At most you just need to understand what a function does
"basic code" yes
Ok ill be blunt then. Its bad code, doesnt matter if you call it basic. It shows practices that shouldn't be used
the "non-kinematic" is called dynamic btw. there's also a static mode in 2d
If you're going to try non-Kinematic, which will both apply and receive forces from all Physics objects,
Make sure to look into PID controllers
https://www.youtube.com/watch?v=roxhVW3KeRY
https://www.youtube.com/watch?v=y3K6FUgrgXw
https://vazgriz.com/621/pid-controllers/
also, dynamic rbs can use velocity, not just forces
Directly modifying .linearVelocity ?
What's so bad about it? It applies a force to a Rigidbody when collided, based on the Player's current velocity.
I said there's more to do, like check the collisionFlags or collision Normal. Etc
on point 2
Only applies forces to Physics objects, does not receive
importantly, it does not detect collisions. you still need dynamic rbs to detect the actual collision
first of all i'm going to at least sketch out the action i want, and i'll try to make it happen with either impulse force or with kinematics. thank you all for the advice
I've read that directly modifying .linearVelocity is funky. But some controllers out there, that work great, even switch between Kinematic and non-Kinematic modes.
isn't the CC frame-bound, not fixed-timestep-bound?
using AddForce with ForceMode.Force would be incorrect there if that's the case
the Time.deltaTime is also incorrect regardless
how is it funky? it's what the RB does.
Thank you for the knowledge. So it would be an Impulse or .VelocityChange then, with no Time.deltaTime in there
probably Impulse if you want to have the effect of pushing
It's funky as in it won't be realistic, because things in real life don't just become moving all in one go
But setting velocity on a rigidbody does exactly what you expect it does. You're just most likely not expecting realism if you're doing it
it could be realistic if you have that in mind
In most cases you should not modify the velocity directly, as this can result in unrealistic behaviour - use AddForce instead Do not set the linear velocity of an object every physics step, this will lead to unrealistic physics simulation. A typical usage is where you would change the velocity is when jumping in a first person shooter, because you want an immediate change in velocity.
it can also be unrealistic but play better (if you have that in mind)
unrealistic behaviour as in unrealistically high acceleration
Again, it is unrealistic, but if you want to set the velocity, chances are you want unrealistic
hell, you could have a moving platform that you want at a set velocity
you would be setting the velocity then, easiest option
it wouldn't be realistic
but that's just not an issue
cause things like Mass and friction are ignored..which you may not want for "Reaslitic" physics
you have a magic number 500.0f, then Time.deltaTime used to counteract the magic number which is equally wrong and both can be excluded. and yea as Chris said, this wouldn't be a Force, more likely an Impulse.
it doesnt matter if you say theres more to do, i was always referring to this specific example being bad. It's really just a bad idea to randomly spoonfeed walls of text that no one asked for. it's especially worse when its not correct which is often the case when beginners try to spoonfeed each other with what they've learned in their limited time
theres nothing wrong with directly setting the linear velocity, you can achieve the same result as AddForce
yeah imma be honest/blunt here.. i get that you're trying to help, but when you are also a beginner, sometimes that just harms instead
I just opened a fresh project that was given to me by my professor and it is showing these errors without having done anything. Any clues?
Seems like your URP installation is either out of date, corrupted, or missing. Go into the package manager and re download it
i'd guess a library reset could be in order as well
Really? I've had terrible results doing that before 😐
I'll go ahead and clean up that code block a bit. Sorry, I'll be more careful
Okay I fixed all the things. no magic number, no Forcemode.Force, no Time.deltaTime
you would typically just add to the linear velocity and it would function fine. Most games dont really have the players bouncing around as a result of objects hitting them, so you dont need accurate physics
most of my projects use linearVelocity for player control.
the default forcemode is Force, you would want to specify Impulse directly
It still interpolates?
Or do you do your own interpolation.
if you have interpolation settings set, yes
that's the point of the interpolation setting
I thought that it works with AddForce and AddTorque only.
AddForce just changes the velocity
... 🥺
I can't even find anything online on that specifically. Really, setting .linearVelocity directly maintains interpolation of a dynamic RB? 
I'm gonna try it out, hope you're not pranking me 
is linearvelocity new? some old-ish tutorials ive come across use just velocity
But you still need AddTorque for rotation.
Right?
yeah it was renamed in unity 6
it does the same thing
there is also angularVelocity
that's how AddTorque works under the hood
nothing about it would break interpolation
interpolation is for the simulation of the RB, not for interpolating forces specifically
if you arent aiming for physics interaction as a result of the player rb turning, you dont need torque or angular velocity at all either. Could just directly set the rotation on the rigidbody
can someone help me?
using System;
using System.Collections.Generic;
using DG.Tweening;
using Sirenix.OdinInspector;
using UnityEngine;
public class PlayerDeathManager : MonoBehaviour
{
[TitleGroup("<< Fade In >>")]
[PropertyTooltip("The duration in seconds for the screen to fade in")]
public float m_FadeInDuration = 2f;
[TitleGroup("<< Fade In >>")]
[PropertyTooltip("The ease setting for the fade in tween")]
public Ease m_FadeInEase;
[TitleGroup("<< Fade Out >>")]
[PropertyTooltip("The duration in seconds for the screen to fade out")]
public float m_FadeOutDuration;
[TitleGroup("<< Fade Out >>")]
[PropertyTooltip("The duration in seconds for the fade out tween")]
public Ease m_FadeOutTween;
public List<KillZone> m_KillZones = new List<KillZone>();
private void Awake()
{
AddListeners();
}
private void AddListeners()
{
for (int i = 0; i < m_KillZones.Count; i++)
{
m_KillZones[i].OnEnter += HandleKillZoneOnEnter;
}
}
private void RemoveListeners()
{
for (int i = 0; i < m_KillZones.Count; i++)
{
m_KillZones[i].OnEnter -= HandleKillZoneOnEnter;
}
}
private void HandleKillZoneOnEnter(object sender, EventArgs e)
{
(sender as KillZone).OnEnter -= HandleKillZoneOnEnter;
Debug.Log("Kill Zone :: Player died");
ASingleton<ScreenBlockerController>.Instance.ShowScreenBlocker(m_FadeInDuration, m_FadeInEase, () =>
{
ASingleton<PlayerController>.Instance.transform.position = ASingleton<GameManager>.Instance.m_RespawnPoint.position;
ASingleton<ScreenBlockerController>.Instance.HideScreenBlocker(m_FadeOutDuration, m_FadeOutTween);
});
(sender as KillZone).OnEnter += HandleKillZoneOnEnter;
}
}
what do you need help with
Now, my player does SOMETIMES respawn at the respawn point but not always
and I know my logic is triggering because the screen blocker still shows and hides
Debug.Log("Kill Zone :: Player died"); are you seeing this log?
I am
what's with the desubscription and immediate resubscription
Like I said, I KNOW the logic triggers
it just doesn't set the player position always
Well so that when I die, the system knows to resubscribe to it so it will do it again
put a log right before the line that sets the player's position
why not just.. not do the entire thing
why not just leave the subscription alone?
don't desubscribe and then don't resubscribe
Oh I saw people doing that in other games. By not doing that, wouldn't that be a violation of some code practice?
Idk what I'm talking about
i would guess that maybe it was in a coroutine or similar, and the resubscription was only done after the respawn sequence
the only reason you should unsub immediately before subbing is if your code may have already subscribed somehow but you are unsure and you also want it to only be subscribed once
in this case it seems pointless as you can just leave it subscribed
Okay so I have taken out the resubscription and unsubscribe, and I put a log above the position reset, that DOES log but it doesn't reset
have you tried logging where it's trying to respawn the player?
the name of the respawn point for example
I'll try this
that action you pass to the ShowScreenBlocker method isn't perhaps being invoked on another thread, right?
I hope not, I'll send the logic
using System;
using DG.Tweening;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.UI;
public class ScreenBlockerController : MonoBehaviour
{
[TitleGroup("<< Screen Blocker Options >>")]
[SerializeField]
private CanvasGroup m_CanvasGroup;
private void Awake()
{
m_CanvasGroup.alpha = 0f;
}
public void ShowScreenBlocker(float duration, Ease ease, TweenCallback onComplete = null)
{
m_CanvasGroup.DOFade(1f, duration).SetEase(ease).onComplete += onComplete;
}
public void HideScreenBlocker(float duration, Ease ease, TweenCallback onComplete = null)
{
m_CanvasGroup.DOFade(0f, duration).SetEase(ease).onComplete += onComplete;
}
}
what components arew on the player? how does it move?
Okay so I DID log the respawn position, even when it doesn't reset the player's position there, it DOES log it as a vector3
if it has a CharacterController you need to be sure to disable that when you teleport it
THANK YOU!!!!!
you can edit messages btw :p
I know, didn't think to
you can press up (arrow keys) to quickedit the last message
or use sed if you're into that
what is "sed" ?
it's a command line tool short for __s__tream __ed__itor, there's one commonly known expression usually in the form s/a/b/ where a is replaced by b in the input text
you can use a basic version of that form in discord (the real one uses regex, i believe discord just does text replacement? haven't tested)
https://www.gnu.org/software/sed/manual/sed.html
ohh nicee. TIL
So, I'm having a bit of an issue. When my character jumps on a crate, it's supposed to instantiate a bone powerup in it's space and then destroy the crate, but it's only doing it sometimes, most of the time it just doesn't make instantiate the bone. This is the code I'm using.
if (other.TryGetComponent(out CrateWeakPoint crateTrigger))
{
Instantiate(powerupPrefab, crateTrigger.transform.position, crateTrigger.transform.rotation);
Destroy(crateTrigger.crate.gameObject);
var velocity = playerRb.linearVelocity;
velocity.y = 0;
playerRb.linearVelocity = velocity;
playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
}```
If it never did it, I'd say the code is totally broken, but the fact it does it sometimes is... weird
where and when does the code run?
how are you doing detections?
OnTriggerEnter(Collider other)
hoenstly i think you're probably just immediately colliding with the bone after it spawns
add Debug.Log to the code for the bone pickup and the crate collision
Hmm, hadn't considered that
i bet they're both running
In fact if you freeze freame here...
you can see the bone is there for one frame
(at 9 seconds in the video)
Yeah, I just tried running into a enemy right after jumping on an "empty" crate and it destroyed them, so I'm picking up the bone
Frustrating
That needs to not happen
one approach would be to basically enable the bone's collider only after a certain amount of time has passed
Nghhhh, that's a bit much for my skill level
I could probably do it, but it'd be messy
you can use DOTween for it
See, I don't even know what that is
or just a coroutine
oh sorry i mixed you up wiht the personabove who was using DOTween
https://docs.unity3d.com/6000.2/Documentation/ScriptReference/MonoBehaviour.StartCoroutine.html
https://docs.unity3d.com/6000.2/Documentation/Manual/Coroutines.html
this will help you create a timer you can run once, or however many times you need it
Yeah, I know about coroutines and timers, a little. It's how I'm doing the powerup.
ohh thats good 🙂
Thye're a little messy. I still need to sort out my powerups code so that picking up a new powerup resets the timer.
wdym? messy in what way?
Spread out around the script
I mean you don't need to all cram it in the same script lol make a component just dedicated to enabling the collider
Makes it difficult for me to keep track in my head what's going on and where
try to avoid Monoliths for this reason
A Component per feature/responsibility usually keeps things nice and neat
so like you can make it modular where this component just runs the timer and does something after, you can plug a UnityEvent or something so it can be used for other things to run on timer ends
public UnityEvent OnTimerEnd;
IEnumerator MyTimedAction(){
yield return new WaitForSeconds(timer); //changed in inspector
OnTimerEnd.Invoke();// run something after its done -- assigned in inspector
}```
overkill but can be used for timers so you dont have to create it in a bunch of scripts
in a similar vein you can do something like this as well #💻┃code-beginner message
yeah tbh I prefer through code this way ^^
but if you want UnityEvent can be easy so you dont want to deal with Sub and Unsub yourself
things like .enabled can be toggled through inspector / unity event
Just trying to figure out where I should put everything. Things need to be in the scene to do stuff, and currently the code to generate the powerup is on my playercontroller, just because all the stuff that happens when I collide with things has been easier to organize from there.
generating powerups shouldn't be the responsibility of the PlayerController. you need to try and separate things out into different objects/components otherwise debugging is going to end up being an absolute nightmare
scanning a file that has 500 lines that do different things aint fun...been there..done that...fuck all that..
I know, I started making this prototype a while ago though and copying things from the pathway, which seems to be sub-optimal but functional in pretty much everything it teaches you
yeah they're meant more to get the concepts down
clean code comes later on usually , but its good to start early so later on you dont tell yourself "I shouldve done this other way cause now this is a mess to debug"
So I should just make the box collider off by default and then use a coroutine to turn it on after like, 1 second
simplest way yea
cute quote in that pdf
CODE IS LIKE HUMOR . IF YOU
HAVE TO EXPLAIN IT, IT ’S BAD
– Cory House, software architect and author
hey guys, is there any way to tell if someone is focused on a slider in ui?
i know the way to do it for input field on tmp but slider doesnt have a .isFocused property
not reliably iirc.
maybe Selected object from event system but even that I found gives weird result sometimes
ah okay thanks, even without it im fine, just wanted to know if there is
couldnt find anything on internet
wouldve been too hard to just give us OnFocus and OnLoseFocus events ffs.
thats exactly what im going to do, kinda of
Hmm, that's hard to figure out how to do that from the playercontroller script.I gotta turn on the collider for the powerup I just instantiated from inside a coroutine.
check its currentSelectionState to see if it is Selected
why not have the script already on the spawned object that activates itself in IEnumerator Start()
Eh, true. I was thinking I don't have any scripts on my powerup, but looks like I do
you could technically also do it from the spawner, you just need to spawn it as Collider or do a get component on the instance spawned, but having just a script for activation should not be too heavy
I'm just averse to having so many scripts, because I know I'm gonna forget where everything is. Also, if I start referencing stuff in a bunch of them I'm gonna end up creating a lot of interdependency and stuffs more liable to break.
Already feels like I have too many
you should not be worrying about the quanitity , because again.. you dont want monoliths
monoliths dont scale well in the long run
That's very few. Maybe invest in organization for the scripts though instead of dumping them all in a single folder
It's not a big enough project that I need to worry about that
Well I mean if you end up with a lot of scripts, which you seemed worried about
Im literally just finishing off the "personal project" the programmer pathway has you start then never finish
also having a script on the spawned object that manages itself solves a problem of "interdependency"
I'm gonna forget where everything is
this is going to become even more of a problem as you try and cram as much as possible into things where they don't belong.
Which do you think is more intuitive:
You have an issue with your powerups spawning in the wrong place.
Does it make more sense to look inside PlayerController.cs or would it make more sense to look into PowerupSpawner.cs
Okay but where are the other three hundred
ya fr
Eugh, collider enabler works, now I'm realizing the powerup spawns too high
That's a pain to fix
damn am i a psychic
That's not an issue with where I'm arranging my code, just where I'm telling it to spawn
Which is at the crates position
yes, but that was the hypothetical example i used
Well you saw a video of my game and the code I was using, so it's not exactly the prophetic
you're taking a joke way too seriously
not wanna brag but i have like 1800 scripts
how i manage them
is just make a folder for scripts in every scene folder
and then u have the general one which is scripts that can be seen in more than 1 scene and so on
once scene has so many scripts that i had to make categories inside based on what they are used in
but yeah, right now it wont be a proble
Yeah, with a one scene game, not a big issue
and even if it becomes, its not hard to get rid of it
are you sarcastic trying to say that your game is one scene so its a big problem?
No, I just said the opposite?
I just use logical folder names and asm defs
If on a team then ideally things are organised in a way that suits the project so people can locate things easily
god tier programming
if its just "Data" does it need to be a monobehaviour
yes I'm probably just bad at naming things
I couldn't make Square a monobehavior class
so I had to make a separate one for what I wanted to do
and I just named it that because the square's name is data technically
gotcha.. I usually use MB when I need components but for data itself usually its a SO or Struct / Poco
like in the Square script I'm writing to the variable squareName in an instance of the SquareData class and then another script reads from it
mhm I see
gtg
Hi! I just joined Unity for the first time and wanted to see if making games is actually fun and it is! I made this with just google (no AI) and with some skills I had, does anyone want to tell me tips n tricks for starting?
Is there a way to destroy a particle effect after it's finished playing? I can't just instantiate and destroy on the next line cause it'll never finish playing
set the stop action to Destroy
Oh, that's... immensely easier than what I was thinking
I guess it makes sense it would be made easy in the game engine
mhm. callback one is also very usful to run additional logic with it
What does callback do?
Too bad its a message and not an event
true its a weird workflow but its best we got :\
(the particle system stop callback) https://docs.unity3d.com/6000.2/Documentation/ScriptReference/MonoBehaviour.OnParticleSystemStopped.html
thankfully newer stuff uses events like it should have from day 1
VFX graph?
i just mean unity features in general
ohhh true
I guess it was done this way to work in js + boo too
but since those were ditched things can be designed for c# properly
just need quick help, Im trying to make a if statement that looks for the first value in a list, Im assuming its something like "Listname[1]" or something?
the if statement would search for the value of (for example) the first listed item
ok but are you looking to see if it has a first element or looking to see if that value is a certain value?
like something like if (list[0] == "MyString") {
I think I tried something like that? let me try again and see the error, prolly some weird intilization error tbh
Parameter name: index
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <59bd7c40c082431db25e1e728ab62789>:0)
GameManager.Update () (at Assets/Scripts/GameManager.cs:25)
heres my script here ```using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.SceneManagement;
using static UnityEditor.Progress;
public class GameManager : MonoBehaviour
{
public GameObject Enemy;
public GameObject GameManagerObject;
public List<int> randomRoomOrder;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
List<int> randomRoomOrder = new List<int> { 1, 2, 3, 4};
randomRoomOrder = randomRoomOrder.OrderBy(i => Random.value).ToList();
Debug.Log("randomRoomOrder: " + string.Join(", ", randomRoomOrder));
}
// Update is called once per frame
void Update()
{
//randomNumber = Random.Range(0, 4);
Debug.Log(randomRoomOrder[0]);
if (Input.GetKeyDown(KeyCode.O))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
}```
am I not making the list properly?
What line is 25?
you are redefining randomRoomOrder
in start you have a type name infront of it, which is creating a new randomRoomOrder just in your start method
instead of using the field randomRoomOrder
so the one you are accessing in Update is not the same one, and its never been initialized
I understand
You've created a new randomRoomOrder
List<int> randomRoomOrder = new List<int> { 1, 2, 3, 4};
so I should be able to refrence it like other values?
when I try that I get a The name 'randomRoomOrder' does not exist in the current context so I assume not
in start remove the List<int> part
what should I replace it with, should it be an int?
with nothing
just needs to be this randomRoomOrder = new List<int> { 1, 2, 3, 4};
you already declared randomRoomOrder above in the class
because you incuded the type again, that cuased it to redeclare it in the scope of start
instead of just writing to the one that exists already
I understand now, thank you so much
settled on this actually ```using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.SceneManagement;
using static UnityEditor.Progress;
public class GameManager : MonoBehaviour
{
public GameObject Enemy;
public GameObject GameManagerObject;
public List<int> randomRoomOrder = new List<int> { 1, 2, 3, 4 };
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
//List<int> randomRoomOrder = new List<int> { 1, 2, 3, 4};
randomRoomOrder = randomRoomOrder.OrderBy(i => Random.value).ToList();
Debug.Log("randomRoomOrder: " + string.Join(", ", randomRoomOrder));
}
// Update is called once per frame
void Update()
{
Debug.Log(randomRoomOrder[0]);
if (Input.GetKeyDown(KeyCode.O))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
}
just make it in the begining like that instead of in start since it can't access it in start
you can access it in start just fine
but because you had the type name infront of it, you just created a new thing with the same name that only start can see
instead of putting your new list into the existing randomRoomOrder field on the object
lines that start with a type or var declare a new variable in the current scope, which can shadow other things with the same names from outer scopes
So, until now, the only way I've been shown how to handle main menu and game over screens is to add a bunch of conditions to if statements to stop the game doing things while these are active, but I know that can't possibly be the most efficient way to do it, especially once your game has a lot more than like, 3 things happening, going and adding if statements with "&& isGameOver" to everything would be incredibly inefficient
So was there a question?
I guess what's another way to stop the game for main menu or game over screens?
are better ways, but if you mean " incredibly inefficient" performance wise do not worry about that, its a rounding error worst case perf wise
Well, regardless you'll have to have some sort of condition for scenes to change. If you're referring to polling from update or an event system, the later would be more advance, clean, complicated etc
Nah I just mean coding-wise. Adding a ton of if-statements to your code doesnt seem like a professional way to handle it.
No one will ever see it.
so how most would do it would be breaking there game into states or phases
and triggering stuff like the UI to change via events
Well no, but usually when it comes to something like this, there's usually a way to make it so you don't have to repeat something throughout your code to make it work
I'd just do something like this
#💻┃code-beginner message
Hmm, when I use private GameObject player; my enemies follow me wherever I go on the map, but if I use public GameObject player; they only move to my initial position
look into what else changed
also how does player get set?
if its private and you are not using [SerializeField] its no longer set in the inspector if that was your intent
Eh, it's too late at night for my brain to worry about it right now actually
I'll just change it back for now
I'll try and muster some brain power and figure out how to stop my enemy moving when gameover is true (or to only move when gameover is false)
disable the component that moves enemies when gameover becomes try
or check if its true in its update and return early
Yeah, Im trying to check if it's true, I'm just having trouble referencing it
In my OnCollisionEnter, it's as easy as player.gameOver = true;, but in update, it won't let me reference it
i would not consider gameOver to really be a property of the player
would have some sort of game state manager that keeps track of that, which is easy for things to reference
Well in my game, it currently is, so don't worry too much about that
maybe even as a singleton
You're probably accessing it elsewhere and changing the target. GameObject is a reference type (not a value type that would only be copied) so it's very unlikely that changing the accessor without anything else had create the problem.
anyone know what this new transform handle struct is in unity 6.3? Work towards DOTS and Mono union?
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/TransformHandle.html
I get an IndexOutOfRangeException by picking the spriteRenderer.sprite = overlayTiles[0]; and I'm wondering if it's because None (Sprite) is not a valid sprite?
Never mind. I had just accidentally added the script to the object twice, so one array was empty
Not a good reason to use a bad implementation. Not saying what Josh talked about is bad but if there are easy improvements that don't decrease your code's quality, then why not do it?
I personally like to split the projects where I have a typical "player" you can control into the movement component and separate it from the component that actually gives the inputs. Now the input component can raise some C# events that the movement component can then hook into. That way you can simply stop raising events when you pressed Escape for example.
with most things,
. is it an improvement if the game runs the exact same? that depends on more context. I'm sure we could find "easy improvements" in every beginners code here but theres a certain point where it's unreasonable to do. Sometimes it just isn't work spending the day "improving" something when you could be working on new features
I think there comes the difference between me and people actually getting shit done
But you're probably right
im making a 2ds platformer endless runner, but my player rigidbody keeps getting stuck on the ground objects at the seams between each ground object. i tried to use a composite collider but still the player gets stuck after a while
maybe it has to do with my sprites im using?
maybe i should try using tiles over prefab objects for the ground?
im spawning in the ground objects 1f units beside each other with the right pixel per unit for the ground sprite. shouldnt they combine into one collider?
I'm not certain I understand what you're getting at. There isn't anything inherently bad about using conditional branches.
There's no such feature. Colliders wouldn't automatically combine into one.
What collider are you using for the character? Shapes with smooth edges, like a capsule shouldn't stuck on collider seams/edges.
Info: I recall the individual trying to resolve some edge case with physics (unity box2d)
#💻┃code-beginner message
Where they're wanting to use a composite collider with tiles
Unfortunately I don't have too much knowledge with this
I was just saying my opinion in the general case. If something is bad or if something is better it's nice to hear about other options. Not more to it. Also not specifically related to Josh's case.
So I have this movement script
void Update(){
if (movementEnabled == true)
{
HandleMovement();
HandleRotation();
}
}
void HandleMovement()
{
float vertical = Input.GetAxis(horizontalMoveInput) * walkspeed;
float horizontal = Input.GetAxis(verticalMoveInput) * walkspeed;
Vector3 speed = new Vector3(horizontal, 0, vertical);
speed = transform.rotation * speed;
controller.SimpleMove(speed);
}```
Now i have a seperate script to simulate entering and exiting a locker
if (!locker && releasekey)
{
move.movementEnabled = false;
transform.position = Lockerssfs.GetComponent<Locker>().enterPoint.position;
transform.rotation = Lockerssfs.GetComponent<Locker>().enterPoint.rotation;
locker = true;
} else if (locker && releasekey)
{
move.movementEnabled = true;
transform.position = Lockerssfs.GetComponent<Locker>().exitPoint.position;
transform.rotation = Lockerssfs.GetComponent<Locker>().exitPoint.rotation;
locker = false;
}
The code works fine... 50 pecent of the time
im assuming its something strange with character controller that i dont know about since ive never used it before
any suggestions?
You might want to describe the working and non working behaviors
Working behavior: the capsule teleports in front of the rectangle and falls to the ground
non-working behaviors: the capsule teleports outside of the rectangle, then very quickly back into the rectangle and falls to the ground
Where are you setting releasekey to false?
If it's carrying over the next frame, it will trigger the locker again.
if (Input.GetKeyDown(KeyCode.E))
{
LockerInteract();
releasekey = false;
}
if (Input.GetKeyUp(KeyCode.E))
{
releasekey = true;
}
yeah i still dont know how input works in unity so i have this hacky method of doing it
If you're using the Unity character controller component are you properly addressing the synchronization of the Transform component? ie disabling/enabling the component or sync transform etc
https://unity.huh.how/character-controller/teleportation
ill get to implementing that and see if it works
You're only setting releasekey to false when the player presses the key though?
I'm using a box collider 2d for both the player and the ground objects
maybe i shouldnt use the physics system?
i just want the player to run to the right automatically forever, with new ground objects sapwning infront
Characters typically use capsule or sphere colliders, not box, for that very reason of hitting seams.
and have 3 mechanics. jumping, sliding under objects, and fliping the gravity
i tried using the circle collider but the player bounces very slightly when hitting a seam
is there no way to stop the bounce?
Make sure your general scale of things isn't very tiny, which is a common issue with using sprites.
my pixel per unit is 16
Yes, but if the scale of things shrunk down? What is that compared to a default cube which is 1 unit big?
yup, that fixed the problem. Thank you!
i placed a cube in the scene and looks like the player is the same size
so using a circle collider 2d is the best option?
Yes
Are these sections you're spawning in premade? Can you not prebake the composite colliders into them?
i have a ground prefab im spawning in with code
sec let me clean up the code
okay im calling this everytime a new ground object is made:
{
//print("test");
CompositeCollider2D composite = GetComponent<CompositeCollider2D>();
composite.GenerateGeometry();
//composite.gameObject.GetComponent<Rigidbody2D>().sharedMaterial = `new PhysicsMaterial2D { friction = 0.1f, bounciness = 0 }; // Reduce sticking
}```
so basically grabbing the composite collider and generating the geometry
code is messy right now since im just trying to get it to work
And your character is using a ridigbody? What detection mode is it set to?
discrete
not sure if the composite collider is actually updating
ah it works now! i forgot to set the box collider of the ground object to merge for the composite operation
But I have a Godot version that has all the files. It is only the unity version that I deleted of my game by pressing crt d on my keyboard ⌨️ I thought it would duplicate it.
Looking for help in setting up an isometric depth sorting system for drawing sprites in front/behind walls
I've tried a couple of methods and wasn't able to figure anything out
hello everyone, someone please tell how to share a project made in Unity with other developers !?
github is a good way to share projects
you should be able to find lots of information on how to set up a github repository
for editing the project as a team !
who can help me make a game
yes thats what git and github can help you do
!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**
then what is the unity control version for ?
unity version control is another form of version control. git is version control. you dont have to use UVC or git specifically, you just need to use one
so this is my current debugging- the yellow tile wall visualizes walls that should be drawn behind the player. the green visualizers show walls that should be drawn in front of the player
I am having trouble with manipulating the order in layer property for the player and the walls
so please help me in using and setting up UVC !
i dont use UVC, most people here dont. no matter which one you choose, first consult google
my teammate added me as a user but I'm not able to see anything of the project
Did they upload/push the project/changes to the remote repository?
And did you pull them to your local environment?
I'm able to access the project through the option " Add From Repository " but after opening the project in editor nothing is showing !
Then they(your teammate) probably didn't upload their changes correctly.
Also, I'd recommend using the standalone gui client instead of the editor plugin. You can then share some screenshots that would make it easier for us to help you.
don't know enough about unity and plug-in thingsnow , cuz we are totally beginners 🥹
Then you should put some minimal effort into learning this. There are plenty of tutorials online as well as the unity documentation/Manual.
We can't help you if you don't understand what we're talking about.
Hi! I'm currently going through the Creative Core tutorials (https://learn.unity.com/pathway/creative-core), it's great! Still I like to envision "my game" alongside it, which is a Civilization clone in its essence (hex-grid, 3d, procedurally generated). I'd love to have one thing clarified though: In an attempt years past I worked with planes which had ~50x50 hex tiles on them and I used texture splatting to merge the tile types (grass, sand, ...) with each other. Later I'd add bump mapping and other fancy effects to it. My question is: Does this vision sit right? Is that how things are done? Or should I e.g. use DOTS to or some other fancy batching & instancing technology I haven't learnt yet to draw each hex separately?
Having that cleared up would help throughout the tutorial: How to bake lighting, which systems to use, do I need tesselation, etc.
I need help, idk how to make a lock on system with cinemachine and i can't find any up to date videos which can help me.
There's a lock on sample in the cinemachine samples if im not mistaken
I'm having an issue. When my enemy collides with my player, if the player has a powerup, it's supposed to destroy them, which it does do, but if they don't have a powerup it's supposed to set gameover to true, which it doesn't do. So I'm a little confused why only half the if-statement is working.
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.TryGetComponent(out PlayerController player))
{
if (player.hasPowerup == true)
{
Destroy(gameObject);
}
else
{
Debug.Log("You are ded.");
gameOver = true;
}
}
}```
Hmm, wait, no ,thats not true
It's setting the clone to gameover but that's not changing anything in the game
Guess you figured it out 😉
I guess I should reconfigure things and put gameover in the scene manager. I guess the issue is that clones don't work for this?
You are mixing several states here. CollisionEnter is happening on another object, if I understand you calling player via trygetcomponent. SO you are setting gameOver on your object where the collision method is happening. What is that object?
And who or what should react to gameOver being true? How are you accessing it?
You might read about events and have one source of truth for your game, so you know what your actual state and not letting several objects handle the state 🙂
It should stop my players movement
void Update()
{
if (!enemyScript.gameOver)
{
MovePlayer();
}
ConstrainPlayerPosition();
}```
Where is "enemyScript" coming from and is "gameOver" static or just a public value?
why is this gameover var on the enemy?
I couldn't tell ya
ideally you would do something like player.Die() and then let the player object control its state
can anyone help me with collisions?
bleh i meant to write game over var 😆
Perhaps this is why its not working?
we'll need more info about your specific question
https://dontasktoask.com
The better design would be:
- enemy collides with player
- enemy tells player to take some damage/die
just to clarify, enemyScript is just one instance of your class in your scene. If you have mulitple enemies, they all hold their own state of gameOver unless you are making a static value out of it. But that would be counterintuitive because the gameOver state is aglobal game state, not an enemy one
btw, you don't need the == true.
Yeah, accurate
I'll end up doing that occasionally because I'm just writing it out how I'm thinking it in my head
lol okay, so I have a player script and all that works fine, but I made the player a capsule (bean) and the collisions are really off...
how can I fix that?
Do not conceptualize your logic while writing it 😄 That will give you at least a big pile of yummy pasta, but no well structured code 😄
how exactly are they "off"? we aren't psychic, you're gonna have to be more descriptive
are you using a rigidbody/character controller? how are you moving the player?
that's the movement script if you are wondering:
// Forward
if (keyboard.wKey.isPressed)
rigidBody.transform.Translate(0, 0, MovementSpeed * Time.deltaTime);
// Backward
if (keyboard.sKey.isPressed)
rigidBody.transform.Translate(0, 0, -MovementSpeed * Time.deltaTime);
// Left
if (keyboard.aKey.isPressed)
rigidBody.transform.Translate(-MovementSpeed * Time.deltaTime, 0, 0);
// Right
if (keyboard.dKey.isPressed)
rigidBody.transform.Translate(MovementSpeed * Time.deltaTime, 0, 0);
and I am using a RigidBody
You could go to basic pen and paper and just write down what entities you are going to have in your game. from there, you can easily branch out and add objects that listen or react to states of global events and values
if you have a rigidbody, why aren't you using it
you're fighting the rigidbody over control of the transform
its a bad idea to use keys directly like this
I am? I started yesterday with a little CS in my head
Try using the CharacterController component and use the Move() method in that component.
you arent, you are just moving the gameobjects position which bypasses physics
this is not using the rigidbody to move
ahh I see, so how would I do that? since I did AddForce but that made the character go really fast
this is bad advice, given that they already have a rigidbody
lower the force you added then
but AddForce() will add more and more force no?
you set drag correctly on the rigidbody
and there is linear damping and friction that will reduce it
is there a way to max that?
you would not want to max that
ahh I see I did play around with em..
got it
there is also an option of setting the velocity
make sure you're working in FixedUpdate if you do AddForce with continuous forces as well
oh? that would be better then no?
not "better", just different
got it got it, I just tried fixed update with the new InputSystem and it worked... 20% if I spammed it and with Update it worked perfectly
yeah inputs are frame-bound
alrighty, so:
Movement in FixedUpdate
Input in Update
and not change position but the velocity?
You also want to change your input to be vector2 which you read with ReadValue<Vector2>()
sure, that could work (one of many ways)
that One Method almost made me rage becasue I did:
mouse.delta and not mouse.delta.ReadValue()
like why do I need to read the value?
Okay, I jury-rigged it, it's working now, enemies and players stop when they collide and gameover is now true
because it's an InputAction, it's part of the system
basically to optimize it?
and when I wanna use it Ill read it?
not optimization, no. it's to make a coherent/consistent system
example from something i did recently
//Movement
Vector3 input = inputs.gameplay.move.ReadValue<Vector2>();
//Change speed
input *= MoveSpeed / Time.fixedDeltaTime;
//Make local
input = rigidBody.rotation * new Vector3(input.x, 0f, input.y);
rigidBody.AddForce(input, ForceMode.Force);
ahh got it
why the / Time.fixedDeltaTime
inputs? is that using the new InputSystem?
yes, i used the option where it generates a class for you with your input actions
ooh that's sick
this is done in fixed update and i guess i wanted to keep my old values 😆
that's not what my concern was about
but i see it's being used as an acceleration now rather than a deltaPosition
it was something i did ages ago that i recently changed a tad to use force instead of velocity so I just fudged it a bit
nothing important anyway was just for fun
(does that even make sense with /deltaTime though)
i guess it does, kinda...
I probably tried it, stuff seemed to work and that was that 😆
i think it does work, im just having a hard time figuring out the values lol
hey so like I have an enemy in my project that I want to move towards the player but I'm not sure how to actually get the angle it needs to move in
everything else is pretty easy but ya
Think in direction vectors, not angles.
wdym
if the enemy and player are on the same "plane" (a flat floor) we just need a direction from the enemy to player
You're gonna need a vector to move the object, not an angle.
Vector3 direction = enemyPos - playerPos;
direction.Normalize();
If you don't know what vectors are, you need to learn them NOW!
You're not allowed to work your game until then.
wow
That's right the game police will get ya
or as a one-liner, (enemyPos - playerPos).normalized
(but also should be playerPos - enemyPos if you want the direction from the enemy to the player)
Yes my bad I did it backwards.
It's targetPos - myPos @balmy vortex
always get caught up on that myself lol 😆
not an angle, but a direction vector (once normalized)
oki
you have the right idea, but it's important to make these distinctions, because they mean very different things mathematically
We can produce a rotation from a vector3 but that is an additional step
(you should learn vector math on its own though, fwiw - once you internalize it, it lets you understand what you're doing a lot more)
out of pure curiosity how does this work btw?
like how do you get an angle from 2 positions
imagine position vectors as arrows pointing from the origin to some point in space
the length of that arrow along each axis is the size of that dimension in the vector
geometrically, adding vectors looks like putting the vectors together, "tip to tail"
negating a vector looks like reversing the arrow
thus subtracting a vector, say a - b looks like reversing b and then adding that to a, tip to tail
that ends up being equivalent to an arrow pointing from b to a
you could also view it as changing the origin - a - b is asking "what is a, relative to b?"
like 5 - 3 -> 2, you could view it as 5 is to 3 what 2 is to 0 (0 being the "origin")
this will probably make a lot more sense if you understand vector math itself
Why do I not have LoadScene showing up?
Did you make your own class with this name?
Possibly? Yes, I did
Hi,
Why does it appear as "Not Connected" and "UNKNOW" even though my device is connected?
I am new to VR and it would be nice if someone could help me.
VS makes it easy to navigate to the class definition so you can do that in future to see what's happening
Can anyone tell me why m_MoveDirection.y flickers between values? I can see it in the inspector https://pastebin.com/nG0ayqCX
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Please ping me
Okay, renamed things, works now
really, i haven't found it, do you know where it is
It's in the samples. Package Manager > In Project > Cinemachine > Samples.
It's also stated in the documentation: https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/samples-tutorials.html
alr thx
what's it flickering between?
0 and -3
Oh, got it, I know exactly what's causing it
this right here
private void GetMovement(Transform transform)
{
if (m_CharacterController.enabled)
{
Vector3 vector = transform.right * m_MovementInput.x + transform.forward * m_MovementInput.y;
m_MovementDirection.x = vector.x;
m_MovementDirection.z = vector.z;
// Insert sliding here
m_MovementDirection = m_MovementDirection.normalized * CurrentSpeed;
if (m_CharacterController.isGrounded)
{
if (m_GravityPower < -1f)
m_GravityPower = -1f;
}
else
{
m_GravityPower -= m_Gravity;
}
m_MovementDirection.y = m_GravityPower;
CollisionFlags collisionFlags = m_CharacterController.Move(m_MovementDirection * Time.deltaTime);
if (m_GravityPower < 0f)
m_GravityPower = 0f;
}
}
if (m_GravityPower < 0f)
m_GravityPower = 0f;
is m_GravityPower also flickering? (use the debug inspector)
not m_Gravity, mind you
it seems like you keep applying gravity and then stopping
what's with the m_GravityPower <= 0f anyways? that's a normal situation, but you're resetting down velocity there
Okay I changed it ```cs
private void GetMovement(Transform transform)
{
if (m_CharacterController.enabled)
{
Vector3 vector = transform.right * m_MovementInput.x + transform.forward * m_MovementInput.y;
m_MovementDirection.x = vector.x;
m_MovementDirection.z = vector.z;
// Insert sliding here
m_MovementDirection = m_MovementDirection.normalized * CurrentSpeed;
if (m_CharacterController.isGrounded)
{
}
else
{
m_GravityPower -= m_Gravity;
}
m_MovementDirection.y = m_GravityPower;
Debug.Log($"Y Gravity: {m_GravityPower}");
CollisionFlags collisionFlags = m_CharacterController.Move(m_MovementDirection * Time.deltaTime);
if (m_GravityPower < 0f)
m_GravityPower = 0f;
}
}
also note that Physics.gravity is acceleration, so you need a deltaTime here
m_GravityPower += Physics.gravity.y * m_Gravity;
But it's still doing the same thing
yeah I tried but
it doesn't let my player jump properly
you would have to increase the m_Gravity to compensate, i believe
the character controller is only "grounded" if it was pushed into the ground
you need to apply gravity even when it's grounded
Okay, but when I do that, and when I jump, it's more of a snap then snap back more than a jump
Okay
So what do I do about that? Like code wise
you're still resetting gravity every frame here
if (m_GravityPower < 0f)
m_GravityPower = 0f;
you apply gravity when it's grounded, like you had in the code you sent originally
Oh so I just do this, just without the last if
private void GetMovement(Transform transform)
{
if (m_CharacterController.enabled)
{
Vector3 vector = transform.right * m_MovementInput.x + transform.forward * m_MovementInput.y;
m_MovementDirection.x = vector.x;
m_MovementDirection.z = vector.z;
// Insert sliding here
m_MovementDirection = m_MovementDirection.normalized * CurrentSpeed;
if (m_CharacterController.isGrounded)
{
}
else
{
m_GravityPower += Physics.gravity.y * m_Gravity * Time.deltaTime;
}
m_MovementDirection.y = m_GravityPower;
Debug.Log($"Y Gravity: {m_GravityPower}");
CollisionFlags collisionFlags = m_CharacterController.Move(m_MovementDirection * Time.deltaTime);
if (m_GravityPower < 0f)
m_GravityPower = 0f;
}
}
Whenever my player jumps though he just kinda suspends in mid air, he doesn't go down. And the gravity power doesn't go down either, just kinda fluctuates
OKAY
GOT IT
Thanks @naive pawn
wait
no, my player doesn't move now?
Okay had to take out the normalization, thanks
huh? you should have normalization
Well without it, I slow down
No idea why but I am like super slow
I found out normally I'm able to move around, but after I jump, it slows stuff down
Can anyone PLEASE help me? When I jump, my movement halves https://pastebin.com/uKZFqaXD
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Please ping ne
Why is a method that does not return anything called "GetSomething"..?
you have 2 things calling Move that could be happenign in the same frame overwriting what the previous has done
you also end up normalzing the movementDirection even when you are adding your jump direction to it
which means the movement on the xz plane would be less
I made something in Unity. And I made the same thing in Java and without using an engine and it was way smoother, like it was both pixel art and the Java game seemed way smoother. I firstly thought that Unity is like this. But then I noticed that X values change the position a lot. Like 1 is a huge jump upwards, and in Java 100 is not even a lot. Is this a reason? When it's falling using my own and Unity's physics, my own is smoother
the position shown in the unity inspector (and logged) has reduced precision to make it easier to read
there should be no issue unless your positions are super big or are doing something else bad with physics
I am using RigidBody2D
I didn't change anything in the RigidBody
Or is it just FPS in unity is lower?
Note: Both games were run on an Android (Android Module)
You need to share more info for us to help. You can consider using interpolation, increasing the physics step frequency in the project and only applying force in FixedUpdate().
The game fps is not linked to physics processing frequency
Okay I will try looking into the values that I could change in the RigidBody 2D
Thanks!
hello haveing some issues with navmesh any help is appreicated
!ask
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #🌱┃start-here
Read all the bullet points, not just the first one.
i have im confused what your saying i have looked online ive looked a videos i looked at manuals so on
ok, what does the very last bullet point in the bot msg tell you to do? The one with ❔
okay thankyou now i understand
guys when do i use mathf.PI
Whenever you want
i meant how do i use PI then
That question doesn't make much sense. It's pi, it's used for calculating circumference and area of circles among other things. You don't need to plan beforehand when to use it. If you ever happen to need it you know it's there
this question makes sense. with that i mean how do i use PI to move a car based to a wheel speed. but idk. thats why i wnat to know
Whenever you need Pi
Then why didn't you ask that
Do you know what Pi is
no but i only know thats based with a circle and has a special number with alot of decimal places
Time to learn math then
or someone just tell me how i use it. thats 5min
Then first you're going to need to learn some basic geometry
in Germany we learn it more later
That's not how it works. It's not like a hammer that has one way to use. It's like asking "The car has 4 wheels, someone just tell me when to use 4 and how to use 4 to move the car"
If you want to calculate how to move a car based on how fast the wheels are spinning ask that (with details) and maybe pi is part of it, or maybe not
As you can understand, the object that I pick, doesn't move smooth, I couldn't find a solution can someone help?
please share your code. nobody wants to scrub through a video trying to decipher what your code is doing
📃 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.
showing your code in video format is a new one 😄
Sorry, I don't know that "code block" thing.
Sure.
first time ?
also you outta show the actual rigidbody inspector / settings
MovePosition is mainly meant for kinematics btw
Go to a website linked above, like https://paste.mod.gg/ paste your code -> hit save -> send link here
A tool for sharing your source code with the world!
A tool for sharing your source code with the world!
Done.
Object (Cube)'s rigidbody
have you tried switching it to kinematic on pickup ?
on pickup try doing objectRigidbody.isKinematic = true;
Sadly, it is not. Not even close to new
Yea I tried now but now, when game begins it stays at air.
Doesnt fall.
At least this one was a screen recording and not a cell phone video
worst way i've seen to date is showing code in a gif
Oh
Now it worked.
I meant only on pickup.. right now it looks like Gravity is trying to fight whatever forced moveposition you're doing
movePosition is mainly used on kinematics according to the docshttps://docs.unity3d.com/6000.2/Documentation/ScriptReference/Rigidbody.MovePosition.html
I forgot to disable kinematic on beginning. I did it and worked. Thanks for helping!
its smooth now ?
It is.
Hello! I have this project where arrows are being shot and sticking to walls and objects using a raycast at the tip of the arrow. I have this inconsistency where the arrow sometimes goes through the wall and the raycast doesn't detect anything because the arrow is going too fast. I have set the arrow's rb detection mode to continuous and the wall doesn't have a rb so I kept every setting as is.
I've thought of starting the raycast at the tail of the arrow so I can make it bigger and let it have more time to detect but I am not sure if that's a good idea in the long term. I've done a bit of research and I was wondering, is the Job System something that would help me fix this? I saw people are using it to detect collisions for bullet hell type games but in my scenario I only have a single arrow being shot every 2 seconds so it isn't as frequent.
you should show your code
in genral if you're using raycasts for collision detection the collision detection mode on the rb is irrelevant
Thats my update function in my arrow script :
https://paste.ofcode.org/39GtrXmNRCqvQwCANnHpdEX
show the full script, but already there's a huge problem
you're using this arbitrary constant of 1.75 as the distance
I was just messing around to see if setting it longer worked
show the full script so we can see how the arrow moves
this isn't the full scirpt.
it's not clear what startingPos is, for example
but basically I would expect something like this:
// FixedUpdate for physics, not Update
void FixedUpdate() {
if (Physics.Raycast(rb.position, rb.rotation * Vector3.forward, out RaycastHit hit, rb.velocity * Time.fixedDeltaTime, layersToHit)) {
// handle collision
}
}```
Sorry Its handled in two different scripts so I tried putting the parts that are related to shooting the arrow
sooo, unity doesn't automatically setup visual studio to work together by default?
!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
not really
it does if you install it from Unity Hub
didn't have these options until i manually went to the package manager and downloaded the visual studio editor pkg
Unity cannot assume you will be using Visual Studio if you're on an OS that doesnt use VS
visual studio editor package is installed by default, are you certain you didn't remove it yourself?
but yeah the hub installs VS with the proper workloads but you still need to select it and stuff
yup 100% certain, i'm going through some tutorials and my IDE wasn't autocompleting anything that's why i looked through
the top one is the proper one, the one you selected looks like you done through Browse..
oh it vanished now lol
it's because i used browse to add the devenv.exe manually
but of course only manually downloading the package worked
you just need to try Regen Project Files and open script from unity, then check VS make sure it loaaded
but everything works now
aye did the finally remove the old one?
cant seem to find it anymore.. it used to show alng side
if they did.. and they default to the one that works for both thats awesome!
what part don't you understand
https://screenshot.help
also you need to be more specific about what you are not understanding
Collisions with pickups and projectiles
Okay
and they were never heard from again..
How can I apply "on click" changes to a prefab? I cant select a empty object (manager) to the prefab. and I also tried putting the prefab onto the Hierachy and added it to that one and then clicked "overrides - apply all" but it changes nothing. as seen in the picture there is differences there, but the left one will never update no matter what I do. it updates if I changes the color but not the "on click"
most likely because its a scene component you're trying to apply to a prefab? that wont work
yea but I cant apply it from within the prefab itself (not in scene)
are you in a prefab stage? (when you open the prefab to edit)
are the scripts on the prefab though ?
thats the thing, I cant apply the scripts onto the prefab
If those 2 unity event subs will not apply then they surely point to SCENE instance objects
if the scripts live on the prefab you can apply it to the original prefab , if the scripts live in the scene you can only apply them to Instances of prefabs not the originals
The instances of BreadAppears and Scriptmanager specifically
Idk he just left me 🙁
so having a prefab to spawn individual things in the scene is pointless then?
you never actually provided an answer to the question
A prefab can only refer to other assets or components within itself
This is why the changes will not apply as they are not able to be stored in a prefab asset
^ i did respond to the question
That's literally what it is for
thats pretty vague
and yet, you were also told to be specific which that certainly is not
you have to explain whats happening vs what you expect to happen for starters
You seem to have accidentally hit enter before typing out the rest of your question. Common mistake, you can Shift+Enter to make a new line without submitting
Is it common to become frustrated over coding and Unity Editor? Lol.
Sometimes I become super annoyed and have to keep going until it is fixed.
okay but im trying to add the scripts content (hit in this case) to the actual prefab, so whenever the prefab spawns onto the scene, I can click it. but considering I cant add things to the prefab it seems pretty pointless lol
You can never click on a prefab
some times? idk thats like common to be sitting in traffic yelling at the windshield for the bad drivers causing it
we are going in circles my man
That's funny.
You need to add an on click to the instance you create from it
right,. but the prefab is "spawning" the object. and those object doesnt have the scripts on
What’s happening is I don’t know how to add a collision to an object or projectiles
prefabs.. don't really do anything
other things can clone prefabs, if that's what you're thinking of?
So set the value you want on the one you just spawned after making it
I think that maybe sometimes it is better to take more frequent breaks.
did you start by googling how to do that?
put a collider on it and you get collisions. simple as that
(i mean thats if you move it via physics ofc)
<pedantic>you would also need a dynamic rigidbody for collisions</pedantic>
So I have to set that specifically within the script itself?
Whatever script spawns the instance can set whatever values you need it to have
I’m not allowed to lol
Like a box collider?
very much so.. your brain needs time to "cool off"
coming to a problem you been stuck on you will then solve it in like a few minutes cause your brain is sub-consciously working it out while you focus on other things
yeah i sincerely doubt that
the shape is irrelevant, as long it has collider and you move rigidbody with it
you aren't allowed to research information, but you're allowed to ask internet strangers for help?
also googling your issue is the first step for getting help here
#🌱┃start-here
You can doubt what you want im in the class you’re not
Yess
If google isn't allowed, having us write the code for you definitely isn't allowed
I’m not asking you to write it for you
Maybe go back into the lesson
I made cool drawing to explain
damm i need those art skills
then what are you expecting to get here if you don't even understand what you are doing? how could we possibly provide the answer to you if you cannot even use google to get a grasp on the concepts?
what part of the class is saying that
what kinda class teaches coding shit and not allow googling issues..sounds terrible teacher
the internet is a massive resource
If this is some kind of test then us answering would be cheating. Ask your teacher.
way better than us, usually - because we got a lot of our info from the internet too
Because you could tell me
Wdym the teacher said that
so you want us to google, and then copy the answer for you, so you don't have to use google yourself?
so you don't want us to do the work for you, you just want us to do the work for you?
so if the teacher wants you to figure it out yourself, then we can't help you 
thats not how development works
the whole point is for you to learn how to figure this stuff out
I see. but yea ive no clue how prefab works more than its a "object" i can spawn onto the scene with the same informations each time. I always have to work around it, by making a ton of the same objects and make them "setactive" false and true xD.
problem solving is like 90% of this field
real talk - you gotta learn to help yourself. using google is the most basic form of finding information in this day and age
if you dont learn how to problem solve, what you even doing
Something similar to that maybe not just give me the answers but try to explain it if you can
I mean explain it without just writing the code out for me
A prefab being an asset spawned into any scene is why there are limitations. It has no way to know or refer to something that may possibly exist in some scene that may be loaded. That is why the reference is not possible in a prefab asset.
anyway refer to my cool picture above if that helps 😄
The teacher said I could ask people but not use Google
A prefab is a gameobject that exists in a file, not in the scene. Instantiate clones an object, wherever it is, and puts a new copy of it in the scene
and yet, how are you going to implement it if, by your own admission, you are struggling with understanding c# and you don't understand what you are doing?
You’re going in circles bro
If you literally do not know what a collider is you need to re-do the lesson
maybe I can become a teacher too.. how are these quacks teaching...
This is kind of a fundamental gap in knowledge
i'm literally not, you're just avoiding answering so it seems like i am because i'm still asking the same thing
Bold of you to take the word of someone trying to get us to do their homework for them at their word of what the teacher said
yea and thats how my "objects" spawns, via Instantiate
Thanks. May I show you what I have created?
Instantiate returns a reference to the object it just made. You can set variables on that
@full axle if you're missing the basics, we can't practically help you.
you need a certain foundation to be able to understand and apply the answers we give
if you want us to just give you an answer and then blindly copy it without learning, you won't be able to apply the knowledge forwards and you'll still need help in the future for similarly simple tasks
but it only spawns as it is, with a random range on the screen. but has no variables attached to it, which I thought I could do via prefab xd
If it has "no variables attached to it" what are you trying to change
do i need to draw another cool picture?
very true lol
now it suddenly "works"
they have channels for showing off work like #1180170818983051344
it has the variables now once spawned in
Hello, I have this problem. The character will only move horizontally with the A and D keys. However, the direction it is facing is not forward, it automatically rotates itself. How can I fix this?
show us the code
oof.. this is visual scripting.. #1390346878394040320
no visual scripting channel
xD im just stoopid to understand probably xD
okey thanks
Its easy to first think "its right there, why cant i reference it!" but when we understand more what a prefab and scene does it makes more sense.
but now my things spawn in with the correct "onclick" actions, but now I just have to figure out why its not "doing anything" :D.
I noticed once I was refering to the object, I forgot to select my manager and locate tht reference
Im sure everyone here can tell me whats wrong in this script. I cant see the "you hit 1 bread" or the "hits" increasing once hitting the bread that spawns. im sure you would be like.. ah no this is so outdated...
!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.
my eyes..
get urself some glases, it helps. promise
sunglasses, maybe
What calls StandardHit
its the "onclick" action on the actualt spawned object
brother.. you gonna be blind if you keep coding like this..lol
Have you confirmed the function is actually being called
like with aa debug log?
That'd be one way, yes
what's the error?
ive glasses, im fine xd
we're joking about the lightmode
remove the using System.Diagnostics; at the top of your file
pay attention to your suggestions, make sure you're importing the right thing
(on that note, you also shouldn't need the UnityEngine. on the quaternion where you instantiate)
I didnt even import that one myself so no ide where it came from, maybe from another "solution"
you selected it when autocomplete suggested it
sometimes the IDE will put that in
I think it grabs the one with System.Diagnostic first cause S comes before U so gets suggested before UnityEngine one
not being called. considering its not even saying anything in the console from the debug log
cool, then check where it's supposed to be called from
So then that would be the problem, not any of this code. If it's not even being called then nothing in the function matters
I'm not good at navigating here so excuse myself :')
you good
dunno where else it would be called, could it be because the reference is a different "object type" than my other buttons hence to why its not "pressing" ?
I have no idea what any of that means.
for example if ur in a 3d map you cant select 2d objects or so etc xd
nvm, I cant make a object from the canvas into a prefab as it just turns it all invsibile xD.
: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
you can...
Did you spawn it back onto a canvas
the prefab usually puts it in a canvas so it can be previewed
there is a right way to do that?
i post pretty much anything into the canvas
do what exactly?
Do what
i have a custom class that saves 2 min max sliders to create a rect on the screen
you only need canvas for UI
i couldnt find a direct way to set the rect data from a min max slider than creating another rect with that info then replacing things
but how else am I suppose to see the objects? the canvas shows whats on the screen xD
you don't really need the refRect? you could just do a little math
which objects are you talking about? 3D / 2D objects in the world need a camera
The canvas is for UI. If it's not UI, you shouldn't be using UI renderers for it
i can, but first i had to convert the values.
or you could also just do balao.rect = Rect.MinMaxRect(...) directly
you aren't converting anything there
i know, i didnt do the corrections yet
well the first one (the one I aked about before and got it to work) was a 2d sprite on the camera, while the ones on the who turn invisible as a prefab are raw images from canvas xd
sprite renderer (its just a quad) should only be viewed with camera
Image and other UI needs a canvas yes
RawImage is a UI component. UI objects need to be on a canvas to be visible
i just tryed :/ it dont allow me to move recttransform.rect directly
oh yeah, it is readonly. i didn't notice that note in the docs, mb
yes, and thats what I tried first, but when I make it into a prefab its just invisible once I put it on the canvas aagain (from prefab)
nah
you can just do some math then if you don't want the refRect
Is it actually spawned in as a child of the canvas
can you show what you're making into a prefab so we know if it even was a RECT transform and actually viewable in canvas
Just a screenshot of the full unity window with this invisible object selected
yes its a child of the canvas
Let's just go with a full Unity screenshot of this
i dont have a problem using a "copy" from a created rect... i just needed to know if there is a better way
i can do the math to create the rect
i just dont wanna to that😅
of the canvas?
it was a pain in the ass to create the preview on node correctly to convert again i guess it would be the same
Of the whole unity window, with this object selected, and where it's supposed to be visible
Can't you do balao.rect.Set(data.balao_Horizontal.x, ...)
i cant directly... the values from the class comes from a 2 min max sliders
one to vertical value, other to horizontal value
Yeah that’s what I’ve been doing in class that’s why I’m here
oh. so when I put it into the "scene" its invisible, but when I put the prefab under canvas section then it shows up correctly. I thought it was under canvas the whole time
you can though? width is just xMax - xMin, which you clearly have
i know
the problem cames when i have to convert from the preview i made
so, let me elaborate a little
yeah we do not have any context on what you're doing
I don't see any reason why it wouldn't work in the context of your screenshot. Do you get an error trying it?
now it works
The .rect = might not work if balao is a property instead of a variable
but the .Set should work fine
yeah RectTransform documents that rect is readonly from a script
Had a feeling that was the case, otherwise why would the Set function exist at all
i made a custom node system to make a dialogue system.
currently i made a way to make a preview to replace character position and size...
then i realized that i fucked with the popup-dialogue ballon.
then i had to make a preview editor to the ballon as well...
the character is a vector2 for position and a float for size...
i tryed the same form the rect ballon but one of my coworkers asked to do the size of the ballons with sliders...
with 4 sliders was a lot strange to modify the it. so i changed to a min max slider...
then we got here
the pink square ****
currently im re drawing the preview/editor to the game
how do I make so it spawn under the canvas as a child and not as a "object" below canvas (not on the canvas) ?
Check the documentation for Instantiate and see how you might make it spawn as a child of something
the Instantiate method has an overload that allows you to specify a parent object
okay
I know this is more UI issue and willing to write a script for it if need be.
How to have the TMP Input Field follow the text of the user rather than it cutting out through the objects boundaries? (It isn't set as "Trunicate")
The code will be easy. Just don't want to have to create a script for a little thing if it can be done in Editor.
so should have asked in #📲┃ui-ux 😉
sounds like you want the inputfield to change size, growing with the length of the input text.. look into the layoutgroups, layout element, content size fitter
I know. I did earlier hehe.
Just cannot move on until it is fixed. Sorry xD
Cheers. I tried with horizontal preferred size CSF on the Text object.
It is very possible that it's the layout group parent object of the input field?
I am trying to use unity ecs but based on the tutorial that I am watching it asks me to add game object entity into my gameobject which will convert the monobehaviors into the components of an entity
I'm not sure whether it is version problem or I did the setup wrong
But for some reason I can't find the GameObjectEntity thing
probably better off asking in #1062393052863414313
Okie dokes
Can we ask about NodeJS here? Not about coding help, but a question about something.
is it unity related? i presume not
It can relate to it but yeah not a part of it. All good.
Gotchu as Chris said f*** off to the Node server, stat! DM me bro. We can talk React after too 
(it's a joke he didnt say that)
you could ask in the official node server, nodeiflux
vanity invite nodejs
(fyi - dm support is generally inferior to community support, communities exist so many people can see the question and also vet each other's answers)
Hey guys, what is your #1 technique to achieve smooth camera rotation? ⭐
I've tried smoothing lookStickX and lookStickY like with Mathf.SmoothDamp, independently. And I've tried combining them to use Vector2.SmoothDamp too
I haven't tried doing any curve.Evaluate() yet but, maybe that'll be better.
Oh darn maybe the Unity inputactions asset can do smoothing in the pre-processors.
hey everyone! i made a cool app for Quest 3 that i’ll opensource soon. looking for help with some coding and design! tried to make a ReadyPlayerOne \ Dr Strange reality portal
if you want early access to the APK + Realtime Video2Video model, drop an emoji and i’ll DM you
isn't there a Quaternion.SmoothDamp function? apparently not
we don't allow advertisements here, sorry
if this is a unity project, feel free to make a #1180170818983051344
I have another question, Now that I manage to get my object to spawn correctly, under a parent and such, how do I make them "dissapear" once clicked? I cant simply ".setActive(false)" because they are from within a prefab and not a specific object per say. I can only stop them from further spawning but the ones who have appeared will always stay and not get deleted. how can I solve that?
where do i ask for help w/ this project so? dev-logs?
camFollow.transform.rotation = Quaternion.Euler(targetYaw, targetPitch, 0.0f);
Gotcha so, instead of this, I could use nevermind, Quaternion.SmoothDamp doesn't exist
Call setActive on the one you want to disappear
but they are clones, I want the clones to disappear
for specific questions, you could ask in a relevant channel, but we don't allow collab seeking posts here
!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**
...then deactivate the clones
make sure to check #📖┃code-of-conduct as well, seems like you haven't
as I said, call it on the objects you want to deactivate
yea i get that, but I cant see the clones til the game starts as it spawns in aafter some time. when I deactive the "reference" of the clones, it deactives that one but not the "clones" who already has spawned
Well, I can just Quaternion.Slerp() towards the desired rotation. I know it's funky to use Time.deltaTime together with that but, it feels so good Tbh.
my Player rotation works that way, because .RotateTowards felt janky/choppy
If you call SetActive(false) on an object it will deactivate that object. If you want it to deactivate a different object, call it on that one instead
you mean with wronglerp?
it's the wrong lerp to use?
no, i mean a wrong usage of lerp
oh, yeah exactly
https://unity.huh.how/lerp/wrong-lerp this thing
Applying lerp so that it produces smooth, imperfect movement towards a target value.
im asking whats the correct way to make a spawnable object to be disabled (dissapear), I just stated that the SetActive one doesnt work
Why not
That's how you disable an object
If you call it on the object you want to disable, it'll disable it
because each clone gets a new name so I cant simply just "select one"
the name is irrelevant
What do names have to do with it
you need references to each one anyways if you want to manage them later
how else am i gonna know what to disable lol
How do you know which one you want to disable
not with names. you generally should never rely on names