#💻┃code-beginner
1 messages · Page 775 of 1
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
I don't understand why when I use the command to make the object disappear it's wrong
In Edit > Project Setting > Player, switch Active Input Handling to Both
You should show your code or screenshot and what not
Look at your syntax. Its not the destroy method, thats wrong
Brackets 
The problems are literally in plain sight
Erm, actually they’re called curly braces/brackets 🤓
@technopig123 muted
Reason: Sending too many attachments.
Duration: 29 minutes and 53 seconds
Follow the guides for how to post code. There shouldn't have been a lot of attachments.
How many could he possibly posted lol
I guess every line of code into one code block
!input 👇
To set Active Input Handling, go to:
Project Settings > Player > Active Input Handling
• Input Manager (Old): Use the original Input settings.
• Input System Package (New): Uses the new input system package.
• Both: Use both systems.
okay , lets try that again... xd
Thank you , below is both related classes, a screenshot of the Canvas Inspector, a screenshot of the Inspector for my parent UnitCardContainer Object, a screenshot of the Inspector for the OwnerText child object , a screenshot of the inspector for the ArmyUI_Banner child object, a screenshot of the Hierarchy in the scene, a screenshot of both what it looks like in Play and Scene and lastly a screenshot of the UnitCard Prefab , if I missed anything apologies in advance.
What's intended to happen is that each time an Army Token is selected a unit card will be generated and placed in the Banner , each unit card uses a set image based on the army composition (spearmen, archer, cav etc) with some small details displaying the number of said unit below.
However what appears to be happening is although the unit card images are created they are actually behind the Banner not in front, hence I cannot see them in Play and only can locate them via Scene , also they overlap and the scale is way off of what it should be based on my settings. Its my first custom UI so may of missed some basics. Thanks again for taking the time and if you need any other info please let me know!
Code: https://paste.mod.gg/
A tool for sharing your source code with the world!
please see the "Large Code Blocks" section above.
your ide is not configured.
!ide
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
apologies
hey uhm guys i downloaded the extensions for c# and this popped up
still have no idea what this means
im like NEW new
Popped up where?
when i tried it
wait actually i found out the solution
i just needed to change the json settings
quick question; looking for some way to pick functions that return a bool from gameobjects.
I want to refer to functions that return bool so I can supply a list of methods that provide conditions from various gameobjects through the inspector.
Here's what I have now;
[Serializable]
public class ConditionalUnityEvent
{
[SerializeField]
private UnityEvent _event;
public UnityEvent Event => _event;
// A list of functions that must return a bool
[SerializeField]
public List<Func<bool>> Conditions = new List<Func<bool>>();
public bool AreConditionsMet()
{
return Conditions.All(condition => condition());
}
}
but Func<bool> is not serializable, unfortunately.
I'd try UnityEvent<bool>, but that requires functions to have bool as a parameter rather than a return type.
did anyone every faced an error where you are getting the network prefab object name and all the references are there but you cant get the id??(using photon fusion 2)
The current solution I'm considering is some wrapper MonoBehaviour like
public abstract class Condition : MonoBehaviour
{
public abstract bool CheckCondition();
}
A wrapper or even just an enum and a switch
Could you elaborate?
Can someone tell me how can I re create this?
I am a beginner, my mind can't process how can I remake it in my project
What part? 🤔
the lock system
all of them🫥
Lol, good luck.
At the very least, use some critical thinking and break down the actual thing you're trying to make. Before making "all parts of this lock system", get 4 images on your screen that, when you click any of them, will swap to the next image (even without the scrolling animation), for example.
we're here to help, not do your homework - some random guy here, probably
thx bro i appreciate that❤️
I assume these are supposed to be different per class instance, right? The enum and switch praetor suggested would be the quick dirty way to do it. Quite literally just an enum and you select a value in inspector. You switch based on the enum and call the appropriate method
Otherwise you could make a class to represent each logic and attach that to the component in some list. Would likely want to use a plain c# class and [SerializeReference] in that case
Hey I just had a question. So I want to move an object (a projectile) in an arc formation towards a target. How would I go about doing this? Is there like a built in parabla function in unity where I could pass in the targets location so it moves to the target in an arc formation? Thanks!
Unity doesn't have a built in helper function, no. But that's classic math that you can definitely find the formula for online.
Are you using 2d or 3d?
there are infinitely many parabolas that pass through 2 points
doing
return class?.value```
will not trigger NRE if class itself is null right?
From my limited math skills i can think of 3 solutions:
- You add force to every axis using seperate lines of code but in the same frame
- You make an equation for the parabola and then one for a sphere with a very small radius and then find a point where the two intersect and add force in that direction
- You use the two solutions together by using whichever axis is up and another one and separately add force to the remaining axis
because this is a get function to get data on server, i dont want it to throw NRE for everything it couldnt find
i don't think you can do that
class isn't a valid identifier in c#
oh its just a for example thing
ApiResponse<GetItemsResponse> result = await gameApiClient.CloudSaveData.GetCustomItemsAsync(context, context.AccessToken, context.ProjectId, type.ToString());
return result.Data.Results.FirstOrDefault(x => x.Key == ID.ToString())?.Value;```
this is the full code
all sorted now . my UnitCardContainer hieght was being controlled elsewhere and messing it all up
where result datatype is Item , a class inside cloud save
maybe don't use keywords for examples lol
lol sry bout that
the entire point of ?. is to not throw when the LHS is null, yes.
ty 👍
thats exactly what i want
though keep in mind that unity null will not be caught by this
so either don't use UnityEngine.Objects with this, or keep that in mind and be sure of what you're checking for
So basically for context, Im creating like a parry system in an RPG. When its the enemies turn, it chooses a random attack from a list of available attacks (scriptable objects) then it calls the execute method on that attack. For the attack Im working on right now, the enemy spawns projectiles at its location (spawns like 3) and then I want it to move them towards the targeted player in an arc formation. When the projectile hits the player, it gets destroyed.
should it follow a fixed path (going to where the player was at the time of launching) or should they home in to the player
i have a strict rule for this dont worry, like it must return null if it didnt find anything, and i will have null checks or guards for each get requests
that's not quite what im referring to
i'm referring to unity's fake null that isn't caught by ?./??
fixed path. I have the targeted player instance in the method so I could use that to move the projectile to the target. I know Unity has a moveTowards function but Im not sure how to get that parabla formation. Thanks.
For the last solution youd need a parabolic function, an equation for a circle, and one for a line
@amber glen you'll have to add another constraint to limit it to a certain path, then you can math it out
you wouldn't really be using geometry math directly
you would be using kinematics to figure out the appropriate starting velocities
Or yea you could do that instead of my jank ass solution
i made it ,still the anim is missing🙂
hello everyone
hello
figured i should join this server for tips, im new to unity so im hoping i can learn a few things while im here
same thing with me
gj
!learn and also check the pins
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
could someone help me with my problem?
I get a null reference exeption because of an Object reference that is not set to an instance of an object, wich i dont really understand, since to my knowledge everything is referenced correctly and for some reason it did work before, so i just have no idea
What line are you getting the reference from
!code btw
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Is there a reason you have a seperate static thing and not the entire class?
i dont fully understand what you mean. That i Have 2 different classes?
Public static ExperienceManager Instance;
that's part of the singleton pattern (at least how it's typically implemented in unity)
Oh nevermind then im outta my depth here
OnEnable in the other object can run before Awake in the singleton
anyway, the issue is execution order. the first object's OnEnable is being called before the second object's Awake
ah dang i was too slow
sniped
You can make Instance in the singleton a property that initializes itself, that'll take care of timing issues
fwiw that event can probably be static
The execution order also depend on the hierarchy iirc
execution order has nothing to do with the hierarchy or order of components or anything like that
I just put in start(), that seems to work
do note that Start is only run once in an object's lifetime. so if you disable the object subscribed to the event then it will never resubscribe if it gets enabled again (unless you are also subscribing in OnEnable still, but then you'd potentially have two subscriptions)
yo is this good? click-flashlight f breathing- sprint/shift im new to making unity btw
#1180170818983051344 to share your work and request feedback
U can modify the order as u want https://docs.unity3d.com/6000.2/Documentation/Manual/class-MonoManager.html
Thou this is probably too brute-force. I don't have any other idea to guarantee order. May be a coroutine can do it better
it can not be avoided in some cases, but changing the execution order should never be a first choice
im new
its better to understand Awake vs Start vs OnEnable first or directly control things yourself by calling in the correct order yourself
SEO doesn't guarantee order either
it's only within each scene
Yes, I though of that
the order of stuff that exists at the same time you should use the distinction between Awake and Start to deal with
and if that is not enough, build something that references it all and does it in the required order
!ask
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #🌱┃start-here
what can i change about this script?
It is a rigid body controller script if your asking
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
what do you mean? are you looking for code review?
yes
alright, post your code properly
ok one sec
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class PlayerMovementScript : MonoBehaviour
{
private Camera CameraFOV;
private Vector3 PlayerMovementInput;
private Vector2 PlayerMouseInput;
private float NormalPlayerHeight;
private float xRot;
private float NormalSpeed;
private bool isGrounded;
private bool isSprinting;
private bool isCrouching;
[SerializeField] private Transform PlayerBodyTransform;
[SerializeField] private Transform PlayerCamera;
[SerializeField] private Rigidbody PlayerBody;
[Space]
[SerializeField] private float Speed;
[SerializeField] private float SprintSpeed;
[SerializeField] private float CrouchSpeed;
[SerializeField] private float Sensitivity;
[SerializeField] private float JumpForce;
[SerializeField] private float CrouchHeight;
[Space]
[SerializeField] private Transform GroundCheck;
[SerializeField] private LayerMask GroundLayer;
[SerializeField] private float SphereRadius;
[Space]
[SerializeField] private float SprintFOV;
[SerializeField] private float NormalFOV;
[SerializeField] private float SpeedOfChangeFOV;
[SerializeField] private float CrouchFOV;
{
CameraFOV = Camera.main;
Cursor.lockState = CursorLockMode.Confined;
Cursor.visible = false;
NormalSpeed = Speed;
NormalPlayerHeight = PlayerBodyTransform.localScale.y;
}
void Update()
{
isCrouching = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
isSprinting = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
isGrounded = Physics.CheckSphere(GroundCheck.position, SphereRadius, GroundLayer);
PlayerMovementInput = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
PlayerMouseInput = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
// Sprint Logic
if (isSprinting)
{
Speed = SprintSpeed;
CameraFOV.fieldOfView = Mathf.Lerp(
CameraFOV.fieldOfView,
SprintFOV,
SpeedOfChangeFOV * Time.deltaTime
);
}
else
{
Speed = NormalSpeed;
CameraFOV.fieldOfView = Mathf.Lerp(
CameraFOV.fieldOfView,
NormalFOV,
SpeedOfChangeFOV * Time.deltaTime
);
}
Crouch();
MovePlayer();
MovePlayerCamera();
}
private void MovePlayer()
{
Vector3 MoveVector = transform.TransformDirection(PlayerMovementInput) * Speed;
PlayerBody.velocity = new Vector3(MoveVector.x, PlayerBody.velocity.y, MoveVector.z);
if (Input.GetKeyDown(KeyCode.Space) && isGrounded)
{
PlayerBody.AddForce(Vector3.up * JumpForce, ForceMode.Impulse);
}
}
private void MovePlayerCamera()
{
xRot -= PlayerMouseInput.y * Sensitivity;
xRot = Math.Clamp(xRot, -90, 90);
transform.Rotate(0, PlayerMouseInput.x * Sensitivity, 0f);
PlayerCamera.transform.localRotation = Quaternion.Euler(xRot, 0, 0);
}
private void Crouch()
{
if (isCrouching)
{
CameraFOV.fieldOfView = Mathf.Lerp(
CameraFOV.fieldOfView,
CrouchFOV,
SpeedOfChangeFOV * Time.deltaTime
);
Speed = CrouchSpeed;
PlayerBodyTransform.localScale = new Vector3(0, CrouchHeight, 0);
}
else
{
CameraFOV.fieldOfView = Mathf.Lerp(
CameraFOV.fieldOfView,
NormalFOV,
SpeedOfChangeFOV * Time.deltaTime
);
if (isSprinting) Speed = SprintSpeed;
else Speed = NormalSpeed;
PlayerBodyTransform.localScale = new Vector3(0, NormalPlayerHeight, 0);
}
}
#endregion
}
Here it is all i finally remembered how to script in c# twin
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
ojjj
see the large code blocks section
Use the links, paste codes there, and paste the link of the code here
you're using wronglerp here, but it's for visual effects so not too much of a concern
https://unity.huh.how/lerp/wrong-lerp
Applying lerp so that it produces smooth, imperfect movement towards a target value.
ideally you'd probably want to use proper smoothing functions
ik but its meant to be simple so yeah
i don't see how that changes what i said
simple can coexist with correct/replicable/accurate/maintainable/consistent/tweakable
Do you want code review or not
yup i get that ill look into it more i mean i came back to unity like a month ago so i like forgot everything ill try implement it
1 - Math.Exp(-SpeedOfChangeFOV * Time.deltaTime) So im using this and it is saying it cant convert from a double to a float but i dont know how to fix it. do i have to asign a differnet data type?
From the page linked:
I fixed it now i just added MathF.Exp
that's from System btw. the unity one is Mathf
hello guys i decided to make some fun things and simulate roblox movement physics
so you know in roblox u cant run up but also
you are not
slide down
when you are on a slope
so the only thing you can do is just jump up
Finish a thought, then hit enter
and i made
just my eng so bad
private Vector3 HandleSteepWalls(Vector3 velocity)
{
Vector3 normal = CharacterControllerUtils.GetNormalWithSphereCast(_characterController, groundLayers);
float angle = Vector3.Angle(normal, Vector3.up);
bool validAngle = angle <= _characterController.slopeLimit;
if (!validAngle && _verticalVelocity < 0)
{
velocity = Vector3.ProjectOnPlane(velocity, normal);
}
return velocity;
}
this is my code to handle slopes
and i decided to make it so im not gonna slide down but also not run up
so only jump like in roblox engine
but idk how to do this
i tried to basically just get rid of sliding and just nulify vertical velocity but it leads to sum bugs like im being stucked in a Jumping phase
okily doily
Is unitys much different than microsofts?
The f at the end is the difference. Unity uses floats
Ahh, thats it?
Pretty much. Math is math.
Base C# just assumes that if you're dealing with decimals you're using doubles
Which are more expensive yeah?
Yes, but normally you care more about the precision than the space requirements.
Games have strict frame budgets and are perfectly fine with "close enough" so they're more suited to floats
Fair point unity's floats for transforms does feel restrictive at times but i hear using doubles would kill preformance
i got a wierd bug where i press play with a rigid body character controller the players body dissapers why does it do that?
Gravity?
Do you have script trying to move it?
yes
Where does the inspector say it is
where im moving
Could you share a video or photo of this
I mostly want it to be inspector-friendly, so a low-code approach would be preferable. Hence why I am looking into the 'just select a method that returns a bool'
one sec
also for some reason i seem to spaz out when i shake my camera violently and start walking
If u are using CharacterController.Move then ProjectOnPlane wont do much. Gravity still applies and u will slide down.
i fixed it i needed to constrain the rotation constraints on the rigid body
yessum...?
What do you think a capsule with zero length and width would look like on screen?
hmmm.... idk really man
Imagine a pencil with zero diameter. What would that look like
would you be able to see it?
either of the options are inspector friendly, and would pretty much result in "just selecting a method". The difficulty comes in the implementation. Enum and a switch is simpler. Attaching logic via SerializeReference would require some miniscule editor logic to actually create an instances of your plain c# class
system also has MathF
System.Math is for doubles
System.MathF and UnityEngine.Mathf are both for floats
MathF and Mathf provide a different set of functions, Mathf provides more gamedev-related stuff and MathF provides some low-level access.
for some reason, Mathf.Sign(0) == 1. sometimes that's good, sometimes that's bad.
i am so confused, i deleted a script, and now 2 prefabs with the script are not working, its saying im saving a prefab with a missing script?? im so confused and i cant run the game because of the warning, please help 🙏
You have to open the prefab and remove the broken script instances
i have, its still there?
Is that a question or??
You missed one or more broken script instances somewhere then
its only in 2 prefabs, ive checked both, the warning is on one of them, and its not one it
Check inside the prefabs, in their child objects too
Show screenshots if you can't figure it out
okie, what of?
ok hang on
just quickly, i added a script with the same name, same code, and its telling me 'the type or namespace could not be found'
here is the screenshot
This isn't an error that the prefab has missing scripts. This is an error that your code is attempting to use a type that doesn't exist.
ik, that is when i added back a script with the same name
should i delete it, then show the screen again?
Guys, when I clear children of my UI and add new UI objects, they are added with all components disabled. What gives? 😮
If you have code that expects a type EnemyHealth, you need to have a script named EnemyHealth
yes go back to the state you weere haveing trouble with. Also please show the console window
yeah i do, thats the script name, so i dont know why its saying that
Show it
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
the script name, or code?
Just share the full script for EnemyHealth
okie
omg wait i think i just found it
the bit at the top next to mono behaviour isnt enemy script
thats probably it isnt it
also found a fix for anyone in the future.
when creating the new UI buttons I linked to the UI button in the scene that was being destroyed, instead of linking to a fresh prefab in the assets
no idea why it still created a disabled button even though the reference was destroyed 🤷♂️
another quick thing, how can check collisions on my player from litterally anything, like it is really simple or really confusing, coz i just need that one thing
you´d simply use the OnCollisionEnter call
thanks ill try that
usually you would check for a particular tag inside this event to trim things down
so i have this dragon which blasts away unneeded units but the animation takes a bit longer to activate, is there a way in which i can delay to the gameobject being destroyed or play the animation faster for a smoother experience. i googled the question and found out that i can use yeild return methods and stuff related to caroutine...? what would be the best way to go about it?
a simple solution would just be to supply a delay to the Destroy call
a coroutine is more complex, but gives you a ton of flexibility and control, i'd recommend using that
insert ah shiii, here we go again meme
why did you ping me?
i need help in this
please do not attempt to ping user groups
holy crap
this isn't even a coding question
You just messaged 27,000 people
so what exactly is happening, can you tell us
you never said what the issue is, buddy
im new to unity
i predict chat's gonna get real fast real soon
anyways since your here can you help
you haven't said what the issue is
wot it's blue
Why did you think this requires the immediate attention of nearly 30,000 people
how exactly is it different
use your words
we cannot read your mind
hell if i know what colour it is..maybe green, brown, light red or smth
are you not able to distinguish the highlight of a message with a mention
i dont see a red bird
ok, and what is the issue
have you, perhaps, not added it
don't use that tutorial. that's from a long time ago. use newer tutorials. unity has changed
can anyone reccomande me a tutorial for 2 d(since its easier)
(it's not easier)
2d and 3d are different, not harder or easier
The only project i worked on
and i have blender experience
i cant find a good tutorial to follow
i still lack alot of info to start a real game
when i zoom in this happen
https://learn.unity.com/course/2d-beginner-game-sprite-flight, i started out with this, although, if you wanna follow this, i will tell you something. the design of the resulting code will be absolutely dog
thanks ill watch it
So I want to get the x location of an object in relation to the camera with the camera’s rotation in mind. Like imagining the camera as the 0, 0, 0 world coordinates with the forward being positive z. If the object is on the right side of the camera it would be a positive x and on the left side a negative x. Is there a way to make a value that shows that by doing something like this?
Transform.InverseTransformPoint
can you give an example?
E.g.
Vector3 localPos = myCam.transform.InverseTransformPoint(theObject.position);
if (localPos.x > 0) Debug.Log("Right side");
Thank you. ill try this
You can also use Camera.WorldToViewportPoint and check if x is above or below .5
This worked. Thank you so much
Who can give me information or a video on unity scripting for beginners? I want to make a 3D game in the style of PS1 on a PC, but I'm new to this.
check the pinned channel messages
Ok so, i know floats have a limit, but what if my formula exceeds that limits and causes the infinite overflow.
Is there a way for me to keep whatever numbers overflowed as a seperate value before it actually overflows?
What are you doing that's giving a value more than 3.4e38?
Lets say excessive rpg damage formulas-
floats don't overflow
they kinda round to infinity
you'd probably want either basically your own impl of floating point (storing exponent and mantissa separately, perhaps) or using some kind of bigdecimal/biginteger that basically does that for you
for example, balatro's nan e inf value definitely hints that they're using multiple floating-points
Sooooo i can thereotically make "infinite" numbers but in reality they are just multiple floats?
probably not multiple floats
at least some doubles there, and perhaps just a ulong for the exponent
actually, there's probably more considerations to be made than i can think of off the top of my head
What kinds of operation are you doing with these floating point values? If you're wanting to account (relative to precision) for values greater than the ceiling of float, it would help to know how quickly you'll exceed the max value.
but yeah probably start with doubles instead of floats
Ok so, im using ork framework and i dont think i can use doubles for variables with it-
It does support scripting so i assume i must script it myself?
oh, no clue what that is
what are you actually using this for? sounds similar to stuff like cookie clicker games. in those cases you really dont need to actually store the super large number, just using a much smaller number and some other value to represent the scale of this number
Oh? So your saying the number itself doesnt have to be infinite but i can add it to an ever expanding value?
just something to represent the scale yea. Like are you really displaying the whole number in a value as large as 3.4e38? You're very likely not doing that and would just show the number as 3.4e38 in UI
I guess the first major question would be do you expect the damage calculations to be entirely accurate at such a large scale
surely, theres no way you would expect to have a character with 1e38 + 1 health, because this would force you to need to store the entire large number while providing absolutely nothing in terms of game design.
Ok now you gave me an idea with this
I know string probably have their own limits (i havent experimented with strings yet)
a string isn't a number, so you aren't going to be doing math directly on it
ah i was about to say
well, i know i could always use lower numbers but since im going with the disgaea series route (over the too large damage numbers) yeah you could say im looking for almost ridiculous amount of damage values
havent heard of that series myself, but regardless look for a way to fake the number being large. there's absolutely nothing you get from dealing with super large numbers
if you're doing a decent amount of calculations per frame, it will start to slow down as you get to large numbers
mantissa = 1 exponent = 18
number = 1 × 10^18
you can make a struct like this , add custom +-*/ operator and the comparer
yes
Gotcha! Ill see what i can do with this info!
Hi guys I’m getting a pc soon and unity will probably be the first game developing Engine I use and I need some tips
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Interesting
the user is never going to see that they have 10,000,000,000,005 health. It'll be 1x10^(however many digits i put there). Same with damage. If I have 1e10 health, and I take 1e10 damage, I die. I don't expect to live with 5 health
What type of game has that much health dawg😭🥀
Me wanting to be over the top-
basically any clicker game already has this implemented
Ig that makes sense
big number do give me dopamine fr
some game also just leave the overflow part as an achievement rather fixing it
Oh ok
Thats the exact reason why im doing it
Like even if its not the "real" number i want people to see high numbers
Highscore comparing type of stuff
1500000000 health is pretty much immortal like there’s no way you die with that much health😭
tryna add my friends to a project and all their projects are empty/
can someone try to fix this?
don't crosspost
what does that mean?
im pretty new and tryna learn
don't spam the same question across multiple channels
Ok so since u no longer have to use the number itself i have a question guys
In a string, can i take a specific letter (or number) position and edit that one letter? By the way this is a extremely specific example
You will be able to read it, but not modify it because strings cannot be changed once they've been created
To read a character, index the string as if you were using an array or a list:
char c = str[4]; // gets the 5th character, you can use a variable instead of a number
I see.
A text variable you mean?
string word = "DRONE";
int myInt = 3;
char letter = word[myInt];
letter would be N
both.. u can use variables for strings.. u can use variables for integers
i think they were meaning for the int tho... so instead of a hardcoded value like 4 you could use a variable myInteger
you can edit a copy and reassign it..
Ah thats good
// convert to char array (editable)
char[] chars = word.ToCharArray();
// change a letter
chars[2] = 'X'; // replaces 'O' with 'X'
// make a new string
word = new string(chars); // "DRXNE"```
And strings can contain numbers right? Even if they arent use in math?
Oh i didnt expect a code, thanks!
yup..
0123 can be an integer.. or a string..
Ok this is perfect!
u can convert strings to numbers if u want
pretty much anything u can think of there's atleast (1) way to do it
if not dozens
And i can atleast split a string for ui purposes right?
oh sure.. u can split strings, u can modify them (as a copy), u can capitalize them, lower-case them, remove certain things like white-space or w/e else
Gotcha. Just making sure
Just incase if i do make a copy, what happens to the original string?
nothing unless u reassign it (make it something else myString = newString)
Right (sorry if im being annoying btw)
Can i delete it and keep the copy as a replacement?
why not just reassign it w/ the copy?
Ah thats what you meant by reassign
Sorry lol im still getting used to the terminology
string original = "DRONE";
// make a copy
char[] chars = original.ToCharArray();
chars[2] = 'X';
string edited = new string(chars); // "DRXNE"
// original is still "DRONE"
// edited is "DRXNE"
``` this keeps the original and the copy seperate
original = edited;
is this an acceptable way to code this out or is there a better way to do it...
no worries.. im on my 4th year and i still have trouble with some terminology..
it helped me to use note paper to right down keywords that really helped with searching
Ooo good idea!
thats what i come here for help most often... if i can get someone to help me out with the words i should be using to refer to things i can go off and search on my own.. (if i can't come up with the right terms my search is just a spiral of nothingness) lol
Also thanks, you didnt have to give the code for it🙏
String manipulation is what we're discussing right now
quick q, what game object are you destroying specifically here?
for me, since i started asking other people stuff, on discord, i felt like i had to learn up terminologies else i wouldn't be able to understand what peeps on disc were talking abt
code with comments is easier for me than trying to explain everything in words
👍 lo
it definitely helps to communicate
the GameObject the collision is occuring with
thats the way i would do it... Coroutines for the win 💪
no i mean, that specific game object
what is it in your scene
its a bit unrelated to what you asked but if its a kind of game object that will be getting destroyed a lot..... you should probably not actually call a destroy but rather pool it
as it reads it:
- collides with object
- grabs its animator and sets the Trigger -> PlasmaBlast
- then after 1.5 seconds it Destroys that gameobject
i have a lot of ducks who are going to go through a massacre...whom i am using Destroy on
you could do it all in one coroutine
If you need to destroy something after a period of time, Destroy literally takes in a time parameter as the second argument and you don't need to use a coroutine
yeah then start working on a pool system
for the ducks at least
you dont need objectpooling for everything but whatever is getting spawned/destroyed the most often in your scene
chris did tell me that that was a way to do it, but he also said that since caroutine overtime has a lot of other implementations as well, that i might as well learn about it...that's why i did it
is there a reason as to why you would suggest doing that
Fair. It's basically the same thing under the hood
is it expensive to destroy and instantiate gameobjects
damn, duck parades are too costly i guess then

ok, i think i might wanna learn abt object spooling in that case, @solar hill thx for the idea
you could also do something like this.. (so the coroutine does everything)
that way you can just hand over the Collider from the Physics method to the Coroutine
oh also, ur pfp gives me the heeby jeebies

insert he's standing there, menacingly meme
sir, we've been trying to reach you about your car's warranty
not even the scariest matthew mcconaughey looked in that show
i think i will go sleep now
Destroy takes an argument for a delay, you don't need a coroutine
I already sent the check bro
although i guess yes if Destroying the gameobject is all that you are doing (with the delay) then just using Destroy's Destroy(other.gameObject, 1.5f); would be the cleanest/smartest way in that situation
you should cache the animator component
I'm stuck at jitter animation, while walk, running, falling. I doesn't understand why?
if you believe it's a controller problem then provide the code, otherwise #🏃┃animation
If I were to guess though it's some problem with the update. I'd also disjoint the camera and see if the issue persists from afar instead of having it fixed onto the character
I believe controller problem because i did experiment similar animation with root motion it doesn't jitter
!IDE
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
I'm really confused on why it works in the tutorial and not for me, it doesn't give any error codes and should all be similar like in the tutorial
What tutorial are you following?
This is the video where I get stuck in this tutorial series:
https://youtu.be/QMChxH3LLMc?si=a6ape6YVIYXRWVd4
⚔️ Time to give our Player some real power! In this Unity 6 tutorial, we’ll create the Attack State, animate it, and sync the hit timing so damage actually lands at the right frame. To tie it all together, we’ll add our first Core Component: Combat, laying the foundation for a flexible combat system.
This is a big topic, but we'll try t...
What part of the tutorial are you stuck on?
Well, I did everything as it said, in one part the maker also gets stuck similarly, but fixes it. But when I add that fix, nothing changes but the fact that now I can move if I don't attack. It gets stuck after attacking
Wait, hang on
Oh ffs, it didn't save the last time
I'll give an update soon, I'll add the fix back and see if it works now
Okay now it moves, sorry for all the hassle -^-;
hi
I need help with VS studio
its so annoying
like in the tutorial im using he gets recommendation for things like gameObject
but when i put g in
!ide
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
ive done it
it still didt ork
like i saw it for a millisecond
then it disappeared
also theres this
ms-dotnettools.csharp: Trying to install .NET 9.0.11~arm64~aspnetcore but it already exists. No downloads or changes were made.
visualstudiotoolsforunity.vstuc: Trying to install .NET 9.0.11~arm64 but it already exists. No downloads or changes were made.
this is actually ragebaiting me
first of all, do not spam with random thoughts please. Facts help more to help you. Did you close vs code entirely and open it through a unity script by double clicking?
Sorry
Yes I did
I will try again
Ok I force quit vs code
Ok opening the script
When pressing g game object does not appear
so the problem is ur VSC isnt configured
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
• :question: Other/None
I’m ok 7 minutes of beginner tutorial and 50 minutes of trying to fix it
every IDE (tools that u write codes) must be configured to suit unity
if it doesnt work, it just mean ur IDE still not properly configured
Did you install the package in unity?
Could you please help me properly configure it if it doesn’t bother you
I tried and it didn’t work so I deleted it and now run it externally
Run what externally?
That’s what is says
Here
ohhhhhhhhh
so ur telling me not only did u delete the package for VSC in unity, but also now u just directly go into the project folder , and open scripts there with VSC?
Yes kyubey the gost
thats not how u do it
Uh I don’t delete the package in VASC for unity
And I open them from unity
So do you have these packages installed in unity or not?
Let me check
Ok
Sure yeah
Thanks for helping tho
Also, if you keep on posting photos, you risk being killed.
Literally.
it hurts our eyes
really
u need to learn how to take screenshots on mac
(As dlich's lawyer, that was not a direct threat)
Mobile hotspot/WIFI sharing from phone
Then throw away your Mac and get a windows pc
💔 I wish
Just kidding. But it's likely something mac specific.
ok , now i want u to check from scratch
- is the unity ur using later than 2021
- do u have a working vsc now , in ur mac
i recommend LTS , its far more stable , but i guess its okay
now, make sure u have this installed
once u installed it, plz "screenshot" ur package manager with the tick
Got only visual scripting at 1.9.8 and visual studio éditer at 2.0.25
plz take a screenshot if u can, just want to double check
click onto the 2.0.25 item , show the detail page, and then screenshot the whole package manager
Ok one second I’m at the elevator
bro come back later 😭
I'd also confirm that you have these vs code extensions, as well as dotnet installed(I think there was an error in one of your photos).
Installing the Unity extension installs all its dependencies required to write C# with Visual Studio Code, including the C# Dev Kit
I Rmember vaguely that someone on Mac had an issue where not all dependencies were installed automatically.
i dont use vsc for coding, i use rider , so if u need to check what exact plugins u need to install there u need to ask someone @viral magnet
this should be what you need
this is what i have rn
then why doesnt game object show
and other thing
it shows general
if u install multiple version vsc, plz make sure u choose the correct one
These messages in the output look extremely sus.
I feel like this is a Mac specific issue after all.
i only see one
i downloaded the .NET 9.0 on the website
because a tutorial i followed told me so
is the issue thag its 1.1 and not 1.7
I'd check the C#/C# devkit and unity output logs in vs code. They might have more info.
ok thank you
i asked chatgpt it was so fcking useless
i watched tutorials didnt work
like it does suggest
just not the keywords such as gameObjec
the problem for AI is they dont know what is right or wrong, if AI couldnt get a right answer they will lie and make up one for u
You need the Visual Studio Code package, this is for VS proper
how do i get that?
Oh nvm, it's the same one
visual studio editer doesnt do anything right
cuz the only problem is not suggesting gameObject and things like tht
like .name
because the IDE is still not configured yet
Did you check what I suggested here?
#💻┃code-beginner message
what's making it pick up the functions in this screenshot but not local variables, out of curiousity
uh no
thats what i wanna know
its not givng me the unity variables to configure the,m
i open it from unity
ok
never opened it externally
good
so i dont understand why its not giving me the unity variables
for the one last time, are you absolutely sure, that the vsc u currently using, is the only one vsc ever existed in this mac
im not talking about on unity, whether u can see it or not
i may have downloaded it once or twice
im talking about is there multiple vsc existed in ur mac
Because it's still not configured correctly... We told you several times.
If it's the editor that is being opened from unity, then it's the correct one. I don't think it's an issue of several separate editors.
in launch pad there is only one
so yea
like for a second
i swear to god
i saw gameobject
- latest version of vsc
- only one vsc exists
- supposedly configured
im pretty sure the problem is inside VSC
You should debug the issue via the extension logs... I'm not gonna repeat it again...
@viral magnet u need to take a look the logs now
how do i check logs
Check my screenshots
go to ur terminal , output , and type in the devkit, or choose it
no it's output
hold on
You even had part of that in one of you photos...
Can you tell me what to do in such situations? Should I create a separate object with the same scene or turn on the phone orientation check?
2025-11-26 16:42:07.461 [info] Locating .NET runtime version 9.0.1
2025-11-26 16:42:08.066 [info] Did not find .NET 9.0.1 on path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime
2025-11-26 16:42:08.307 [info] Dotnet path: /Users/thealternate/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/9.0.11~arm64~aspnetcore/dotnet
2025-11-26 16:42:08.307 [info] Activating C# + C# Dev Kit...
2025-11-26 16:42:08.651 [info] [stdout] info: Program[0]
Server started with process ID 5165
2025-11-26 16:42:09.333 [info] [stdout] {"pipeName":"/var/folders/8n/t4vnzgb539v6jwrzfngp98sh0000gp/T/d49aeed4.sock"}
2025-11-26 16:42:09.333 [info] received named pipe information from server
2025-11-26 16:42:09.334 [info] client has connected to server
2025-11-26 16:42:09.408 [info] [Program] Language server initialized
got it
Curious. I'm trying to use a tuple combined with my dictionary to store 2 keys. but accessing items
gets this error
- Cannot modify the return value of 'Dictionary<Vector3Int, (float, int)>.this[Vector3Int]' because it is not a variable
mb gng im kinda dumb
is this matter?
probably
Is that unity extension output?
its visual studio output
@viral magnet now, just like what @teal viper said, i want u to search for unity output
should be here
We've been through this several times now!
What do you have selected in the output dropdown?
maybe store the value you get from indexing tileProgresses then write back to it with new data
i havent used tuples in c# but isnt it better to use a struct here anyway
2025-11-26 16:42:08.321 [info] Dotnet path: /Users/thealternate/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/9.0.11~arm64/dotnet
thisis unity
I feel like value type tuples are immutable. Not 100% sure.
Isn't tuples more so a python thing eitherway? and yeah that sounds like a better idea, but i've never used a struct as far as i can tell.
unity VSC output dump
structs are smaller classes
well not smaller
tuples are fine to use in c#
@viral magnet can u get into the thread?
Perhaps what i'm doing isn't exactly ideal eitherway to put it nicely lol
you don't edit the tuple directly you replace it
It's probably not. I'd create a struct or a class for that value.
ooh right, i know what you mean. I can try that
eg. tileProgresses[intPos] = (elapsed, tileProgresses[intPos].Item1)
would work
public struct TileProgress {
public float item1;
....
}
Yeah, that makes better sense. i wanted to avoid having to modify both each time so i thought i could be sneaky xD
do i need to use the struct keyword? whats the difference between class and struct in this case?
it truely does not matter at this scale. thinking about it is good practice but stuff like this is gonna be insanely cheap unless your in mass scale
i don't remember exactly but i think it's just structs can't have methods
ok done
i'd probably watch or read a guide on them before using them, they can be slightly difficult to explain over convo
nvm then
i have no idea how to explain this though so you're better off watching a video like what batby said
they can have
Will definitely do. Thanks for the help. Knowing the name of the keyword helps alot in searching for the thing you want to exactly learn
For a vague point of comparison stuff like Vector2 and Vector3's are structs
think of structs/value types as bundles of data and classes/reference types as discrete, persistent objects
Wait are structures just a lighter class?
no
structs are value types, classes are reference types, they have different behaviors and semantics
(but they are lighter because of those differences yes)
Alright yeah that makes alot of sense.
well, kind of a double-edged thing.
classes use more memory, structs use more time
but mainly, structs are not classes but X
in isolation yeah but generally places where you'd really want structs and are considering performance they would probably be better off time-wise, no?
i could be wrong, i've spent all day messing with stuff at scale 😅
it will usually cost more to copy a struct than to copy a reference
though, maybe optimization means that doesnt' matter
there is also cpu level optimization that might mean it takes longer to access class stuff due to not being in cache, maybe?
but that's far outside the scope of this discussion, at this scale it definitely doesn't matter lol
im doing something that does 28mil comparisons and i got it down from like 40-60ms to 0.17ms today which has made me slightly more comfortable with them
Hi everyone. I have a question about moving a player.
I started today developing a 2D sidescroll puzzle game and I have a Player with a Rigidbody because i want it to have gravity to fall. Which is the BEST way to move the player? Use the rb (if yes the best way is MovePosition, AddForce?) or moving him with Transform attributes?. Consider that maybe in the future i want to apply to my player external forces like an explosion, knockback and other stuff.
Thx in advance
there's no best, but transform is definitely off the table
What gives each one better the others
it basically boils down to 3 options
- via MovePosition
- via velocities
- via forces
if you want to apply forces, then using forces to move the player to begin with would provide the easiest way to add external forces
but it's not the only way
why
even with the other 2, you could make your own systems of making forces apply correctly
im new to coding and just wanna know why for future projects
maybe cs it can go trough other stuff?
the rigidbody will try to control the transform. if you try to control the transform too, you will be fighting the rigidbody, leading to inconsistent results due to physics desyncing
sorry to interrupt, but it seems I need help again
Intented Effect
when pressing [X] while the character is facing a wall, the game detects the nearest spot behind the wall in that direction
I used a trigger collider that would detect walls by checking overlaps, which is offset by 1~range in the facing direction, returning the number when it finds an empty space
(e.g. if there is a 1-block thick wall in front of the player, the function would return 2, as there is an empty tile 2 blocks to the front)
Observed Result
The function basically returns 1 every single time
Code
public int checkForSpace(Vector2 direction, int range)
{
for(int i = 1; i <= range; i++)
{
collider2D.offset = direction * i;
if (collider2D.Overlap(new List<Collider2D>()) == 0)
{
Debug.Log("empty space found at i = " + i.ToString() + ", " + collider2D.Overlap(new List<Collider2D>()).ToString()); //debug
GameObject debugCircle = Instantiate(debug, transform.position, Quaternion.identity); //debug
debugCircle.transform.position += (Vector3)direction * i; //debug
return i;
}
}
return 0;
}
Video Demonstration (The circles denote the position where the function thinks is the nearest empty space)
this is also why you can't use a CC with a rigidbody or transform with a CC, for example
what about games like flappy bird who use rigid body and transofmr
that would be wrong
though you might be misunderstanding
every gameobject has a transform
it's just you shouldn't modify the transform if the rigidbody is
-# i have a feeling this might be associated with the physics timer being slower than the basically instantaneous for loop, but for some reason it seemed to work yesterday, and i have no reason what suddenly broke it
EDIT: although in this case,
rigidbody2d.position = targetPosition;
if (collider2D.Overlap(new List<Collider2D>()) > 0)
{
//Debug.Log("overlap detected");
rigidbody2d.position = CATools.PositionToGridSpace(targetPosition);
}```
seems to be inconsistent with my assumption (this code always acts as if true)
so if I want a player to move left and right and can jump i can use MovePosition?
if u can configure the bird to have a constant force (theres actually a component for that back in 2021) to move right
and then use addforce to pump it up when user clicks the bird, then u wont have conflicts
ok thats cool
yeah but you need to configure that to the animations
i think
yeah ofc
like a bool isMoving if is true i play movingAnim
i use it and its awesome but slow on start while loading project
for the rest of the things it's awesome
Do you guys suggest to use a version control like github?
keep in mind rider is heavier than vscode, but ur on mac so shouldnt be a big deal i guess... i mean it will cost more CPU and memory
and community version is non-commercial
and yeah, u still need to test whether it will work
Why is it so hard
Should I just delete unity snd vs code
And set it all up from the start
Easiest way is to install VS from the Hub itself.
Just make sure to uninstall any VSCode copies before.
I’ll do that tomorrow
Default install should configure itself without additional setup
may i bump this
Thanks alot! it works beautifully!
//Stored tileProgress
public Dictionary<Vector3Int, ProgressData> tileProgresses = new Dictionary<Vector3Int, ProgressData>();
//Update tile progress
public void UpdateProgress(Vector3Int intPos, float elapsed)
{
//Safety check
if (tileProgresses.ContainsKey(intPos))
{
//Get current progress data
ProgressData progress = tileProgresses[intPos];
//Assign progress to progress
progress.progress = elapsed;
//Update progress
tileProgresses[intPos] = progress;
}
UpdateDebugTexT();
}
//Add new tile progress
public void AddTileProgress(Vector3Int intPos)
{
//Only add if it doesn't exist for overload safety
if (!tileProgresses.ContainsKey(intPos))
{
//Add new progress data
ProgressData progressData = new ProgressData();
//Add new progress data
tileProgresses.Add(intPos, progressData);
}
UpdateDebugTexT();
}
//Remove tile progress
public void RemoveTileProgress(Vector3Int intPos)
{
//Safety check
if (tileProgresses.ContainsKey(intPos))
{
tileProgresses.Remove(intPos);
}
UpdateDebugTexT();
}
since chat has calmed down i'll just
It appears the problem was that I didn't notice the "Geometry Type" field when merging the tilemap colliders
this is a code channel bud
yeah
cuz VSSTUDIO wasnt working
so im deleting everything and setting it up again
does Random.Range(1, 3) actually pick a number between 1-3 or are one of the end points excluded?
Check the documentation under the declaration Range(int minInclusive, int maxExclusive). Note the difference between the behaviour with floats and ints: https://docs.unity3d.com/6000.2/Documentation/ScriptReference/Random.Range.html
Guys, i have a player moving with rb.AddForce
it is a sidescroll game and i want jump. Do i apply a force also here?
how do i do this?
private void HandleMove()
{
if (playerInput.IsMoving)
{
rb.AddForce(new Vector2(playerInput.MoveInput * acceleration, 0f), ForceMode2D.Force);
if (rb.linearVelocity.magnitude > maxSpeed)
{
rb.linearVelocity = rb.linearVelocity.normalized * maxSpeed;
}
}
else
{
rb.linearVelocity = new Vector2(Mathf.MoveTowards(rb.linearVelocity.x, 0, deceleration * Time.fixedDeltaTime), rb.linearVelocity.y);
}
}
private void HandleJump()
{
if (playerInput.JumpInput)
{
rb.AddForce(new Vector2(rb.linearVelocity.x, jumpForce), ForceMode2D.Impulse);
}
}
int random range is max exclusive so it can be easily used for indexing
i use addforce so that i can apply forces to him later
oh so Random.Range(1f, 3f) is actually 1-3 but Random.Range(1, 3) only spits out 1 and 2?
or like am I stupid
Yes

Some Random implementations return 1-2.999999 for floats but unity's one seem to include 3 as well
yes, in the range [1, 3), as most code things are
need help with photon fusion 2, trying to spawn a object but it is not being spawned even tho it is present in the prefab table and everything, will be helpful if someone can take a look at my code, Thanks
perhaps try #1390346492019212368
been trying for 2 days🥲
if no-one's able to help there, chances are noone here will be able either
the people willing to help with networking questions will be there
should i apply forces here?
You’re correct in that it’s Random.Rang(Inclusive, Exclusive) the second parameter is what’s not allowed.
bro my VSC still doesnt work
have you installed .net with the install .net extension
yes
it does say this tho
ms-dotnettools.csharp: Trying to install .NET 9.0.11~arm64~aspnetcore but it already exists. No downloads or changes were made.
visualstudiotoolsforunity.vstuc: Trying to install .NET 9.0.11~arm64 but it already exists. No downloads or changes were made.
maybe thats the problem
cuz i downloaded it outside the website
i mean the app
so you have an external .net installation?
are you using it for anything? (like, do you have other c# projects)
no
only 1 so far
so basically
the problem is that
it doesnt recommend things like gameObject
Did you configure VS in unity as well?
yeah that would mean it's not configured
(vsc is not vs btw)
uninstall the other one, and install using the extension in vsc.
how do i uninstall it
man you were given instructions, you don't have to guess
!vsc
There's no command called
vsc.
!vscode
If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:
how do i remove the old one
try googling it, probably similar to how you installed it
why do people go for external installations when it's literally 2 clicks in vsc 
ms-dotnettools.csharp requested to download the .NET ASP.NET Runtime.
Downloading .NET version(s) 9.0.11~arm64~aspnetcore ...visualstudiotoolsforunity.vstuc requested to download the .NET Runtime.
-- Concurrent download of '9.0.11~arm64' started!
Downloading .NET version(s) 9.0.11~arm64~aspnetcore, 9.0.11~arm64 ..... Done!
.NET 9.0.11~arm64 executable path: /Users/thealternate/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/9.0.11~arm64/dotnet
Still downloading .NET version(s) '9.0.11~arm64~aspnetcore' ....
ok there we goo
now restart vsc
go to unity > edit > preferences >external tools and there change ur IDE
aka change it to visual studio
or whatever ide u have
is there a serialized field for "any assets"?
wdym
this is very poorly worded, but it sounds like you're looking for a top type for unity assets?
nothing to do with serialization or fields
i mean, if my understanding is correct, it's a single word answer
it'd be UnityEngine.Object
(or just Object, assuming using UnityEngine;)
GUID load system
is using chatgpt a bad habit?
for anything you actually need to be good, yes
practice your own skills, exercise your brain
just like your muscles, if you don't use it it'll get worse at doing its job
okay
i have to try hard cuz i have to make a 2d top down car game and the deadline is december 12
i gonna share about my experience in a team where they uses chatgpt to design levels / NPCs / quests/ movement ...etc , all the way to backend
to be simple, by the day they needed to do demo, they couldnt even open the app
so , yeah, dont do it
I work as a senior developer and a few years ago we’d have Junior developers join and go from Junior to Mid-Level in 1-2 years. Now, our Juniors 1-2 years in are still at almost the same level they were when they joined. They rely on AI to do the work of mid-level developers (at the behest of management), whilst themselves never learning or growing very basic and fundamental problem solving skills.
About as bad as paying someone to do your homework, but they also dont know what they are doing 80% of the time
Sure it might show some temporary boost in productivity but you arent learning since you arent doing it yourself
another dangerous thing is that AI is not really the AI that u saw on sci-fi movies, they are just LLMs, they are search engines with extra ability to elaborate/explain a bit further
yet the AI itself dont know what is right or wrong, so if they couldnt find matching answers, they will lie to u and make up an answer
they simply dont know how to say "sorry, i dont know"
then i just use chatgpt carefully when needed
sometimes it sees things that i don't and its good for me
or, it sees things that don't exist and you won't be able to tell
And you'll never learn debug skills yourself.
gotta hire the ones not using ai 😛
No, no, they are explicitly told they have to use AI.
there are a lot of reactionary gifs i want to use here
I definitely feel that
good to know that if i wanna be hired i gotta fake my ai use 😛
I don't get why people think it's a good idea for a beginner to use ai at all tho. I've seen some people on reddit commenting "just ask chatgpt" when they're clearly just starting to learn
Make an ai thats just some discord bot that dms you and you respond to the questions yourself
Used Cinemachine FreeLook for my little project and it works good but because the player movement uses Input.GetAxis and transform.Translate to move but the jump code uses Rigidbody.AddForce.
And because of that the player jitters when jumping if the Cinemachine Update method is using Late update. And if i change the update method to fixed update player jitters when moving. I managed to "fix" this by setting the Update method to fixed update and putting the movement code (Input.GetAxis and transform.Translate) in to Fixed Update()
I was wondering if its bad/could bring problems in the future putting the movement code (Input.GetAxis and transform.Translate) to Fixed Update
Does Unity disable a game object's components and all their children before actually Destroy() it?
When you destroy it yes it will be deactivated first
So during OnDestroy(), all of them are already disabled, but I can still access them
Yes you can access disabled things
I actually wanted to verify the order of the process when I put it that way. The object, children and components are disabled first, then OnDestroy() called, correct?
I highly recommend adding a bunch of Debug.Log statements to OnDisable and OnDestroy so you can see for yourself
Ok, the objects are still active in the hierarchy, but I had some issues trying to "grab" some children out of it in OnDestroy(). Some components of it are disabled even though I did not do it.
The document says something about Destroy(): "This call marks the object for destruction at the end of the current frame, which is safer and prevents many common issues".
I don't understand the marking internally, but it's probably safer if I get my children before destroying the parent
sounds like a rough divorce
Has anyone used BreakInfinity for really really big numbers? I need some help with number formatting.
I basically just don't know how to do it- I don't know how to display numbers in scientific notation.
so you didn't look at the documentation for it?
"Scientific notation" is a vague description
not really, it's a specific format in the context of number formatting
No, I read it around 7 times and I don't think I understand it. Just making an idle game and the numbers are getting ridiculous as per usual.
considering scientific notation is the default format when you call ToString on it, the only thing you need to do is nothing except call ToString on it unless you want to specify the precision, but that is also demonstrated in the documentation
i don't think that's true?
ToString uses the G format, doesn't scientific usually refer to E, the exponential format
it does look to be true
https://github.com/Razenpok/BreakInfinity.cs unless im looking at the wrong BreakInfinity somehow
oh shoot, i thought this was about normal floats, mb
i think what i said is still correct? going through it,
ToString calls FormatBigDouble with a null format
ParseFormatSpecifier receives that null, and returns 'R'
FormatGeneral is used, which sometimes uses the "G" format with ToDouble().ToString, and sometimes makes an exponential form, depending on the Exponent
is that not correct?
FormatGeneral looks like it always uses the "G" format, weven when calling ToDouble().ToString()
right, but that's only if it is out of the range that would be covered by double.ToString, so calling ToString on the BigDouble will correctly format it in scientific notation if it is large enough to need it. which is what you would expect in an incremental game
yeah, but it's not the default format.
it basically defaults to G, not E
i think that's an important distinction, because if it defaulted to E, it'd be showing exponential forms for small values too
Is there a way to make it so when transform.position is set some custom code also gets called?
okay then i'll be more precise with what i meant then: when using a number that is large enough that you need a BigDouble rather than just a regular double, calling ToString on it defaults to scientific notation.
which, again, is what you expect to see for numbers in an incremental game where you start with standard formatted doubles then move on to scientific notation when the numbers get large enough
sort of, but not exactly. there's the hasChanged bool on the Transform class but no related events, so pretty much no matter what you'd have to poll it each frame. and hasChanged isn't only changed when it moves, it changes on rotation or really anything that would change its matrix
Unfortunate. I need to call some code anytime a position on a gameobject changes and yeah I can make a SetPosition method which I guess I have no other choice. Would be nice if we could override the set/gets of properities
you could simply use a custom method as you said. i would just save the transform.position every frame and on the next frame check if transform.position == lastposition
well, you can for virtual props. unfortunately these aren't virtual
wonder what the thought process was there
probably performance
definitely not unity does a pretty good job of creating enough overhead as is like what the fuck is this unity why is there some code you're calling in the player loop that is only available in the editor (loadassetatpath)
these would be on significantly different scales
an overhead on every property? that affects every component
85 kb of garbage allocated each frame inside of playerloop calling editor only methods is insane
like obviously once I build the game its fine, but its annoying I cant test in the editor without shit like that going on.
what makes it even crazier is this shits happening in empty scenes and causing noticable frame drops
hi guys, im trying to make a Sway movement for my gun, however if i try to "Quaternion.Euler(Vector3)" it will look at the same direction even if it is a child of an object:
The rotationOffset is (0,90,0) and changing it will make the gun look in another direction
does the gun rotate if you disable the script?
like have you ensured that script is the cause of it?
i dont know how to disable the script, but if i completely remove it then it will rotate as usual. so yes its the script fault
ok you''re going to need to show your full code for that script and the one thats rotating the camera
This code isn't going to work even if you fix the rotation
i see
If the code runs every frame it'll start over every time and the (wrong) lerp isn't doing anything
the snippet i sent is basically the full code, the "OnCamera" function is an input function, which can be seen in the second image
mhh let me check
hey i started doing terains and i cant find the add terain layers feature in it
what does that have to do with coding?
thx sry too
its okay
i will try another approach for now
instead of making a new quaterion ill simply use the transform rotation
Is there a reason why storing a gameobject in a dictionary and then later referencing it again to destroying it doesn't work?
is it because it's just a copy data of that gameobject and it's not a reference anymore?
//Add new tile progress
public void AddTileProgress(Vector3Int intPos, GameObject maskObject)
{
//Only add if it doesn't exist for overload safety
if (!tileProgresses.ContainsKey(intPos))
{
//Spawn mask
GameObject digMaskClone = GameObject.Instantiate(maskObject, tilemap.transform);
//Assign position for mask
digMaskClone.transform.position = intPos + new Vector3(0.5f, 0.22f);
//Get spriteMask component for testing
SpriteMask digMask = digMaskClone.GetComponent<SpriteMask>();
//For testing
digMask.sprite = digMaskSprites[0];
//Add new progress data
ProgressData progressData = new ProgressData();
//Add mask object to progressData
progressData.maskObject = digMaskClone;
//Add new progress data
tileProgresses.Add(intPos, progressData);
}
UpdateDebugText(intPos);
}
//Remove tile progress
public void RemoveTileProgress(Vector3Int intPos)
{
//Safety check
if (tileProgresses.ContainsKey(intPos))
{
//Get progressData
ProgressData progressData = tileProgresses[intPos];
print("RemovetileProgress");
//Apply data to pos
tileProgresses[intPos] = progressData;
GameObject maskObject = progressData.maskObject;
//Destroy mask object when destroyed
Destroy(maskObject);
tileProgresses.Remove(intPos);
}
UpdateDebugText(intPos);
}
you're using GameObject.Instantiate which creates a new gameobject
no, Objects are reference types
you can never have them "not be a reference anymore"
when copied, it copies the reference
perhaps try doing Debug.Log() with the gameobject as context to see if you're referring to what you think you are
I added a debug text to see what was going on, it seems to behave normally.
i think you're destroying the clone but you're trying to destroy the original? or i'm just understanding it wrong
Yeah i understand why you're confused, not the cleanest code. I'm basically trying to add a object everytime i dig something, i have a another script which calls these functions whenever you start mining and whenever you finish
the tile progress is basically a mask to show how much a tile is destroyed
Why the fuck is everything yellow (and my player wont show up(and my legs (this is a flappy bird clone) are all transparent and shi)))
it also stores the tiles destroyed amount via dictionary
Is this a sprite, a UI image, or a quad with a texture
class is a reference type, so destroying it via a copy of the variable also affects the original object. Thou this does not look very practical
Please help yall
I just wanna get past this stupid project 😭
check your sorting layers and orders
how do i make this texture repeat . when increase the scale it just stretches
Check for what?
You were absolutely right and i feel like an idiot now. the script that handles calling them was just calling the remove dictionary function
Maaaybe next time i should name a function after something that already exists... when they take the exact same parameters
//What i named it
storedTileProgress.tileProgresses.Remove(tileIntPos);
//What it should had been called
storedTileProgress.RemoveTileProgress(tileIntPos);
Hey so i got a problem about spawning a prefab, that has a script inside and variables can change. but i do not know a way, to actually update the variable in the prefab instead of the normal gameobject.
Any tipps or ideas?
I don't know what this video is supposed to be showing, it looks like you're changing the values of the MeteorObject that doesn't even seem to be an instance of a prefab at all
@polar acorn
I told you what it was
How do I fix it
Lwk might just do unity learn atp
is it using a lit shader
How do I check
Look at the name of the shader for this object's material
and see whether the name says "lit" or "unlit"
The material says sprite lit default
So, it's yellow because it's a white object being lit by a yellow light
If you don't want it to use lights, switch to unlit
The default lighting for a URP scene has a yellowish directional light to simulate sunlight
Still doesnt fix the player not appearing and the pipe like leg thingies not appearing
Huh
yea i trie to fix that. thats why i unpacked it. but is there a way to keep it as prefab but changing values?
Well it worked before
Are they actually in front of the background
Yes
Tbh
It all worked before
I just added some text buttons
Worked fine
I open the project the next day
Bam
Yes. You just change the values on the object but not apply them to prefab
Finish a thought, then hit enter.
You can read it fine?
Do u want to change the asset or the game object instance of the prefab?
Its just my style of writing
to change the prefabs component values at runtime, you´d have to cache the prefab and then access the component and modify it
Can and will are two different things.
Then pick a better one.
You dont need to be so aggressive here
Im iust trying to fix my project’s problem
Not my writings
So lets focus on that
Yes, you are the one who has a problem to solve. I don't have any horse in this race, I can just leave.
yea thats a good option but idk how the algorithym is.
I have no idea what you mean by this
how i do that uh.. code
What, change a variable? With =.
What is MeteorProperties doing? Is it just storing the properties of the object?
are you remaking roblox on unity
yea. wanted to use scriptable objects but no
yea kind of
Then u can just store them directly in Meteor script then modify them in there
but what if the meteor is a prefab
Then you would store the reference to the object you create with Instantiate, and modify the variables on that
wdym
Instantiate returns a reference to the object it makes. If you want to change variables on the instance, you store the result of Instantiate, then modify those.
var newMeteor = Instantiate(prefab).GetComponent<Meteor>();
newMeteor.ExplosionRadius = 500;
If prefab is of type Meteor you don't need to do the GetComponent
But yeah, basically that
so regarding object spooling, should i use unity's object spooling or make my own. I watched this video by sasquatch, and lemme just say this, implementing this sounds and looks and will definitely rip my hair off. with that being said, which would be the better way to go about it.
just use the built in object pool, there's no reason to make your own unless you want to do it for the learning experience or you have specific needs that unity's somehow cannot cover
the guy said something along the lines of....unity's object pooling is a bit more complicated to set up and that's kinda scaring me
what did you want to pool. i remember you were wroking on a simple 2d game.