#π»βcode-beginner
1 messages Β· Page 621 of 1
so what do i do ?
is the code the problem .
and thats the one that u can figure out now that you know the trouble after troubleshooting
give me the screenshot of your project
your whole screen ig
I forget the exact details of it all, but you basically need to negate the bits and add one to the bitfield to grab the lowest bit. Then flip that one and repeat. It's not exactly some 0(1) operation as it requires a bit of back and forth
Still quicker than iterating over a 64 bit enum that's for sure
you can just Enum.GetValues(typeof(MyEnum)).ToList() and iterate it
check if it has Flag
Why do that when you can just do what I said above and cut out the allocation ;p
sorry I dont follow?
GetValues would return all bits, you'd have to checkflag each bit, no?
thats how you're supposed to iterate an enum, based on the original question
int lowestBit = bits & -bits;
bits &= ~lowestBit; //remove lowest bit
I think that's the idea assuming you can use unary minus works otherwise I think it's just ~bits+1
and the lowest bit would be a selected choice^
remove? proly you meant masking?
from the mask ye
from what?
I've done this before somewhere but can't recall what project that's in. I don't usually iterate over the bits
thank you guys
anyone used aaron's a* and have adjusted the pathfind width before ?
is it reasonable to make a static version copying a method that accesses an instance variable like "timer" in a class whose GameObject will be deleted when I want to access the instance data?
Can someone help with this code? I'm trying to make it to where if i press escape while in the settings menu (which is a button in the pauseMenu) it goes back to the pause menu. Here's a screenshot of what it looks like:
!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/, https://scriptbin.xyz/
π 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.
the code that I had in the screenshot: https://pastebin.com/kTxFRpBN
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.
is there a reason that overlapCircleNonAlloc uses arrays and not lists?
You wouldn't need to reinitialize the list every time either, or am I misunderstanding what list.Clear does
An array has a set size, but a list can expand, therefore, taking up more memory if the OverlapCircle returns a different number of colliders . . .
Makes sense
however, would having a list instead be better if your collision results vary from hitting 1 vs 500 gameObjects?
Or is that not where the performance drops come from
Then it will not be a nonAllock version
I see
Resizing the list would result in a memalloc
It's NonAlloc because if the first overlap check hits four enemies, and the second check hits six, only four will populate the array because you cannot change its size. With a list, it will add the two extra hits (allocate memory to hold them) during the second check . . .
The trick here is to supply an array with a size of the max result you would expect
Realistically, you shouldn't have that large of a variance when using the method . . .
To answer your question it would work the same way with a list that has a preset capacity. I would say it uses an array to make the intention of not resizing the collection clear
does clearing and adding items to the list invoke the garbage collecotr?
I'm not sure if I understand. You want to create a static method with a parameter that is a copy of a class method, and the parameter is that class?
No, items will be kept in memory as long as there is a reference to them, and the gc is invoked when it is invoked. Clearing a list does not manually invoke the gc
Yes and no. References to the objects within the list are released and will be garbage collected (only if no other references exist), but the list itself is not. The list maintains its capacity; adding new items will not incur additional memory until the capacity is reached. Then it will reallocate memory, copy over the elements, and increase its capacity . . .
Anyone know why my objects aren't spawning in randomly on my terrain with this code? https://paste.ofcode.org/rBscASUEVCEJDr8aVrsAZC
Thanks!
Add debugs and specifically see why. Print out values and see which dont align with what you expect them to be. You have one condition for spawning, the raycast, so that's a good start for what values to print
You can also use the debug draw ray or line method to visualize your raycasts
ah thanks, i just figured out what it was, im using a procedural mesh that generates on start method, and im also spawning these objects on the start method, so for some reason i think the objects are raycasting before the procedural mesh terrain is there which is why nothing was happening
u have any ideas on why this happens? Shouldn't they both just happen at the same time?
Code runs line by line, if two objects both use start then one will start before the other. If you want an exact control of which to do first, you should code that in yourself. You can also manually change the execution order but im not a fan of that
Also it might be better if you setup that raycast a bit different, like is it possible that some of those raycasts dont hit or start inside the terrain? If you're using navmesh you can randomly get a triangle on the navmesh then just spawn the object there
ooh alr, ill look into improving the raycast too.
is there a way to have the terrain mesh be generated before the game starts? So it's already there when my Objects spawner try's to raycast for each object, and i dont have to put a 1 second delay before my objects spawn in
You dont need a 1 second delay, you just reference the script thats making the mesh and call the method to make it. Then you call the method which raycasts and places objects down
Having a terrain before the game starts would imply it's an asset that you make now, in editor
oh so call the method SpawnObject() from my mesh generator script once the mesh is finished generating?
I would have a 3rd script that does it, like a manager. especially if theres more that needs to be done
it's the same result though
ok cool, thx for the help!
I need a code
When target hits 0 in seconds (add stuff like months, days hours minutes seconds) (time target like date 2025-03-12) it will make the gameobject become invisible and have no colliders, game object can be any name
feel free to write it
Wdym
this is a channel for teaching and helping people write code not for people to make you code
look at documentation and other peoples scripts, you might wanna learn
no
no one has a script related to mine
not what i mean
look at other scripts to understand how unity c# works
and search for documentation and other stuff related to your script
people have made scripts that do things when something reaches 0
people have made scripts that make gameobjects invisible and disable colliders
people have made scripts that look at what time it is
ill try find some stuff to give you an idea on how to do it, but people here wont make the script for you
that's not help that's free labour. if someone is happy to do that for you that's fine but not the point of the channel
This is a variable
target="2025-03-17 7:15:00"
i keep it for notes abt coding
that might be in bash
Not c#
lemme open unity and do some testing rq
yeah that wouldnt work in c#
if seconds 0 it will do smth
youd need to declare that its a string
wait i think i got another one
do you plan to make it specifically take inputs for hours minutes seconds? would be alot easier otherwise
or maybe not
Ok, since i know already how to add months
find how many seconds are in a month etc
then in start multiply the months by that value
so id guess something like this
Wdym like that
so you set the hours minutes and seconds
you create an empty variable time
you calculate how many seconds are in the minutes and hours
then add them together
to find the time for ur countdown
i may be confused here
are you attempting to have it so at a specific time something will happen and countdown to then
or do a countdown of a specific time when they start the game
no so let me say
the countdown is automatic for everyone not when they start the game
instantly when a new update drops this is gonna be there
Even if some people are off the game
Its still gonna count down no longer what
To the target
so the timer will end at a specific date?
then it will make the game object (aka any name) invisible and no colliders
Yes
ah
and then when target hits 0
lemme find out how time stuff works rq
It will make a gameobject or any name for the object become invisible and no colliders
help guy my code is not working πππ
what about it isnt working?
Try turning it off and on again
if i press play thay will say Hash donot exit
I just debugged the stupidest bug I've ever written
I wrote Mathf.sign instead of sin
Then it probably doesn't exist. What are you trying to do?
to make my chracter to walk when W is pressed and stop when W is not pressed
Alright, and how are you trying to do that?
What do you expect to change in order for that to happen
cant figure out how really, try find something online similar to what u want
my Bool?
my Bool
And how is setting a float supposed to change a bool?
do you want to see the 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/, https://scriptbin.xyz/
π 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.
woah didnt know you can format to a language
yes but i changed it to velocity X
fun
Then why are you getting a hash from Velocity and not Velocity X or Velocity Z?
i found a solution... Character controller!
what am i meant to do to make it work
Your answer is within my question.
There is no Velocity parameter in the animator, is it supposed to guess which one you meant?
There's only Velocity X and Velocity Z
should i make a velocity Bool
You should take a look at !learn because you don't seem to understand how your own animations even work
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
Why would a velocity bool help here at all
Your animations are controlled by Velocity X and Velocity Z, change these if you want the state of your animator to change.
Not some random Velocity which isn't even a parameter
i had a velocity bool that i used then i changed it o velocity Z i am asking if i should change the name back
What does a bool have to do with a float and why would changing the name in the animator help with anything?
Change the damn code so that the hash corresponds to the correct parameter in the animator
show me the pic of the code pls
No, go !learn
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
If you can't follow simple instructions then I won't be helping anymore, I already explained everything that had to be explained.
this guy has def been doing this for a long time
π’π
i'm having a small problem (won't take much of your time) and i need to screenshare to show it to you so you can tell me what to look at
the problem is how do i make the attack i coded actually attack when i click
so i'm sorry to ask you but can someone join a vc with me so i can screenshare? you don't have to talk
No one will join a vc, explain your issue here, send a video if necessary
but what screenshot do i show?
Show the related !code and the issue you're facing with it
π Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
π 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.
i don't even know if the thing i need is about code or just unity menu stuff
Well, you're asking about executing an attack on click, seems like a code issue from that alone
What are you having an issue with? Executing the attack, making the click work (old/new input system)?
how do you want me to show my code exactly?
do i take a screenshot or do i copy paste it here?
Read the bot message above
public class Melee1Attack : MonoBehaviour
{
[SerializeField] public Animator anim;
[SerializeField] public float meleespeed1;
[SerializeField] public float damage;
float timeUntilMelee1;
private void Update() {
if (timeUntilMelee1 <= 0f) {
if (Input.GetMouseButtonDown(0)) {
anim.SetTrigger("Attack1");
timeUntilMelee1 = meleespeed1;
} else {
timeUntilMelee1 -= Time.deltaTime;
}
} }
private void OnTriggerEnter2D(Collider2D other) {
if (other.tag == "Enemy") {
// other.GetComponent<Enemy>().TakeDamage(damage);
Debug.Log("Enemy hit");
}
}
}```
format it correctly, the first using statement should be in a new line
```cs
// code here
```
Wrong symbol it's ` lol
```, not ''' ...
damn
Under your esc key for US and UK keyboard
// using UnityEngine;
public class Melee1Attack : MonoBehaviour
{
[SerializeField] public Animator anim;
[SerializeField] public float meleespeed1;
[SerializeField] public float damage;
float timeUntilMelee1;
private void Update() {
if (timeUntilMelee1 <= 0f) {
if (Input.GetMouseButtonDown(0)) {
anim.SetTrigger("Attack1");
timeUntilMelee1 = meleespeed1;
} else {
timeUntilMelee1 -= Time.deltaTime;
}
} }
Awesome
yay i did it
Alright, now, what exactly is the problem? Is the animation not starting?
when i click nothing happens
Just to be sure, you're pressing the left mouse button, right?
yes
Put a Debug.Log just before you call SetTrigger to make sure it's actually called
can you show me what it would look like with that so i place it correctly?
this is the error
private void Update() {
if (timeUntilMelee1 <= 0f) {
if (Input.GetMouseButtonDown(0)) {
Debug.Log("Left mouse button pressed, animation should start..."); // <--- here
anim.SetTrigger("Attack1");
timeUntilMelee1 = meleespeed1;
}
else {
timeUntilMelee1 -= Time.deltaTime;
}
}
}```
thank you so much
Frank where on earth did you come from
Also gonna need to see the line from the script called iloveyouGod lol
this is the error
I need to see the line of code not the error
nvm still confused
i need what it would look like complete so i stop being dumb
sorry
It's literally... the entire Update method
You can just replace the existing one if you're struggling with it for some reason
But essentially I just added one line before anim.SetTrigger
still nothing happening when i left click
Show your current code
Wait just to be sure
Did you actually put your script on an object
All of that code looks functional
it's on the player character
// using UnityEngine;
public class Melee1Attack : MonoBehaviour
{
[SerializeField] public Animator anim;
[SerializeField] public float meleespeed1;
[SerializeField] public float damage;
float timeUntilMelee1;
private void Update() {
if (timeUntilMelee1 <= 0f) {
if (Input.GetMouseButtonDown(0)) {
Debug.Log("Left mouse button pressed, animation should start...");
anim.SetTrigger("Attack1");
timeUntilMelee1 = meleespeed1;
} else {
timeUntilMelee1 -= Time.deltaTime;
}
} }
The brackets are throwing me off lol hold on
Then place another debug, right before the first if statement, to log the value of timeUntilMelee1
Debug.Log($"Time left: {timeUntilMelee1}");
there's more down there unfinished for doing damage
(it's not making any errors)
oh wait, the brackets threw me off too
This is basically saying if timeUntilMelee1 is less than zero and we're not clicking then decrease the timer
let me send the full thing sorry
// using Unity.VisualScripting;
using UnityEngine;
public class Melee1Attack : MonoBehaviour
{
[SerializeField] public Animator anim;
[SerializeField] public float meleespeed1;
[SerializeField] public float damage;
float timeUntilMelee1;
private void Update() {
if (timeUntilMelee1 <= 0f) {
if (Input.GetMouseButtonDown(0)) {
Debug.Log("Left mouse button pressed, animation should start...");
anim.SetTrigger("Attack1");
timeUntilMelee1 = meleespeed1;
} else {
timeUntilMelee1 -= Time.deltaTime;
}
} }
private void OnTriggerEnter2D(Collider2D other) {
if (other.tag == "Enemy") {
// other.GetComponent<Enemy>().TakeDamage(damage);
Debug.Log("Enemy hit");
}
}
}
Yeah, the else shouldn't be nested inside the first if, it should be after it
that means nothing to my brain
i need to see it
private void Update()
{
if (timeUntilMelee1 <= 0f)
{
if (Input.GetMouseButtonDown(0))
{
Debug.Log("Left mouse button pressed, animation should start...");
anim.SetTrigger("Attack1");
timeUntilMelee1 = meleespeed1;
}
}
else // If timeUntilMelee1 > 0f
{
timeUntilMelee1 -= Time.deltaTime;
}
}
Your code checks if timeUntilMelee1 is less or equal to zero, and if that's true then it goes deeper, checks if you press the mouse button, otherwise decreases the time left
i was following a guide and his brackets looked like that so to not confuse myself i made it the same
Show me the guide
Learn how to create 2D Top down Melee in Unity easily with a cool sword!
// JOIN THE COMMUNITY DISCORD!
https://discord.gg/BYGkHuGWAe
// PLAY MY DAMN GAME ALREADY?
https://play.google.com/store/apps/details?id=com.TylerPottsDev.BananaToss
// WEB DEV CHANNEL
https://youtube.com/tylerpotts
it was exactly what i needed so uhh
timestamp?
idk
the first 10 minutes
oh so it's my fault sorry
the else corresponds to the first if, not the nested one
Also if you are gonna follow the tutorial like that try to understand the code that is given to you and not just copy paste π
i was trying to
The brackets are even colored differently here depending on how nested they are
ah
It's blue for both the first if and else
umm...
it's still not working
Show your code
//using Unity.VisualScripting;
using UnityEngine;
public class Melee1Attack : MonoBehaviour
{
[SerializeField] public Animator anim;
[SerializeField] public float meleespeed1;
[SerializeField] public float damage;
float timeUntilMelee1;
private void Update()
{
if (timeUntilMelee1 <= 0f)
{
if (Input.GetMouseButtonDown(0))
{
Debug.Log("Left mouse button pressed, animation should start...");
anim.SetTrigger("Attack1");
timeUntilMelee1 = meleespeed1;
}
}
else
{
timeUntilMelee1 -= Time.deltaTime;
}
}
private void OnTriggerEnter2D(Collider2D other) {
if (other.tag == "Enemy") {
// other.GetComponent<Enemy>().TakeDamage(damage);
Debug.Log("Enemy hit");
}
}
}
Are you getting the log message?
The Debug.Log that's right before SetTrigger, is it appearing in the unity console
If yes, then are there any errors or warnings?
Then its working ?
animation is not playing
Why is your anim called Attack1 but the tutorial is called Attack ?
brb
pls can some one help my code is not working
That string has to be exactly correct, if it doesn't match what's setup in the animator controller.. then it won't do anything
!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 #854851968446365696
this is my code
Show the whole console window..
this is the error
I've already explained to you what is wrong and what you should be doing
pls explain again
Dear lord
these are warnings, not errors
there's nothing else in there
but it will not let my character move
Your Animator does not have a parameter called Velocity but for some reason you're getting a hash from "Velocity" and trying to use that
the warning is also pointing at line 45 in iloveyougod.cs
not the code you shared
Show the entire window..
my character have velocity
From what you have shown in the animator, they have Velocity X and Velocity Z, not Velocity
I struggle to find what you can't understand in that
I CHANGED IT TO VELOCITY Z
Sure, but the code you keep on sending still uses Velocity, not Velocity Z
so should i change it back
is this what you want? orrrr?
Alright, this might actually be the first time I'm blocking someone here.
You should go to !learn to understand what you're even doing
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
Yes, I just wanted to see if there are any hidden warnings, none here though
ok
i understand i retype the code like 3 times it is still not working
Change Animator.StringToHash("Velocity") to Animator.StringToHash("Velocity Z") and stop asking me.
π²π
is that all i should change
What about "stop asking me" is unclear to you?
sooo
back to me...
What you can do is open up the animator controller for the player, start the game, and press the player instance with the Animator on it, that should show you the current state of the animator belonging to that instance of the player if I remember correctly...
Then press the left mouse button while looking at the animator to see if it changes.
oh ok thanks
Also send a screenshot of the animator
so it's only letting me click one a second which is intended
and now that i look at this it doesn't look right
ok
When you look at the animator, does it go through the entire Melee animation? That is, does the progress bar go from 0 all the way to 1?
it is still not working
Also send the inspector for the Melee state
the "MeleeAttack1Animation is loading
but i don't see it in the game
Check if the Animation frames are set up correctly
i changed it
hold on it worked for a minute and then not anymore
IT"S WORKING YAYYYY
hold on it uhhh
@modest dust so the swing attack is spawning in front of the player character and not where he's aiming
That seems like a separate issue, show the code for instantiating the swing attack
is it not this?
// using Unity.VisualScripting;
using UnityEngine;
public class Melee1Attack : MonoBehaviour
{
[SerializeField] public Animator anim;
[SerializeField] public float meleespeed1;
[SerializeField] public float damage;
float timeUntilMelee1;
private void Update()
{
if (timeUntilMelee1 <= 0f)
{
if (Input.GetMouseButtonDown(0))
{
Debug.Log("Left mouse button pressed, animation should start...");
anim.SetTrigger("Attack1");
timeUntilMelee1 = meleespeed1;
}
}
else
{
timeUntilMelee1 -= Time.deltaTime;
}
}
private void OnTriggerEnter2D(Collider2D other) {
if (other.tag == "Enemy") {
// other.GetComponent<Enemy>().TakeDamage(damage);
Debug.Log("Enemy hit");
}
}
}
That's only triggering the animation, there is no aiming involved here whatsoever
Nor there is any spawning happening here
i have a cursor the circles around the player aiming at the mouse
how do i attach the attack to it?
Aren't you following a tutorial? Surely you should carry on with that, it will probably eventually tell you
i did what the tutorial did and it's not working
If it works in the tutorial, you did it wrong, or missed something .. go back and do it again
hold on i'm waiting for caesar's response
Well, your cursor and your attack are probably separate entities I would assume. You'd have to adjust your attack to whatever state your cursor is currently in... but if it's part of the tutorial then your answer should be there.
give me a couple of minutes and try to figure it out with the tutorial
i wanna cry
that's all he did and then it worked
can you just please show me how to do it before i cry
the tutorial shows you how to do it
...
i followed it
and then
it didn't work
no one here can show you.. it'll take more time than we have to learn your setup, work out the implementation for it, and type it up
So you followed it wrong
If it works in the tutorial, and not for you.. you did it wrong.
wanna vc with me so i can screenshare and prove me wrong?
You're not following it exactly as it is - you called your animation Attack1 instead of Attack for example.
Follow it to the letter, and don't skim anything
no
damn
he writes literally nothing about turning and then it turns
such lies
WATCH THE VIDEO
The tutorial shows you how to rotate it.. although from the first seconds of it I can see him rotating the weapon, you're on the other hand rotating the cursor. So if your weapon and cursor are separate then simply copy the rotation of the cursor onto the weapon. Or attach the weapon to the cursor.
If your cursor rotates, then he did in fact show how to turn it
i did it and now my whole character is turning
damn
Then... you're turning the wrong thing
damn
Just... attach Melee1 to CursorNotScript, and make it so that it aligns correctly
tried it before
it made the attack animation not work
or to RotatePoint
again makes attack animation not work
It shouldn't matter where you attach it.. unless you're deactivating certain gameobjects when you start the attack
if you parent the attack under the cursor but deactivate the cursor then obviously the attack will also deactivate, etc
i'm gonna have a heart attack before someone vc's with me and shows me things
If you don't want to change the hierarchy then copy the rotation from RotatePoint onto Melee1, making sure that it acts as a rotation point for GFX
Taking a break is also an important step of the process.
Me on day 7 of my 2 day break
i have taken a week break before, looking back to current project like alien
Then realizing you named your scripts Testv1 and whatnot
hi, can someone tell my why the counter still goes up even when button is clicked?
public class UIBlock : MonoBehaviour
{
private int counter = 0;
[SerializeField]
private Button button;
[SerializeField]
private TextMeshProUGUI text;
// Start is called before the first frame update
void Start()
{
button.GetComponent<Button>();
text.GetComponent<TextMeshProUGUI>();
}
// Update is called once per frame
void Update()
{
// Check if there is a touch
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
{
// Check if finger is over a UI element
if (!EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
{
Debug.Log("Touched");
counter = counter + 1;
}
}
text.SetText(counter.ToString());
}
}
Use a paste site or format your !code blocks. Also, your Start method is pointless; you call GetComponent on both button and text but don't do anything with it. What is supposed to happen when the button is clicked . . .
π Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
π 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.
I simply want to return a value "timer" in my class. However, the gameobject instance that holds that scripts gets destroyed when i have to return it, so do i have to make the exact same method again but static and also copy my "timer" variable and make that static and just match it to my regular one? Or is there an easier way?
when i use the code snippet for switch, in visual studios, there's a case for default at the bottom. what is that used for?
default in a switch happens when none of the other cases happen
oh right, i normally use it with enums, forgot that might be needed for ints or something though
@cosmic dagger i made this to test IsPoinerOverGameObject like this https://docs.unity3d.com/2018.1/Documentation/ScriptReference/EventSystems.EventSystem.IsPointerOverGameObject.html
so i want the counter here to go up when touch is released and when clicked on a button the counter should not go up, but it still does, when used TouchPhase == Began it works but with TouchPhase == Ended it does not work, i also tested this using keyboard and mouse controls and it works with GetKeyUp
#β¨βvfx-and-particles
but also, you can use layers
oh sry about mis posting
I saw that I should not ask in multiple channel.. So I'll delete it in this channel then
thx for notice me!
!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/, https://scriptbin.xyz/
π 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.
Continuing what I was saying in #π»βunity-talk
Right now Iβve reached two points in my Unity project that I think events would help.
The first is in my 'Helper' classesβ I have a set of static classes that modify POCOs instead of accessing the POCO directly to change it. For instance, I can call SourceHelper.SetName(source) and the name is set. Sure. I think an event system would be nice to call the other functions that are meant to be run every time you change a variable of these POCOsβ for instance, the variable PB thatβs set by SheetHelper.SetPB(sheet) is used in a lot of player stat calculations; so whenever the SetPB function is called it should send an event that lets other scripts know they should recalculate anything that depends on PB.
Another implementation I think I need, way more straightforwardβ Im working on a custom editor for such POCOs, and Iβd want the editor to call these helper functions instead of directly modifying the POCOs. I did some research and apparently the only way to do this is with unity events
For a custom editor you can use a plugin like https://dbrizov.github.io/na-docs/attributes/meta_attributes/on_value_changed.html
For the first case yes you would simply have the other scripts subscribe to an event on the SheetHelper and in SetPB you would invoke that event
Sorry I mispokeβ I meant a property drawer, but I think the implementation is the same for both
But yeah, thanks!
I am trying to make a simple ai enemy using navmesh, however, i dont know how to bake the surface. I do not actually have any surfaces until the game is started because i have a maze generator that spawns everything in. How do i bake a navmesh at runtime?
Wait and is there anything else to do? like do i just put public void BuildNavMesh() into any script that runs at runtime and then the ai will work?
no... you call BuildNavMesh on your NavMeshSurface
yea i added that
im a bit confused then what exactly is navmeshsurface
its a component
creates the area your agents walks on
to what do i add that component?
For the load method I use, I clear my grid and replace it with gameObj, this works, and is able to make 1:1 replicas as far as I can see.
the current issue atm is that my 2draycast collider doesn't find anything, even when clicking on the new gameObj's spawned, with the function that uses the raycast2d collider saying the following error
what am I doing wrong here?
well ideally to a gameobject
empty one is fine
read the options on the Object Collection to how you want to bake
oh okay
link it in the inspector to run that function after generating maze
[SerializeField] NavMeshSurface navSurface;
void Method(){ navSurface.BuildNavMesh();
the namespace NavMeshSurface could not be found
apparently you're trying to access something that is Null. If its raycast, then are you trying to access Collider on a no hit?
i do have the navmeshsurface component so idk why thats happening
your IDE will tell you which one it belongs to
Read the rest of that error: "Are you missing a using directive?"
the thing is is that the raycast is based off of mouse position, and I'm clicking on the game obj directly. This code does work before I do my load function.
However, when I use the load function(which wipes all game Obj's and replaces them with the same ones ATM), the raycast no longer can find it.
The gameOBJs do have colliders, because they are the same copy pasted obj
The original game OBJs are deleted and replaced with new game OBJs that are stored in a dict with the key being their x,y
show the code because its hard to know whats going on without it
make sure your IDE (code editor) shows you the options I showed you
dont just copy the correct one off mine lol
yea ok. Cause that part is probably even more important than code you writing lol
Hello everyone, can I ask a short quick question?
π Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
π 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.
I want to create an Android game and I have a problem. Everything looks good on the computer until we enter the settings. I am a beginner and I do it 4fun, thank you in advance for your help haha
check here
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIBasicLayout.html
also not a code question, its a #π²βui-ux
Oh sorry, but also thank you β€οΈ
A tool for sharing your source code with the world!
so which line is throwing NRE ?
this one
hit.collider.gameObject.GetComponent<SpriteRenderer>().sprite = _draggedObj.GetComponent<SpriteRenderer>().sprite;
The first time I try to get a component from the hit gameObj it gives me an err
well it a bandaid right now, but also you shouldn't just have hit.collider. freely like that
put at very least inside an if(hit != null) statement
its either hit is null or it did find something that doesn't have SpriteRenderer or _draggedObj i null
most likely the former
why its null thats for you to find out, but you shouldn't be doing anything outside of a null check unles you know beyond a doubt its going to always be 100% not null
if(hit)
It's a struct so it can't be null
but it has an implicit bool comparison
ya normally its struct and never null
Normally? Always
just tried it, now it's hitting at the bandaid code checking to see if hit.collider.gameObj is null
unless nullable π€
should just be if (hit.collider == null) { Debug.log("Didn't hit anything"); }
wdym hitting at bandaid code?
or if (!hit)
it threw an error
yeah because you did hit.collider.gameObject without checking
I tried if(hit) and now it's not running, so it's definitely false
thats why it was null
you cannot access that .gameObject until you do if (hit) or if (hit.collider != null)
it didnt hit
but how is it not hitting anything? my mouse pointer is literally on the game obj
Should also only raycast when you click, since you don't seem to be using the hit otherwise
that screentoworld looks sus
whatever you're mousing over doesn't have a collider
itsnt for 2D better using intersect ot whatever
yeah they're using that aren't they?
RaycastHit2D hit = Physics2D.GetRayIntersection(Camera.main.ScreenPointToRay(Input.mousePosition));
Oh right im blind forgive me
but yeah all of the rest should be inside the check
the first image is initial creation and the 2nd image is post load method
the collider is disabled
on the second
fr
is there a quick "enable all components of this gameObj" method?
You could foreach them but sounds like you need to fix it where you set it to disabled no ?
but I never set it to disbaled
well something is
well since I'm already doing an instantiation of them from my dict tileStorage(for looping already), there shouldn't be anything wrong just enableing that component in that same loop
Are you sure you aren't enabling/disabling the boxcolliders instead?
there is nothing wrong doing that but if something is setting it to disabled you might want to investigate that
I have no method that disables boxcolliders
Show the tile prefab
not sure how unity would just set .enabled = false by itself unless a specific reason
I only know Start() disables the script checkmark if NRE occurs there.
tile prefab here, it's enabled
mind you, the intial load has all the tiles enabled using instantiate
for load, I instantiate a gameObj from a dictionary, so maybe the dict doesn't hold enabled?
just ran the code, brute forcing enabled to be true after all the other methods fixed it
dictionary has no control over that
I thought so
does setActive tamper with components when using it on a gameObj? No, right?
afaik it shouldnt touch .enabled on other components
maybe you could send the entire Tile script and what instantiates it through link, we can take a look if anything is a miss
okay, I will do that
this is the script that controls spawning tiles and reloading the tiles https://paste.mod.gg/pvtqvfgjrlsc/0
A tool for sharing your source code with the world!
A tool for sharing your source code with the world!
and this is the script attatched to the tile prefab
hmm maybe the one in tileStorage had the component disabled to start with?.
Or am overlooking something obvious lol
If you are, then I am as well. I have no clue how c# does dict when it comes to the specifics
_tilePrefab are you 100% sure the one you linked in the inspector is the correct prefab with the component enabled?
yes, I double clicked it
the dictionary just stores the object, it shouldnt touch the components
double checked it*
hmm yeah unless at some point the one stored gets touched, updateTile() or something
oh, rats.
you should also start using Components rather than GameObject type
if you have Tile you shouldn't need to store them as GameObject, you can directly use Tile
that was the thing I was trying to attempt, but I can't convert gameObj hit by the raycast to a tile
if(hit.collider.TryGetComponent(out Tile myTile))
ah I had no idea there was a trygetcomponent, I tried try/catch but it complained lol
let me make some adjustments
this is the same thing as doing
var myTile = hit.collider.GetComponent<Tile>();
if(myTile != null){
myTile.Stuff();
out is the result stored if the if returns true
wait, tile is a component?
if it inherits from MB yes
I thought it was a subtype of gameobj
GameObject is just a container, think like a Box that holds all the components in it
right, which is how it can be empty
except for Transform but yeah
GameObject and Transform are basically inseparable best friends lol
so through any component you can access both
tile.gameObject & tile.transform
that makes sense... since every gameobj MUST have a transform, the transform is guaranteed to exist/have functioning methods
now I'm trying to serialize the dict into a json and export it as a save file
unfortunately, I already wrote code for this, and I'm looking at it and it's illegible
this is a travesty
quick fix, use Newtownsoft
this is ol
there is an official release
This repository was archived by the owner on Oct 6, 2023. It is now read-only.
so do I just add this through the package manager?
Ah, been a while since I had to use
correct
add by name com.unity.nuget.newtonsoft-json
okay I added it
change JsonUtility to the new method JsonConvert.SerializeObject(item)
https://www.newtonsoft.com/json/help/html/SerializingJSON.htm#JsonConvert
it's over
i accidentally cut the c from .com lmao
myb. fixed
everything is pretty much same as JsonUtility
ah got it, I just need to replace it with JsonConvert
yup
does it have an export?
wdym an export?
like an export method to create a json file and insert it into a specified folder?
SerializeObject makes the json string
well you use System.IO there same as you would in JsonUtliity
this just converts an object into a json string and vice versa
normally you do
var serializedJson = JsonConvert.SerializeObject(myobj)
File.WriteAllText(path, serializedJson)
https://learn.microsoft.com/en-us/dotnet/api/system.io.file.writealltext?view=net-9.0
path = Path.Combine(Application.persistentDataPath, "folderName" , "fileName")
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Application-persistentDataPath.html
(this doesn't auto create folders so be aware of that)
um sorry for the late response, but my ai still isnt moving and im not entirely sure to do. (its in response to these messages). I tried to add a one second delay in case the navmesh was being baked before the actual maze spawned, but nothing changed really. Im not really sure what could be wrong
can anyone help me out with this physics based movement? im following a tutorial and i did the code right but its saying theres an error. someone please help https://www.youtube.com/watch?v=f473C43s8nE
FIRST PERSON MOVEMENT in 10 MINUTES - Unity Tutorial
In this video I'm going to show you how to code full first person rigidbody movement. You can use this character controller as final movement for your game or build things like dashing, wallrunning or sliding on top of it.
If this tutorial has helped you in any way, I would really appreciate...
errors are in the bottom
show what you done so far.
use links to share code
You skipped a step
at some point they created that float and you didn't
theres no way tho bc i followed perfectly
he js never mentioned a airmultiplier
people often say that, turns out usually it isn't
so would i js add an airmultiplier as like a public void or sum
either that or the tutorial is bad
im new to coding
why would it be a public void ?
its a float
i dont know whats what
mb im trying to use big boy words in this new stuff
first time developing
big boy words
Just having a navmesh surface doesn't make your enemies use it. Have you added code for navigation and navmesh agents?
yes, ill send in a sec
atleast i think so
"float" because its a "floating number"
Its almost precise but not , close enough
https://en.wikipedia.org/wiki/Floating-point_arithmetic
gotchya
ill see if i missed sum bc the comments are all thanking him
yea def did at some point
many people come with that video here, dont think that has ever been issue
must be if its popular lol
Aargh
oh nvm its a horrid tutorial
(from that video)
idk why i found the tutorial bad
actually?
well at least for that part
oop
You never want to multiply your mouse Input by Time.deltaTime
you mouse delta is already the distance moved between each frame
therefore its already frame-rate independent
multiplyng time by deltatime makes mouse buggy
thats what i heard from yesterday
i followed the same tutorial
end the line at the end of the parentheses
This is the navmesh script, attached to a empty game object, https://pastecode.io/s/gwaio9sd. This is the ai's code https://pastecode.io/s/njb6h4am, which i attached to a capsule with a navmeshagent, and i attached a sphere to the script as the target
also im not exactly sure what i was meant to attach to the navSurface field in the navmesh script
found the issue
two things to check.
you most likely have errors if its trying to move before it was baked
check the nav surface was baked correctly
How to check both?
start with checking if it even baked it correctly.
pause the game or switch into scene view after regen, and see if its blue and correct
im in scene view with show navmesh activated and it is infact not blue
nothing is baked in that case
no way now my jumping is bugged
i even configured settings right and there are no errors in the code
π€¦ game dev is so hard
show the component of the navmesh surface after the bake
i feel for the ppl who are professional game devs
yup
its not really hard as much as "involved"
thats development for ya
hellz yea!
that could take years
have u got to teh scope creep part?
if years is meaning (2) i think ur being very generous
im willing to take time to make this game
good on you π
and this error: NullReferenceException: Object reference not set to an instance of an object
NavMesh.BuildNav () (at Assets/Scripts/Map Scripts/NavMesh.cs:15)
hmm didnt have this before
backrooms?
fire
yea somethings wrong with ur entire navmesh surface..
Don't think you are supposed to call SetDestination every Update
It will be stuck calculating a path
why isnt your navmesh surface even linked ?
the error means ur navmesh agent isn't even near a navmesh
there isnt even a reference runnign Bake on
isnt this to make sure it will track the object every time it moevs
i assume this is because there is no navmesh
lets not jump ahead..
you didnt even bake it..
how you expect anything to move on it
yuuup
well i though this https://pastecode.io/s/gwaio9sd. bakes it
you put the field there, and never ran the method cause it would be also NRE
well it should but you didnt link the reference
this would throw a NRE
link the reference?
drag n drop
Your enemies should wait for an event. / bool before starting the SetDestination
so i drag the navmeshsurface on the navmesh game object into the navmesh field on the scriot?
the script component wants to know which navmesh surface you want to run BuildNavMesh on
it just knows "I have this navmeshsurface , I want to bake on"
computer: Okay WHICH one do you want to bake
anyone know why my jump isnt working?
dont use videos to share !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/, https://scriptbin.xyz/
π 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.
A tool for sharing your source code with the world!
this needs to be degugged
what is that mean
you have 3 conditions which may affect that from running
debugging is the process of verifying each one isnt contributing to the issue
Debug.Log inside the if statement to see the function runs at all..
it js confuses me how he did all of those and it didnt break for him
ph okay thanks ill try it now
because they know what they're doing and you're just copying so its easy to miss
gotchu
so delete one at a time to see which one isnt contributing
wait what
why would you delete them?
oh so how do i run that code
wdym how?
bc then i see which one is the problem
Hey, I dont know if I should make one big scene with everything in it or different small scenes. What's the pros and cons? I don't think that having every objects loaded at once would be that much of issue considering it's a rather small game
First you see if its not printing the Log you know if statement is the problem, then you can verify each one before if statement
ok so break it down into idiot terms
please
not a code question
#π»βunity-talk
wait i got it
idk how much simpler you want me to put it lol
put the method
i think i js simply missed a space
i checked the lightbulb to the left
it said fix formatting
wasnt it
where would i put the method
thats only thing to wrroy about
like I said a few times already, inside the If statement with the 3 conditions
alrighty
when i do this debug thing, i get an error
fixed it
it needed to be unityengine.debug.log
wait so if it doesnt log in the console, is that make it the bad one
remove the system.diagnostics namespace
if nothing prints to console then the function isnt hitting if statement
so jump() will not run
thats weirding me out bc nothing is printing
like literally nothing
yes thats why we established its not printing then its not running
now i gotta find out why its not printing
I mean ideally you'd log something a bit more useful
wdym
jumpkey will just give you a Keycode, that isn't useful
because if statement isnt running
readyToJump, grounded, and jumpKey were all in there
meaning one of those is false when you press JumpKey
run the debugs b4 the conditional π
most likely grounded
but even when press space it doesnt log
yes.. because there are 2 other bools
whats the code line for that
yeah
so you need to verify their values at the time Space is pressed
so how would i go across that with it being all weird and not logging on the console
Debug.
Debug.Log($"ready to jump : {readyToJump}; is grounded : {grounded}");
^ consolidated
this brings that error tho
u have a using statement u dont need
delete the System.Diagnositcs namespace
^ get rid of that garbage ur not ready for that yet
whats the system namespace
get rid of my code?
the using statement
where the using statements are
at the top of the class
this means BOTH of those using statement have a Debug
it doesnt know which one ur wanting to use
so which one do i wanna see
so remove the SYstem one.. b/c not sure why u even have that
keep UnityEngine
remove the System or System.Diagnostics or w/e u have extra
how do i remove the system one
oh i see it
delete this thing?
the first one?
just Systsem.Diagnostics as i already said..
alright
nothing is printing still
i deleted it
then its not running
did you put it before the if statement?
are the inputs working?
OMGGGGG
π€¦
we already established if statement isn't hitting, put anything new in there is moot
i thought u meant in the if statement
nah cause if its not hitting , the condition values before it need to be verified
You cant do that if the log doesnt run
what is that mean
it means you aint ready to jump
but im touching the ground and ground check should see that
you reset jump in ResetJump()
but its never true otherwise
if Jump cant run, how can resetJump run?
readyToJump stays false
bool default value is false
hmmm π€
willing to bet you missed that part at some point in the video
prolly right'
im rewatching the whole jump segment
thank u for dealing with my nonsense
btw do u know why my velocity word crosses out?
do i switch to this?
it tells you why right there ^
so switching the code is safe
yes because its telling you to do it
if you use Ctrl + . / quickactions, it should help you replace them already
alright im gonna apply everything it wants me to apply
sorry for being late again, i had to go to dinner, but the navmesh still isnt spawning.
did you go into scene view and check?
yep
make sure the gizmos is on
I come because I am trying to make a puzzle where a player fixes a broken clock
are you sure that function is
A: running
B: running at the correct time (aka after the build)
left click spins the minute hand, right click spins the hour hand
i managed to get the hour hand to work, but I htink its overriding the minute hand's collision
This is the code:
void Start()
{
Invoke(nameof(BuildNav), 1f);
}
void BuildNav()
{
navSurface.BuildNavMesh();
}
}
so i think so
well verify its running first things first
No
Be mindful, if someone requests your code as text, don't send a screenshot!
dont ever send code as screenshots
one sec
use the proper way π
π Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
π 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.
when i add in a debug message, i do in fact get it, so the code itself runs
use links
com on dude, no one wants a wall of text in discord. use the links provided.
hence the "Large code" section in the bot message
its inline!
wouldnt code that goes over the char limit warrant large block?
thats why there is a "Large Code" section. which an entire class is
no its not for Char limit, its mainly so its actually decently legible and with line numbers for referencing etc.
Use Scriptbin to share your code with others quickly and easily.
Use Scriptbin to share your code with others quickly and easily.
oh ffs
easy
dont get kicked by bot
edit your message and put both links..
unless you got automuted already lol..
!unmute 386689882182909965
vagustruman was unmuted.
https://paste.mod.gg/ also can contain multiple scripts
nav do you know what to do next perchance?
did you make sure that function is running after you have meshes into your level
sorry i dont really understand the question
there. both scripts are present
could you explain the issue again with the hands / clock
the debug message does come one second after the maze is built, so if thats the question yeah
yes
I can move the hour hand with right click
but it overlaps the minute hand, which I control with left click
I set both box colliders to "is trigger" but its not helping matters
so yeah i think so
okay well its baking something thats why im curious if its happening after
wait so what is supposed to happen instead?
left click rotates minute hand, and then right click rotates hour hand
as shown here, I put up a bool to show whether I am moving the hand at all when left or right clicking
right click works, left click doesn't
ohh I see
did you verify your notWonYet conditions
OverlapPoint is correct
yeah, theyre based on the z rotation of the images
do a Debug to see whats actually overlap
overlapPoint returns a Collider2D
so
var overlapHit = Physics2D.OverlapPoint(etc.. Debug.Log(overlapHit.name)
so what do i do next?
is there any chance that there is something wrong with the objects in the maze because of which it cant be baked?
like do they need to have some component maybe?
not if you left the settings to default
you can try checking the asset it generated to see what kind of size it has and all that
(NavMeshData)
okay. so update: after putting the debug code in the if statements of each class, it returns that the right click is working
im pretty sure this is fine, as the maze is 10(.01)x10 and the hwight is 0.5
wdym working, if its working it would be moving no ?
did you verify the important part? aka printing what Physics2D. is grabbing?
i think so, if i see the gizmos of light sources it should be on right?
and also ofcourse if navmesh is checked but its all the same as in thsi screenshot
So the condition for printing out the debug is
if (Input.GetMouseButtonDown(0) && notWonYet)```
normally yes, unless it was somehow toggled individually
just those two variables are what dictates if it rotates
so why is one overriding the other based on physics?
yeah but this part wasnt the main concern, although important.
is actually grabbing anything at all to rotate on
how could i check for this?
and anyway i doubt it, as the ai is still "too far" from any navmeshes
yep its all checked
after generating maze, select the floor or something and show the Transform component rq
actually anything that is the Root object
its only grabbing hour hand
idk what this proves to me
you have to PRINT what is actually grabbed
debug is on bottom left
oh..I had to fullscreen it .. best you keep the console window docked somewhere visible btw
also print which script is showing that
Debug.Log($"{name} says we grabbed : {grabbedItem}")
is this fine?
Ok this might be a problem
yes
yes it works or yes it doesnt?
yes the one doesnt work
oh why
best assumption is that somehow the box colliders are cancelling one another and the hourhand collider is coming out on top
the surface and the platforms, they have different rotations / axis alignment
I bet if you did -90 X on the Surface it could probably bake it
can someone help me out? i have this jumping mechanic in my game but it goes way too high. i turned down the air multilier but its still super high. i used this tutorial (https://www.youtube.com/watch?v=f473C43s8nEand) heres some stuff to show whats been happening.
if the surface is at -90 on X why would surface be 0
navmesh surface only bakes at specific plane defined in the rotation
you dont need a face on the bottom
but the surface needs to match the top
still doesnt work though
maybe my way of determining position is off?
is ur quad child of something?
@rich adder yk how to fix this?
yes
if its the same code. it should be the same no?
does it not log any hit at all ? a
it is a child of mazecell which is empty
whats the rotation on that?
Vector3 mousePos = myCam.ScreenToWorldPoint(Input.mousePosition);
what about z position
0,0,0
make sure its the same position as your sprites
Okay i think the problem is with the Quad.
what would that be
what about Jump force ?
thats mainly whats controlling how much force to push up
Air is just how much resistance you have in air
lemme try lowering it to 8
6 seems to be the sweetspot
thank u nav!
now i need a grappling system
yeah Because I tried with Quad and didnt work, with Plane it worked
I think because its axis is fucking weird..
okay ill try to it with plane then
i really hope it doesnt fuck up the maze
before you do anything make sure you make a backups
When i bake with plane it works fine, the Quad doesnt bake
its axis being all fucked up probably has something to do with it
maze still works, but no baking π¦
also -30 seems pretty sus
yes u wouldnt want that to be the mouse Z tho
your objects at are , ideally at Z of 0 ?
var mousePosWorld = Camera.main.ScreenToWorldPoint(etc. mousePosWorld.z = 0
I always do this
so this is whats throwing it all off
not saying thats it 100%
while Z is mainly important for rendering sorting if you dont use Order in Layer, in 2D iirc for the Physics overlap Z is depth
maybe its not within that depth
oh also nav, forgot to mention but whether or not the quad was a part of the problem is slightly irrelevatn, as the walls (which are cubes) are not baked either
so there has to be a problem elsewhere
i actually have no clue why this is happening
losing my mind
walls would only bake if they had a TOP surface that was large enough
remember surface is only looking for a PLANE
... crap. Okay, mouse position has nothing to do with it, I think
oh nevermind me then
its not gonna bake side of walls unless the navmesh surface was with the same rotation of wall
so i have to eventually once i get this working do another one for walls?
it is if thats whats going into Physics.Overlap
Although the Z axis is not relevant for rendering or collisions in 2D, you can use the minDepth and maxDepth parameters to filter objects based on their Z coordinate. If more than one Collider overlaps the point then the one returned will be the one with the lowest Z coordinate value. Null is returned if there are no Colliders over the point.
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Physics2D.OverlapPoint.html
make sure you put the proper Depth for z, read what i sent rq

