#💻┃code-beginner
1 messages · Page 191 of 1
yeah
Regenerating project files is unfortunately not part of the guide. But that is a big one
so restart unity?
if you did not have the .net sdk before installing the c# dev kit then you need to restart your computer as well
if you are unsure whether you had the .net sdk installed before you installed the dev kit then restart your computer anyway
i had the dev kit not unity extension though
yeahh it works now
yeah this is easy now
proove it 🙂
here lol
but i am actually confused why it's saying unnecessary assignment
is it only because I haven't used it yet since i haven't finished the code
Yes
also can I have a collider which does not actually touch other objects, just to use as a click detector for it's onmouseodnw
If you haven't used it, the compiler won't know you WILL use it
ohh okay
anyone know about this?
Make it a trigger collider
event trigger?
How can I get a reference to the player objects normal value? I am trying to implement sliding with the built in character controller but I cant seem to find how to get the players normal to compare the two.
Okay so I'm trying to get a distance joint compenent from the Player object, distanceJoint is set as a public DistanceJoint2D in the references, but this isn't working. What i sthe code supposed to look like?
is it event trigger, or something else
GetComponent is a method
Alright, how do I fix the issue
use the correct syntax for calling a method
Whats that?
()
Where do I put the brackets?
A message will be sent when there are collisions to a OnTriggerEnter / Stay / Exit method on the objects involved, but you can ignore it. However, there would be no physical collision. The mouse click would work with it still
And/or you can use the layer matrix to prevent any other layers from colliding with colliders on a layer
sorry does that mean it is using the event trigger?
I don't know what you are asking.
It's just a collider with the "IsTrigger" option selected
yeah it works now lol
so basically it is solely a trigger if you tick istrigger
Event Trigger is a different component
what category does is trigger, used by effector and such fall under
nevermind, I figured it out.
Physics?
isTrigger is a Property
Properties are like this:
public float SomeName { get; set; }
Vs a plain variable which is just this
public float SomeName;
Properties are actually a kind of function behind the scenes, but look like variables
Most unity "variables" are implemented as properties
Unity loves camelCase for properties 🥲
Like .transform .gameObject .mass etc etc
so is the x coord a variable or property
Probably a property, but that's just a guesz
yeah what is that camelCase thing i've just been using it cause apparently it's standard
props
generally you dont want anything that is Public to just be a field (variable)
so they should be props
Unity just likes to use camelCase for some f reason (they should be PascalCase)
This is what Microsoft recommends
https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names
But it just comes down to consistency. The MS schema is not the only one
It would depend on the language and context. The naming conventions are there to help make things easily recognized.
I do see some fields that are just regular public Variables and not props though
m_Follow from cinemachine is a Public Var for example cause it can be Assigned
I really hate snake_case but that is convention for rust, and clippy yells at me when I don't 😢
I do use snake case for classes sometimes to prefix
im still on the fence for that
public class UI_GameManager
public class UI_Player
You have caps there though. I think that's something else
Snakes are on the ground haha
ui_game_manager
is the only way to change an object's position to subtract or add to it's current position
or can I make it snap to the same coords as another object
oh wops thought snake was adding _ instead of spaces
Nah. You can addforce or set velocity or use MovePosition of a rigidbody too
but to make it snap to another objects coord
You could just assign it a new position.
Then yeah, setting transform.position would do that
transform.position = otherObject.transform.position
oh okay cool
I am currently trying to implement sliding for my game, but I am having trouble and cant figure out what the problem is, the player just isn't sliding at all, instead they stick and cant move up or down the slope. Plus whenever they walk down the slope they do this weird bounce thing. Here is my script: https://hastebin.com/share/wopodevona.csharp. Here is a video of my issue: https://streamable.com/fixz0q.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
idk about the sliding part but if you want to fix the bouncing going down slopes part I have a fix
What's the safest way to fill a 2d array with a single, specific value? From googling around Array.Fill only works in 1d. Should I just iterate over it and set the value and call it a day or is there something clever I'm missing?
Alright, whats the fix?
what data type would I save the rigidbody of another gameobject as?
I tried bool and turning it false but that didn't work
Rigidbody
why would a bool do anything to do with rigidbody 🤔
you can't disable a rigidbody
either make it Kinematic temporarily
nope
so i need to change a property because I want to keep it floating in place until the interaction takes place
so i should make the mass 0?
floating in what way ?
just completely still
freeze the positions
also Rigidbody is not same as Rigidbody2D hence ur underlined error in awake there
ohh okay
what is the input velocity for that function?
is it CharacterController.velocity?
here is my whole function
//Update
cc.Move((moveInput.y * currentMovementSpeed * Time.deltaTime) * Move(transform.forward) +( playerVelocity * Time.deltaTime));
private Vector3 Move(Vector3 velocity)
{
if(Physics.Raycast(transform.position, Vector3.down, out var hitInfo, 1.5f, groundedLayers))
{
var slopeRotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
var adjustVel = slopeRotation * velocity;
if(adjustVel.y < 0)
{
return adjustVel;
}
}
return velocity;
}
could be cleaned but made it on the spot during video recording
and yes a function named Move inside cc.Move is confusing af , i realize that lol
it says i can't convert float to rigidbody2d??
Would this work aswell instead of what you have for slopeRotation?
angle = Vector3.Angle(Vector3.up, hit.normal);
Im still new to trig so I dunno for sure
I just know FromToRotation worked great from what i've read around forums so i did that
it calculates the angle between the two normals.
Its basically the same thing but shorter
it works for me so idk
wow it's been busy for a long time
you're trying to assign .mass to a rigidbody2D
float into a Rigidbody2D, no such conversion exists
computer is always right
Wait no, there is a difference. Vector3.Angle() results in a float, while your method results in a quaternion.
well yeah it gives me a rotation from the slope..its in the name
so how can I save the mass of it so I can set it to 0?
WOW!!!
well, it told you that mass is a float
so how do you think you should save it as
yeah sorry lol my brain wasnt working
4am time
mass = 0 is not working
though
btw making local variable means only lives in that function
ohh okay
got this issue solved then
Just to clarify, every time you declare a type (float, string, Camera, Rigidbody, etc) you are making a new variable. You only declare the type ONE time
So as nav pointed out, and you saw, writing float made a new separate variable that only existed in that method.
if a gameobject is disabled can you get a component from it
because I am trying to get it's mass but I have it disabled initially
You mean deactivated? Because a gameObject can't be disabled. It can be active or deactivated. Components can be enabled/disabled. And yes, you can get a component from a disabled GameObject.
Is mass a component on your GameObject?
How do I say "This does not equal this or this"? eg. if (buildindex != 0 or1){what ever I want to happen} I mean, I know I can just say buildindex twice but it feels like there should be a less clunky way of doing it
||
So I did what you said, now the Protected Script looks like this:
https://gdl.space/apofifanej.cpp
like this? cause that doens't work
I'm not sure why but for some reason what you suggested didnt work and instead what worked was me attempting to implement sliding. Looks like the reason the player was going down slopes wonky was because of an issue with my variables, and determining if the player is on a ramp seems to have fixed that. But now I cant jump if I'm on a ramp.
you have write buildIndex twice then fix parenthesis
why do you have HStext.text = PlayerPrefs.GetFloat("HighScore").ToString();
what? you mean do exactly what I said I wanted to avoid doing and was asking if there was another way?
Oh yea forgot to change that, before this save load I just did PlayerPrefs as Temp save system.
idk another way sorry
alright, thanks anyway
oh ok.
I just noticed you have a ScoreScript so you have to keep that in sync with the one stored in currentPlayerData
HStext.text = ss.Score.ToString();
currentPlayerData.highScore = ss.Score;
SaveSystem.SavePlayer(currentPlayerData);```
sorry I didn't mean for that to sound so passive agressive over writing
I don't really get what I need to do.
I did not take it any type of way you good lol
look at the edit
This is gonna sound stupid, but can you change this part in an Editor script?
HStext.text = ss.Score.ToString();
Yes so, if Score is higher than the Highscore, it basically sets the Highscore text number into score number.
we're not talking about the text here lol
the class you created PlayerData holds your data to save. Just keep it in sync with that Score value before save
I'm just wondering what will happen if I keep on making local variables? is it going to affect the performance greatly or no?
no
and not something you should worry at all
okay thanks!
Oh jeez I gotta go, this thing is itching my brain XD
did it work?
I made a program with a plane and obstacles , they both have colliders yet if my plane moves at the obstacle at a decent speed it phases through it
It glitches though
Guys, is there a way to make my bullet come out of the gun and go to the center where the player's crosshair is pointing? I did it with this code but it is not very clear where the bullet comes from (it is generated in a corner to the right of the screen) ``` Ray ray = fpsCam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0) );
RaycastHit hit;
Vector3 targetPoint;
if (Physics.Raycast(ray, out hit))
targetPoint = hit.point;
else
targetPoint = ray.GetPoint(1000);
var bullet1 = Instantiate(bullet, bulletSpawn.position, gunHolder.rotation);
bullet1.GetComponent<Rigidbody>().velocity = (targetPoint - bulletSpawn.transform.position).normalized * shootForce;```
Your initial position would be bullet spawn position
Is there any way to check if a sprite is hidden by another sprite? Like, it's still there, but it's hidden form the camera by another sprite
Cause my game involves paralax creating obstacles and things, and I don't want to give everyone of my paralax layers a trigger collider (espeically since it need to be decently specific for it to work properly, so i cant just use circles or squares)
https://paste.ofcode.org/CnxT7EJ6JUeYXMfFzBWdWD why am i getting a null reference error at line 19?
Because you haven't assigned anything to playerMovement
i thought it was using the value from the base movement script i have? i cant just pull from it?
Show the base movement script
That's just a normal component. You need a reference to it like you always do with components
how so?
What do you mean how so
```help
that's how Unity works
You're getting reference to all the other components in PlayerMovement too, why would it be any different here?
i think the different layout of how state machines work compared to monobehavior is tripping me out. ive done this a few times where i felt stumped over things i do without thinking about in a regular script
I didn't see the original script (it won't load), but referencing things is necessary in all programming I've ever done. From console apps in rust to games in unity to websites in javascript.
State machines don't go against MonoBehaviour. You can't say "compared to" in this context.
You can use both without a problem.
I said many times already: state machine is a programming pattern. It's an abstract thing without actual form, until you implement it in one way or another. MonoBehaviour on the other hand is a physically existing type.
yea im gettin there, little by little. And yea i know most of what you guys are talking about, i just dont have the vocabulary or dont know how to say things. i meant im used to only using Monobehavior scripts, so it looking different makes things different even though theyre unrelated
i get most of what your talkin about, it might just be my IQ or bc im newer but using words like references, functions vs methods, all those words kind of dont mean anything to me yet. It mainly just confuses me unless Im used to using it in code. So when easy concepts come up in a more compicated topic all the easy stuff flies out the window lol
it took me until recently to understand wtf return and void meant fully
Functions and methods are the same thing
I'd make a guess and say that these words don't make sense to you, because you didn't learn properly what they mean. When you know the essence of the word, you can't just forget it.
okay, just kuz i know what somethin is doesnt mean i know how its used
Honestly learning to code via gamedev might possibly be the worst choice
And a good way to learn is asking. Even better: explain how you think you understand it and ask whether it's correct and how it relates to the issue or topic at hand.
That is assuming you went through the learning resources and still don't understand.
If you just ask about things that are written all over the place, no one is gonna repeat it.
lol this is gettin off topic. If i have rb = GetComponent<Rigidbody>(); in the start method of the movement script then why would I have to do it again? also i added GetComponent with a few different types and it didnt work
Imho it's not off topic. Knowing how to learn correctly is probably the most relevant topic for this channel. Perhaps even more than concrete code questions.
Assuming you use that rb reference, you wouldn't need to do it again.
Also assuming it actually found the rb.
thats what i was tryin to say, i already have it there
Have it where?
in the start function of the movement script
Does it run? Does it actually find the component? Did you confirm that?
NullReferenceException: Object reference not set to an instance of an object" yea i dont think it does
You need a reference to playerMovement. Nobody said anything about rb. That's not the problem.
Here's another important tip: understand the issue properly before moving on to debugging. How is it that you're talking about the rb when the issue appears to be something else?
not sure dude
Did you solve the issue?
how can I change a scriptable object reference at runtime? for example, i want to change the ItemWeapon to currently equipped weapon
The same way you change anything else, with the = operator
Hi quick question, for debugging purposes is there a way to visualise vector3 ? Like the 'VisualPhysics' package for example, but draws arrows for vectors.
There is Drawline and DrawRay
https://docs.unity3d.com/ScriptReference/Debug.html
Thank you !
Why visual studio is telling me this?
InputSystem = new StarterAssetsInputs();
i have an empty gameobject with some images and text as children, is it possible to decrease the alpha value of everything and once or do i have to do it for every image individually (through code)
Presumably this is a component. You don't new components. You use AddComponent
!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
• Other/None
Hello, i have a bug on the level one of my level that the player appears inside a block but i did clear player prefs, how it can be fixed? https://cdn.discordapp.com/attachments/1205802550868181012/1205816505032249385/Screenrecording_20240210_180341.mp4?ex=65d9bf21&is=65c74a21&hm=37a693609074da77b7d4dadb98b4fe1d6ef3f0ff1f3e284285301cd506fd9054&
what about the text
check the player position in the editor
In the editor does not happen
Also you want components from same object or children
If same object remove Children
children of the same object
Then the line I have given
alright ty
on editor show this
does it look like this?
var r = _pRenderer.color.r;
var g = _pRenderer.color.g;
var b = _pRenderer.color.b; // Cleaner representation of RGB
for (var i = 0; i < flickerCount; i++)
{
// Alfa value logic
_pRenderer.material.color = _pRenderer.material.color.a switch
{
1f => new Color(r, g, b, 0.3f),
0.3f => new Color(r, g, b, 0.6f),
0.6f => new Color(r, g, b, 0.3f),
_ => _pRenderer.material.color
};
yield return new WaitForSeconds(flickerDuration);
}```
This is somewhat similar to what you want. Its dealing with different thing so you will need to rewrite this.
Its Corutine code
Just noticed a kekw
by rgb was more of rrr
check if you have set the background as terrain
and that its the background
so when you play the game in the editor the player isnt stuck?
Nope
Hey, this is gonna sound stupid but I have a music volume slider that goes from -80 to 0. But it doesn't really lower half way when the slider is half way down; I think this is because the decimal is a logarithmic system of measurement. So I'd have to convert the slider value into a logarimthmic scale, I think? But I'm not sure
but yes when i play on mobile
player its good on preview
and thats the grid
how can i share my project with others
share the folder of the project in your file explorer
will it work if the other person doesnt have unity
do you want them to edit it or just play the game?
just play the build of the project
@pallid verge can you help me please
lol dont
use git+github for example
then make a build and send your friends that build
then share the exe file with the other folders there besides the one which says do not ship
why not
terrible idea to work together on one project
version control systems exist
for a reason
Could someone please help me understand why this isn't working?
== for comparisions
Thanks
i have no idea sorry
it could be a million things, just start testing and see what fixes it
ok
it's been 1 month
are you testing things out?
well try other things then
idk what to try
try removing some box colliders, some rigidbodies
anyway, this is code related channel
well the problem could also be in a script
then share the code
thats what i tried to check
Anyone has any idea how this works? Its not getting call anywhere and this is working.
It came with unity starter assets
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 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.
are you using them?
I have no idea
This is unity input system that came with Unity Starter assets player
Last time I delt with it I autogenerated a class
Here its doing something else
This is FPS controller code
its bad when you dont know what your code is doing
Its not mine code Im tempted to rewrite it all
I think I will because atm I have no idea how its accessing inputs
and make sure to understand what youre doing not just copy paste things
who told you
well if your teacher wants you to work with that code then you should probably try to understand it
Im not sure he wants us to work with it
I've got this method that is called whenever the player presses the Space key and when a bool is enabled determining if the pick up has been picked up by the player. It chooses a random integer and then plays a sound based on that integer. But for some reason, I can't hear anything else in my game anymore, but when I pick up the pickup, the sound comes on
And autogenerated code looks like nothing
I can't figure out why. Can anyone offer any help?
why not use switch
Why not use an array
I have an Empty in my game which has an Audio source attached to it
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 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'm getting this error, and it's taking me to this bit of code but I don't get it? How is the statement empty?
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I'm trying to teleport my player but they just do not teleport. There are no errors
I might be wrong but I belive its complaning about different line?
Is it not about line 27?
Ah I though u shown us line 7
is it possible that the "FartSoundSelector" method just selects a sound but doesnt play it?
maybe you could show us the method
This is what it does
I might be wrong, but given that it is a warning and not an error (so it still works), it might only be that instead of "BuffEnabled == true", it is asking you to just write "BuffEnabled", given that it is a bool so it doesn't need the "== true"
learn arrays
What advantage would an array have over a switch in this situation?
what if you have 20 sounds?
you would need 1 line isntead of all of that
20 switch cases
AudioManager.PlayOneShot(fartSounds[Random.Range(0, farSounds.Length)]
No, didn't work 😦
Oooh, I see
AudioController.PlayOneShot(soundsArray[UnityEngine.Random.Range(1-n)],soundVolume)
Even once the method is called, I don't see any Debug logs
what is that lol
Well I tend to name everything Controllers
Its perfect
I know that
and why is there 1-n that doesnt make any sense
(0, array.Length)
is the proper way
1-n wont even compile
it needs 2 parameters into the Random.Range function
Its just a representation of values from range
if you write code, then write it properly, not a representation of your thinking lol
it should also start from 0, not from 1
It.Doesnt.matter:)
it does tf
i should be making a dialogue system rn but im watching u argue
Xaxup just cant
not argue
if you start from "1" xd
but ye it doesnt matter 😄
if you want to help someone, then do it properly, instead of make someone guessing mate
Its others guy job implementing it
Also. Im. TRYING. TO.WRITE 1 LINE OF CODE
Silence
🤡 😄
speaking of help. Please :p
show the entire class
that code wont even compile if thats the entire class, is your IDE configured?
Island is where the player starts.
that is not correct way to destroy something
TP is my Teleporting class. I have thatscript attached to my player
but in that class you have nothing that accesses those things
Teleport is the method shown
so whats the correct way then?
Does anyone know if there is a C# script for a 2d game, basically I want to create a mechanic, that after the knife cuts the bread (goes through all the bread collision) changes the sprite
yeah how do I do that?
its a property of rigidbody
i doubt theres a specific script for that on the internet
you can have 1 child object below the bread and have it as trigger.
when knife reaches it it should be cut
alr
Im not sure what u want to make, beware if you set all logic on hitting that last trigger if someone just goes for the bottom trigger it will cut the bread
i want to do this
I mean if cut from below it will instantly change sprite
yeah i will try to avoid that somehow
I'd like to point out that the space in the middle is 2 different scripts. I have the teleporting class and another class with the IEnumerator in it
I'll post both scripts. 1 sec. sorry. i was at the shop
I'm changing the orthographic size of my 2D camera, so that it zooms out, when something is triggered. This is my code at the moment:
When the trigger is activated:
Cam.m_Lens.OrthographicSize = 15;
And when the trigger is deactivated:
Cam.m_Lens.OrthographicSize = 10;
My only issue is that it does a quick snap to the different values and it looks ugly. Does anyone know how I could make it more of a smooth transition?
Would Lerp work?
Smoothly Interpolate it over time. You do this the same way you'd smoothly Interpolate anything
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Mathf.MoveTowards in Update is the most straightforward
is this how I can save the mass value
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I would say do it with corutine by using Mathf.Lerp
I'm aware code is bad. This was my first project. I'vce improved it a lot
yeah
Its not that its bad it just wont worl
I could use Mathf.MoveTowards to smoothly interpolate?
Why move towards?
how can I change the masses value it if I've already initiated outside the methods
Its to omve
Yes that's what it's for
Access it again. Saving it like you did just saves the value not reference
It "moves" a number
It does?
There's nothing here that changes the mass
yeah mb probably removed that
Also if you save mass into BulletMass or whatever and change it
it wont save bullet mass only variable
ohh
so it saved the number not the reference
yeah
how do I call the reference again then
Same way as before
This just changes your variable. If you want to change the Rigidbody mass you do myRb.mass = 0;
Make a variable to save your Rigidbody reference and reuse it
yes
didn't think id just be able to write a dot and access the property
I don't get how it won't work when teleporting the player. Every tutorial uses the same code.
that's how programming works?
At least what you shown us there is nothing that actually does most of the functionality
You class even ends after 3rd bracket
I want to serialize a player object, but issue if I serialize it from the scene on next scene it will commit complamo in my DDOL object.
Should I just find it?
I've used Mathf.MoveTowards but it only increases the value by 1 now, instead of moving it from the initial value (10) to the target value (15)
I would of thought when calling on the Teleport method. My players position will = the target position
Yeah that sets the position
So my player should end up on point B?
Yes if you have transform of the object
On the scene object not prefab
Looks like there is position
So what happens now?
nothing at all. I'll debug.log it RQ
It's being called when there is a collision. That wouldn't be an issue, right?#
You're using it wrong
The current value goes in the first parameter
And duration doesn't go in the last parameter
It should be speed * Time.deltaTime
But if I add *Time.deltaTime, it increases the value by only 0.02
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Per frame
Times speed
Which is correct
Ooooh
Is there any way to check if a sprite is hidden by another sprite? Like, it's still there, but it's hidden form the camera by another sprite. Cause my game involves paralax creating obstacles and things, and I don't want to give everyone of my paralax layers a trigger collider (espeically since it need to be decently specific for it to work properly, so i cant just use circles or squares)
So how do I get it to continue until the max value is reached?
Follow the instructions I gave
Use the correct parameters
Here
The current value is my first parameter.
The second is my target value.
Third is the durration * time.deltatime
Show code
This is not correct
First parameter is wrong
The current value would be the camera orthographic size
Not "RegularSize"
Also is this code running in Update?
Hi Although an experienced programmer I am new to Unity (Really helping my daughter).
She have a project that uses a Playmaker asset bundle that I import into a new project.
Here original project works on her college computer.
At home the trouble is it always shows the following compilation error
Assets\PlayMaker\Actions\VideoPlayer\VideoPlayerSetTimeSource.cs(21,22): error CS0246: The type or namespace name 'VideoTimeUpdateMode' could not be found (are you missing a using directive or an assembly reference?)
Now I see VideoPlayerSetTimeSource is part of the Unity scripting API. Why can it not find the assembly reference ?
Where in Unity can I see what references it has ? I assume assemblies have to be in Unity itself and not the global .Net install.
Thanks for any guidence.
No, it's within a TriggerEnter2D
Chad k the Assembly Definition and what references it has
Well that's only going to run once. The actual MoveTowards code needs to go in Update or a coroutine
Should I assign the value at the top of my Script or in Start()?
Or at the beginning of the method?
All you need to do in OnTriggerEnter2D is set the Targetesize value
You need a "targetSize" variable
Which you will move towards in Update
Do I need to get component or I can just pass "this"?
why does the object fall when it is spawned despite having the mass set to 0?
I’m trying to use the new input system to add movement and jumping to a capsule is there any good tutorial, that shows good code, and explains
What you have will actually break if there were multiples. Just use this
Im just not sure what is considered component
Why are you setting mass to 0. Set gravity scale to 0
Components are considered components.
Should I assign the value at the top of my Script or in Start()?
Components are all the things attached to GameObjects in the inspector
I don't understand what you're doing now. Isn't that just 10?
You seem to have gotten confused
I was getting the value of the orthographic size and assigning it to RegularOrthoSize
Why
Should I just assign it to 10?
That' doesn't make any sense
wouldn't a mass of 0 stop it from falling
Within OnTriggerEnter2D, how could I set the target value without changing the value?
No, gravity scale of 0 will
yeah it works thanks
but what is the science behind that?
I swear without mass it will stay still
targetValue = RegularOrthoSize;
Or the other one
cause you multiply the gravity scale by the mass right
There's no science behind 0 mass. It's not a real thing
Would this change the target value (15) to 10?
0*9.8 is 0
how can a object have 0 mass?
cause it's a game
It doesn't really matter, it's just the choice they made for whatever reason
fair enough
Probably because it makes things simpler to code as you don't need to special case anything
You're confusing target value with BuffOrthoSize I think
Buff and Regular are basically constants
In fact you can make them constants
You need a third variable to keep track of the current target value
And in Update you can just do cam.OrthoSize = Mathf.MoveTowards(cam.OrthoSize, targetSize, speed * deltaTime)
So then all you do in the trigger code is change the target value to whatever you want
10f of jump force is a lot or not?
I have a bit of an issue I'm to dumb to figure out. Im testing out Netcode for GameObjects, I get everything to move properly, x players with one host or one server everything on that front works. But my issue is my animator, everything animates correctly on the host/server, but on the clients it doesn't change to my "move" layer when I'm moving. The character is moving, its idling in the correct direction, it just doesn't want to activate the "move" layer so it animates its legs while moving, instead of just hoovering about. Could anyone of you help me out? Why is it capable of getting the direction its moving in, but it doesnt understand that it is moving?
using UnityEngine;
using Unity.Netcode;
using UnityEngine.InputSystem;
public class PlayerNetwork : NetworkBehaviour {
private readonly float MyBaseSpeed = 1f;
private Vector3 MyDirection;
protected Animator myAnimator;
public override void OnNetworkSpawn() {
if (!IsOwner) gameObject.GetComponent<PlayerInput>().enabled = false;
myAnimator = GetComponent<Animator>();
}
void Update() {
transform.position += MyBaseSpeed * Time.deltaTime * MyDirection;
if (MyDirection.x != 0 || MyDirection.y != 0)
{
ActivateLayer("Walk");
myAnimator.SetFloat("x", MyDirection.x);
myAnimator.SetFloat("y", MyDirection.y);
}
else
{
ActivateLayer("Idle");
}
}
public void ActivateLayer(string layerName)
{
for (int i = 0 ; i < myAnimator.layerCount; i++)
{
myAnimator.SetLayerWeight(i, 0);
}
myAnimator.SetLayerWeight(myAnimator.GetLayerIndex(layerName), 1);
}
public void OnMove(InputAction.CallbackContext callback)
{
SendMovementToServerRpc(callback.ReadValue<Vector2>());
}
[ServerRpc]
private void SendMovementToServerRpc(Vector2 movement) {
MyDirection = movement;
}
}
I've got it smoothly interpolating, but for some reason it's not reverting back to it's original value
When it's triggered, the ortho size is increased. I then have a method that is called, using Invoke, after a few seconds that changes the target value back to the RegularOrthoSize
But nothing's happening
and the MathF.MoveTowards is in Update()
Show the code
Should I move object with RigidBody or with transform in 3d?
Depends on your game and the object
I got told its better to move with RB
it depends on your game and the requirements of the object in question
A decorative blimp floating in the sky? Move it via the Transform.
An object that needs to have physics interactions? Use a Rigidbody
I mean player
This is the Update()
And here's the OnTriggerEnter2D. The ortho value changes are in the 2 methods below
Is DeactivateBuff ever running? Put in debug logs
Yeah, it is
Add more logs. Check in update that the target is correct
When DeactiveBuff() is called. I can see in the Inspector that the camera's Orthographic size has changed back to 10, but the game still looks the same
Then it's not a problem with the code
What object is this code on? I see you're deactivating this object
That means update isn't going to run anymore
So the zoom won't happen
not sure whats going on here im new to unity
First your IDE is not configured.
I have a suspition this is not how I imagined player moving
Second, you put a semicolon where it doesn't belong
what does that mean
!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
• Other/None
^ you're not getting error highlighting and autocomplete
whereabouts
OnCollisionEnter
im trying to aim in with my weapon but the weapon doesnt go exactly to the anchor so its offset from the anchor which means the gun isnt where its supposed to ive checked it is because of the headBob without the headbob it goes where its supposed to why is this that the headbob is changing the aim in positions whenever i aim in https://gdl.space/exuwikariw.cs
nvm i just fixed it
Hi, I'm trying to implement logic, where player cliks on some spot on the screen in 2d game and on that spot should be created a game object (or in this case set active) but for some reason the objects get -10 value on z axis and are rendered outside of the camera frustrum. Any idea why?
private void CheckPlayerInput()
{
if (Input.GetMouseButtonDown(0))
{
Vector3 mousePosition = CalculatePosition();
CreateWindForce(mousePosition);
}
}
private Vector3 CalculatePosition()
{
Vector3 position = Input.mousePosition;
return camera.ScreenToWorldPoint(position);
}
private void CreateWindForce(Vector3 position)
{
var windForce = ObjectPooler.Instance.GetWindForce();
windForce.transform.position = position;
windForce.gameObject.SetActive(true);
}
Because our "screen" is basically camera, and camera's position is by default set to -10 on z axis
So camera.screentoworldpoint
Returns x, y value on where you touched it, and z value for where camera is
Do I have to check for OnMouseHover and then for the right mouse input to detect a right click on a Sprite, or is there a method like OnMouseRightClick?
Input.GetMouseDown(1) i believe
Or something like that
Ohh wait yeah
I mean you can check if sprite is hovered by shooting a ray inside the if statement for right click
I thought of using OnMouseEnter to flag a bool and OnMouseExit to unflag it, and in Update check for the right mouse button and if the flag is active. But maybe that's bad practise?
No clue tbh, depends on use case i guess?
use IPointerEnterHandler interface
and ExitHandler
I thought that only works for UI elements
Hi, I have a really strange issue. I have this statement : if (isonground && Vector3.Dot(gvelocity.normalized, groundnormal) == -1)The thing is that on start, the conditions are passed and all is fine, but on input I can change the two vectors, and when it's done the statement is not validated : with debugs, I checked and the two conditions really are true, so I don't understand why the condition is not passed.
The dot result is EXACTLY -1?
I think
Did you debug it?
When I print it on Debug.Log() it outputs -1
Could be a floating point error
But why would it not print the whole number ?
i dont know where to post this but
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.Edge.WakeUp () (at <5675beb25788478c930377bea67fb893>:0)
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List1[T] inEdges, System.Collections.Generic.List1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at <5675beb25788478c930377bea67fb893>:0)
im getting this error for some reason wasnt able to solve it, dosent interrupt anything in my game it runs just fine
Hey, coming in the middle of all conversations but is there a way to know if my controller is Xbox/PS4/other to display the right buttons (ABXY or circle/squares/etc) using the new input system?
No clue, it's just a possibility, issue might be something else too.
But just in case you can try to see if that's the case by using mathf.approx(-1)
that's an internal problem with unity
just restart your editor
I TRIED THIS, THANKS A LOT THE ISSUE WAS HERE
Lel welcome to the world of floating point errors, #1 pain in the butt for programmers
You generally don't want to test for equality after doing math
Especially not when your inputs might be slightly off in the first place
even ignoring floating point error, I'd still give a little margin to the result of Vector3.Dot
For some reason debug only looks at first few decimals of a float and if it's all 0 it be like "GOOD ENOUGH FOR ME! SEND IT!"
So if you debug a float with value 0.10000000001 it will show 0.1
But if you compare it with 0.1f it will be false
That's down to how float implements ToString(), I presume
Yeah
Yes, Xbox controller have layouts containing xinput. PlayStation have layouts containing DualShock
Just search online for controller layout
I'll have a look thanks
np
can anybody tell me whats wrong here?
what's wrong is that your !ide isn't configured
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
• Other/None
follow the instructions for the code editor you're using
Your IDE should be highlighting the error.
ok
also, if you're using VS Code, make sure you remove the old "Visual Studio Code Editor" package
the instructions mention this
Isn’t the error due to the fact that he closed the if after: if (speedX>0)?
There's one more error but ide first 
Also, is it possible to change the whole Cinemachine orbits ? Like instead of being world reference, it related to the player or an input, and if I click it, the orbits rotate too ? Like if I was changing referencial
cinemachine questions should go in #🎥┃cinemachine
Oh sry
In my movement, I have somewhere cam.eulerAngles.y for my camera, what is the function to call the get the same thing but for a given vector and not y ? Thanks !
I may be not clear
In the cam.euleurAngles.y, it returns smth depending on the y axis, so a Vector3.up. I wanted to know if we could use the same methos or smth similar, but dpeending on another given vector
hi i don't understand what to change here
what does the error say
that is the error
If you hover over the red squiggly line it will tell you exactly what's wrong
what does the error say
yeah but i've changed everything
Also error will be shown in editor, what does it say
there it is. you have two namespaces with similar names and you are likely working inside of the Units namespace so it is trying to resolve Units.Player.PlayerManager instead of Player.PlayerManager
use an alias or don't name your namespaces so similarly
ah okay that makes sense thanks
that's not how namespaces work, though.
namespace Foo
{
public class FooClass
{
}
}
namespace Bar
{
public class BarClass
{
public Foo.FooClass foo;
}
}
This compiles just fine.
However, introduce a new class and...
namespace Foo
{
public class FooClass
{
}
}
namespace Bar
{
public class BarClass
{
public Foo.FooClass foo;
}
public class Foo
{
}
}
This malfunctions.
right but they have the namespace Units which contains the nested namespace Player. they also have the namespace Player. they are working inside of the Units namespace so by trying to access something in the Player namespace it tries to resolve Units.Player because that is the closest one
Ah, I see
I missed that being in namespace Foo would let you refer to the Foo.Bar namespace as Bar
hello I am a beginner in C# and I am making a game where the main camera is intended to rotate around a game object (ball) with this script and there are no errors in the console but it does not work and all variables are assigned.
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 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.
public void StartGame()
{
if (Lock.activeSelf == false)
{
characterSelect.SetActive(false);
StartGameServerRpc(selectedOption);
}
}
this will check if the lock gameobject isnt active to do the stuff right

hello, Im trying to fix my formula for finding a point inside of a collider that has the shape of an ellipse - Ive been looking at this for a while and I cannot find the mistake, could someone please help me here?
https://gdl.space/jironofuso.cs
or, suggest a better approach even
I'm not even gonna attempt to figure out what's written inside if statement, can you dumb it down for me?
its this equation for an ellipse
or well, it should be
but for some reason the method is returning points outside of the ellipse
you should use intermediate variables so your math isn’t one line broken across 3 lines
Every single point is outside the ellipse and not inside?
also you are using lossyScale
thats intended, using a local scale wouldnt make sense)
you already got the collider bounds
also, this function should take a bounds as an argument
they are a box tho
bounds returns box bounds
hey guys. complete noob here. i was wondering how do people version thei unity projects? can smb help me out? thanks
@sullen rock ??
you are trying to get points in the ellipse defined by what would go up to the edges of the bounds?
there is just a lot wrong with this code tbh
nope, both inside and outside
like, this should be a while loop, and not a recursive call
Do you mean which version to use? As a new person it doesn't really matter, but I would use the latest LTS version?
Any is fine tho
also, you are returning a vector3 for a 2D ellipse
when I would expect the result to be an ellipsoid
no thats not what i mean. do u know git? its a version control system. where u can track ur progress and effectively collaborate with others and work on a project. does unity have smth like that?
the function name does not match what the function does, and there is no documentation to describe it
I know this isn't what you asked for but in case it helps
I would put random spawn points manually inside the ellipse shaped spawn area. And when you want to spawn, just grab a random point from the list
That way you have more control over which spawn point you want to choose and also avoid spawning on "non spawnable areas" as randomly finding a vector might give you a result that's inside another object, which you will have to check for anyway
i would expect a ///<summary>This function produces a random point within the ellipse/ellipsoid that makes normal contact with the edges of the input bounds.</summary>
and the name of the function should reflect this
Much easier to impliment too
Im working in a 3D application, but this particular method works on a plane
if someone can’t immediately tell wtf the function is supposed to do, then you need to work on your documentation
if this function gives a random vector3 on a plane, then I expect only 2 calls for Random, not 3.
I guess most use git in unity too?
Atleast the places I worked at used that as well, but I hear plastic is also pretty good
does collider.Bounds not already include the effects of scale? I thought it did.
well, I could just replace the one random with a set value
it creates a box, it doesnt respect the shape of the mesh
but doesnt github have very limited size for ur repo?
thats the issue
what mesh. i don’t see any mesh here
Really don't know about that, but I'm sure you'll not run into issues like that as a beginner anyway
you generated a random 3D point within the bounds, and then do a check on a 2D projection of this point, when compared to lossyScale. The units simply don’t make sense, as lossyScale is dimensionless, and x/y/z have units of length.
hows lossyScale dimensionless?
lossy scale is a dimensionless quantity.
it is a scaling factor to make the whole thing bigger or smaller, relative to a transformation matrix = identity.
that inequality will never make sense
scale is also dimensionless
if I ask you how tall you are, you don't say "My scale is 2"
that just tells me that you're twice as big as if your scale was 1
It does, yeah.
localBounds is iin local space and thus doesn't care about your scale (or anything else), by compariosn
Just gonna bump this up real quick
the bounds of a collider is a bounding box that completely encloses the collider
so that's expected
found the issue
i assume you used bounds.size to get the major and minor axes
oh, so the numbers are just accidentally correct now
not accidentaly
the units don’t match up, so it is wrong. So if it is right, it is purely accidental
and will not be correct if the collider is made a different size without changing the scale
you probably have collider size = 1 on each dimension, with lossy scale = 1 in each dimension
@sullen rock first think I would suggest is clean up that horrendous if statement, use local variables
float x² = ....;
float y²=.....;
float a²=.....;
float b²=.....;
If((x²/a²) + (y²/b²)) <1)
Sooo much cleaner to read and figure out where you went wrong
I will do that
it is not - when you start with a circle with the scale of 1 and reshape it to have the scale of like, idk, (3,2), the scale is actually the size of the bounds collider
not sure if Im explaining myself well here
english isnt my native language
That happens to be true in that specific case
But why not just do it correctly?
I don't know why we were bothering with scales in the first place anyway
You have width and height of bounds to use as a and b in the formula
change the actual dimensions of the collider without changing the scale of the transform
you will immediately see it cease to work
also, your units are still wrong
therefore, it is impossible that your formula is correct
A collider of size 2,2,2 and scale 1,1,1 should give the same result as a collider of size 1,1,1 and scale 2,2,2. However, that is not going to happen in your code. The collider of size 2,2,2 will generate points within an area of 1,1,1
That is part of why this method should be a static method that solely takes a single Bounds as an input argument.
I mean, I made this for my specific use case, not for any collider I will be ever using again
why do you insist on doing it incorrectly?
I will change it to that
I dont insist on doing it incorrectly
then why do you refuse to change the formula which is clearly incorrect
this is a correct formula for one specific use case, it is not universal, I understand your point
the formula is only accidentally correct when a specific set of numbers line up in a certain way
and it is so easy to change it from the wrong variable to the correct variable
from lossy scale, to bounds.size
but you insist on using lossy scale
i have a player data script and at line 28 i want the numbers from parenthesis to be variables.https://pastebin.com/8FGBDB6e i don t know how to make it
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.
private const int CONSTANT_NAME = 28;
private int base_health = 100;
private int base_damage =..;
Etc etc?
this is a very strange way to use a singleton pattern
An object reference is required for the non-static field, method, or property 'PlayerData.HEALTH'. Is not really working
just write HEALTH if you made a variable named HEALTH
private static int base_health;
alternatively, make the variables static if you really want to refer to them as PlayerData.HEALTH
but you already have a variable called HEALTH (which should really be written as health)
He's using it inside static property
ah, I missed that
this is a reasonable option, then
Also HEALTH and base_health should be different, keep in mind
One shows current health and one shows what starting health should be
Thanks'
I.e. base_health value should never be touched, so yeah make it a const too
how do u get what physics material an object is using? Like say if u bumped into something u would know what physics material that object was using
i mean the ones u can create
Wat
in colliders
the Collision class includes the collider you hit
Something like that
that was an example but thats what im doing
what im trying to do is when u enter a surface it checks what current physics material u are using
Unless its PhysicsMaterial2D

@dusty hull ??

how would u write that in code?
ive been doing playerCollider.GetComponent<PhysicMaterial>();
but that doesnt work
Physics materials is not a component, it's an asset assigned to a component called "collider"
it tells me that collider doesnt have a definition for PhysicsMaterial
yes, because you don't write collider.PhysicsMaterial
you also don't write collider.potato
I never said do collider.physicsmaterial
You're making shit up on your own buddy
if you want the material property, you get the material property
it's just a property on Collider. that's it
See right here
collider.GetComponent<SomeComponent>() has the SomeComponent name because it's a generic method
you don't just stick the type name in when accessing a field or property
Helllo! I have a bit of a problem
I'm making a 2D topdown game, and I want my character to be able to pick up a gun. The idea is that he approaches it lying on the ground, interacts and the gun joins with the player, and now he's able to rotate it and shoot
What I was doing is I have a gun object, and when the player approaches and interacts, the gun destroys and instantiates itself again as a child of the player and enters "picked up state"
Where it does all of it's stuff
But the gun still isn't attached to the player and is somewhat independent with its movement
Is there anything I can do or should I go for another approach?
What do you mean independet in movement?
Player guess forward and gun stays in same place?
Yes
Maybe it didn't become child
And if I add a rigidbody and try to sync the movement up with the player it gets it's own physics
As one does ofcourse
make the Rigidbody kinematic when you pick it up, then the parenting will work
you cant parent rigidbody and expect it to work, or yeah kinematic works
you could also use a completely separate object for the "gun on floor" and the "gun in player's hand".
There's no rule saying they need to be the same prefab or whatever
I could do that
Yeah
the "gun on floor" prefab could have a reference to the "gun in hand" prefab, for example, which can be instantiated when picked up
usually pickups are different prefabs than the actual items, yes
i want an object to follow my mouse (the light blue square) however everytime i start the game it goes into the corner and it only moves when my camera moves? this is my script
void Update()
{
transform.position = cam.ScreenToWorldPoint(Input.mousePosition);
}```
camera is prospective you're not accounting for that
cam.ScreenToWorldPoint(Input.mousePosition);
This isn't going to work in a game with a perspective camera. https://unity.huh.how/screentoworldpoint
oh okay
yes it's not resolved
which part is not working still ?
I have three button that should go to three different 360 photos and they all go to the same one
show button's onclick for each button
oneclick?
no I did not say one lick, I said the Buttons On Click event , capish?
in the code?
the code and the inspector of each button thats shows the On Click event
here @rich adder
well first this loop is wrong
for (int i = 0; i < objSites.Length; i++)
{
objSites[1].SetActive(false);
}```
this only deactivates the 2nd site
3 times
put debug.log inside here make sure index are passed on correctly
I changed that to i not 1
ok
before or after objsite?
put log like this cs public void LoadSite(int siteNumber) { //show site objSites[siteNumber].SetActive(true); Debug.Log($"found site {objSites[siteNumber].name} with {siteNumber}"); canvasMainMenu.SetActive(true); //enable the camera isCameraMove = true; }
click some buttons and show logs
I'll add it in
I'll let you knew if it fixed it
this isnt a fix, this is a debugging to find out what the problem is and how to fix
click all three buttons and show the prints
i dont know if this is the correct channel for my question but how does unity decide what sprite gets rendered first?
Does anybody know how to make a Grid Layout Group the same for all resolutions?
Order In Layer
wdym by "the same"
in what ways should it stay the same?
Generally UI must adapt to different resolutions either by scaling, rearranging, etc.
what if they have the same order in layer?
Its different depending on the resolution
Looks like a canvas scaler problem
How would i fix it?
By changing canvas scaler settings
oh!
I'm not 100% sure tbh .
this is more of #🖼️┃2d-tools question maybe or #💻┃unity-talk
hey guys. when i try to import asset, i get this. can smb help me out?
ok thank you 🙂
"Cannot import package in playmode"
are you in play mode?
idk what it is
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Here are my current settings idk how to fix
thanks. fixed it
like this?
{
objSites[i].SetActive(false);
Debug.log($"found site {objSites[siteNumber].name}with {siteNumber}");
canvasMainMenu.SetActive(true);
//enable the camera
isCameraMove=true;
}```
sure, click buttons and show the prints
unity is busy a lot and for a long time
I did not write it Debug.log
I wrote Debug.Log
capitalization matters..
it's case sensitive got it
just copy it exactly how i wrote it
Hey guys, im new so sorry for the dumb question but how do you reference other scripts within a script. If I wanted to access code from a different file etc
prints where?
in the Console window
idk if this is the right channel but how do i remove the line in the center of visual studio
"the line in the center"
thats helpful
its like a divider but it doesnt do anything
can you like screenshot it , I have no idea what you mean
i would but im on my phone rn i will try to find an image on google
two errors
You put in the completely wrong method
oh I did
Pay attention
cant find one
this ?
nope its vertical
did you open two script side by side?
nope
log in to discord in your web browser and send a screenshot.
i cant right now
see if you have this option
im on a mac
ooofa
yeahhh
Visual Studio mac or VScode?
visual studio mac
oh, that's nothing to do with Visual Studio on windows
vscode says i dont have an .net sdk (i do)
you should really just switch to VSCode, since "Visual Studio" on macOS is getting sunsetted
I use VSCode on my mac
(the "visual studio" editor also just kind of sucks)
You could just like reset layout afaik
yeah i would use vscode
guys why the hell is this not working wtf
https://hatebin.com/ryekhonufd
I just wanted to make it so when i hold down left click ,laser (which is a stupid 2d sprite square gameobject) is active, else is unactive. I'm going crazy
If it says it, then it is either not there or it is not in the PATH
Sometimes restarting your computer can help
yeah VS for mac is going bye bye in august
i dont know what the path is
macos doesn't exactly have a "PATH" like windows
Oh, missed the mac part
oh I should put it here?
Update doesn't work when gameobjrct is disabled
and also sometimes when i play around with setting it works but then after a while it says it again
literally the screenshot I sent lol look at it you see where it is yes
@faint sluice i see thanks
are you using the new VSCode Unity extensions ? @noble summit
new?
like version? if so i have the latest
no. The Unity extensions for VSCode
i think?
how do i know if it is new
i used vscode for unity before and had no problems
"the new" implying that you're using the Unity extensions instead of the old way with Omnishaprp
ah then yes i do have the extensions
Nowhere did I say to put a function inside a function..
I think I fixed it
you outta make your life easier and learn some basics of c#..
all you had to do was add 1 line dude..
I hate to say that IM still stuck on this transform codes but It wont move can you tell me why?
I think i did everything right
What is expected result vs what's happening?
what is separationSpeed value in the inspector ?
5f seems kinda low esp with Time.deltaTime
It's actually fine , you move 5 units per second
Issue could be something else entirely, like gameobject being disabled so no update, speed value being 0, script is not attached to correct object etc
go look at the inspector for this component
make sure that seperationSpeed is 5
and make sure the object isnt set to static
Real quick, is there a method to calculate the distance between to points, instead or manually doing every time sqrt(x^2 + y^2)
Vector3.Distance
holy shit if you're fucking up a copy and paste job, you're in trouble.. @storm imp
finally.. and yeah you still got a line twice but doesnt matter right now, this is taking long than it should as is..
ok now save changes
as you see * means no saved
Save , click some buttons. Screenshot the Console window
surpising to say those dont look like GPT comment
who knows tho
And for points coordinates instead of vectors ? I there a method ?
transform.position is a vector
What's point coordinates?
There's no Mathf.Distance method
Just subtract
But you can just do Mathf.Abs(a - b)
I meann the distance between the two only through the Y axis I mean
the individual values are just floats
thats what they suggested
I did write a MathUtil.Distance method because I like the consistency
Ayo I'm forgetting my basic maths 💀
dw we all do sometimes
why is unity always busy?
is ur pc fast enough?
to get to the other side!