#💻┃code-beginner

1 messages · Page 775 of 1

midnight plover
#

!code

radiant voidBOT
spiral summit
#

I don't understand why when I use the command to make the object disappear it's wrong

hot wadi
#

In Edit > Project Setting > Player, switch Active Input Handling to Both

midnight plover
#

You should show your code or screenshot and what not

midnight plover
hot wadi
#

The problems are literally in plain sight

blazing solar
radiant voidBOT
#

success @technopig123 muted

Reason: Sending too many attachments.
Duration: 29 minutes and 53 seconds

ivory bobcat
# radiant void

Follow the guides for how to post code. There shouldn't have been a lot of attachments.

hot wadi
#

How many could he possibly posted lol

midnight plover
#

I guess every line of code into one code block

naive pawn
#

!input 👇

radiant voidBOT
# naive pawn !input 👇
How to Set 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.

lavish maple
#

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/

naive pawn
naive pawn
#

!ide

radiant voidBOT
lavish maple
finite sable
#

hey uhm guys i downloaded the extensions for c# and this popped up

#

still have no idea what this means

#

im like NEW new

keen dew
#

Popped up where?

finite sable
#

when i tried it

#

wait actually i found out the solution

#

i just needed to change the json settings

vale blade
#

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.

split mason
#

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)

vale blade
wintry quarry
vale blade
blissful stratus
#

I am a beginner, my mind can't process how can I remake it in my project

frosty hound
#

What part? 🤔

blissful stratus
naive pawn
#

the UI? the logic? the input? the animation?

#

there's a lot of parts to it

blissful stratus
frosty hound
#

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.

twin pivot
#

we're here to help, not do your homework - some random guy here, probably

blissful stratus
eternal needle
#

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

amber glen
#

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!

frosty hound
#

Unity doesn't have a built in helper function, no. But that's classic math that you can definitely find the formula for online.

amber glen
#

3d

#

I'm assuming I need the quadratic formula involved somehow

naive pawn
#

there are infinitely many parabolas that pass through 2 points

nimble apex
#

doing

return class?.value```

will not trigger NRE if class itself is null right?
twin pivot
#

From my limited math skills i can think of 3 solutions:

  1. You add force to every axis using seperate lines of code but in the same frame
  2. 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
  3. You use the two solutions together by using whichever axis is up and another one and separately add force to the remaining axis
nimble apex
naive pawn
#

class isn't a valid identifier in c#

nimble apex
# naive pawn i don't think you can do that

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
lavish maple
nimble apex
#

where result datatype is Item , a class inside cloud save

naive pawn
nimble apex
#

lol sry bout that

naive pawn
#

the entire point of ?. is to not throw when the LHS is null, yes.

nimble apex
#

ty 👍
thats exactly what i want

naive pawn
#

though keep in mind that unity null will not be caught by this

naive pawn
amber glen
#

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.

naive pawn
#

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

nimble apex
naive pawn
#

that's not quite what im referring to

#

i'm referring to unity's fake null that isn't caught by ?./??

amber glen
#

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.

twin pivot
naive pawn
#

you wouldn't really be using geometry math directly

#

you would be using kinematics to figure out the appropriate starting velocities

twin pivot
#

Or yea you could do that instead of my jank ass solution

blissful stratus
prisma shadow
#

hello everyone

ebon thistle
#

hello

prisma shadow
#

figured i should join this server for tips, im new to unity so im hoping i can learn a few things while im here

ebon thistle
#

same thing with me

eternal needle
radiant voidBOT
ebon thistle
#

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

twin pivot
ebon thistle
#

for on Enable in the player controller

#

my bad

twin pivot
#

!code btw

radiant voidBOT
twin pivot
ebon thistle
#

i dont fully understand what you mean. That i Have 2 different classes?

twin pivot
slender nymph
#

that's part of the singleton pattern (at least how it's typically implemented in unity)

twin pivot
#

Oh nevermind then im outta my depth here

keen dew
#

OnEnable in the other object can run before Awake in the singleton

slender nymph
#

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

keen dew
#

sniped

ebon thistle
#

oh i did not know that

#

thank you

keen dew
#

You can make Instance in the singleton a property that initializes itself, that'll take care of timing issues

slender nymph
#

fwiw that event can probably be static

hot wadi
#

The execution order also depend on the hierarchy iirc

shell sorrel
#

execution order has nothing to do with the hierarchy or order of components or anything like that

ebon thistle
#

I just put in start(), that seems to work

slender nymph
#

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)

median rampart
slender nymph
hot wadi
shell sorrel
#

it can not be avoided in some cases, but changing the execution order should never be a first choice

median rampart
#

im new

shell sorrel
#

its better to understand Awake vs Start vs OnEnable first or directly control things yourself by calling in the correct order yourself

naive pawn
#

it's only within each scene

hot wadi
#

Yes, I though of that

shell sorrel
#

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

velvet vault
#

!ask

radiant voidBOT
# velvet vault !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

vast talon
#

It is a rigid body controller script if your asking

wintry quarry
#

!code

radiant voidBOT
naive pawn
vast talon
#

yes

naive pawn
#

alright, post your code properly

vast talon
#

ok one sec

fading spade
#

dying to stat system

#

probably thinking too hard about it

vast talon
#
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

radiant voidBOT
vast talon
#

ojjj

naive pawn
hot wadi
#

Use the links, paste codes there, and paste the link of the code here

vast talon
#

this thing took me like 3 hours

naive pawn
#

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

#

ideally you'd probably want to use proper smoothing functions

vast talon
#

ik but its meant to be simple so yeah

naive pawn
#

i don't see how that changes what i said

#

simple can coexist with correct/replicable/accurate/maintainable/consistent/tweakable

polar acorn
vast talon
#

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?

vast talon
#

I fixed it now i just added MathF.Exp

naive pawn
heady gulch
#

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

polar acorn
#

Finish a thought, then hit enter

heady gulch
#

and i made

heady gulch
#
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

vast talon
rough granite
polar acorn
rough granite
#

Ahh, thats it?

polar acorn
#

Pretty much. Math is math.

#

Base C# just assumes that if you're dealing with decimals you're using doubles

rough granite
#

Which are more expensive yeah?

polar acorn
#

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

rough granite
vast talon
#

i got a wierd bug where i press play with a rigid body character controller the players body dissapers why does it do that?

polar acorn
#

Gravity?

vast talon
#

nope

#

it completely dissapears after i press start

rough granite
vast talon
#

yes

polar acorn
vast talon
#

where im moving

rough granite
#

Could you share a video or photo of this

vale blade
vast talon
#

also for some reason i seem to spaz out when i shake my camera violently and start walking

hot wadi
vast talon
#

i fixed it i needed to constrain the rotation constraints on the rigid body

polar acorn
vast talon
#

yessum...?

polar acorn
#

What do you think a capsule with zero length and width would look like on screen?

vast talon
#

hmmm.... idk really man

polar acorn
#

Imagine a pencil with zero diameter. What would that look like

#

would you be able to see it?

eternal needle
naive pawn
naive pawn
# rough granite Is unitys much different than microsofts?

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.

tame juniper
#

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 🙏

wintry quarry
tame juniper
#

i have, its still there?

wintry quarry
#

Is that a question or??

tame juniper
#

im just confused lel

#

but its still there, the warning

wintry quarry
#

You missed one or more broken script instances somewhere then

tame juniper
#

its only in 2 prefabs, ive checked both, the warning is on one of them, and its not one it

wintry quarry
#

Check inside the prefabs, in their child objects too

#

Show screenshots if you can't figure it out

tame juniper
#

okie, what of?

wintry quarry
#

The whole Unity window ideally

#

With relevant context showing

tame juniper
#

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

polar acorn
tame juniper
#

ik, that is when i added back a script with the same name

#

should i delete it, then show the screen again?

slim solar
#

Guys, when I clear children of my UI and add new UI objects, they are added with all components disabled. What gives? 😮

polar acorn
wintry quarry
tame juniper
radiant voidBOT
tame juniper
polar acorn
#

Just share the full script for EnemyHealth

tame juniper
#

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

polar acorn
#

That would be the name of it, yes

#

That is the thing you need

tame juniper
#

IT WORKED

#

thanks

#

happiest day of my life

slim solar
#

no idea why it still created a disabled button even though the reference was destroyed 🤷‍♂️

tame juniper
#

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

frail hawk
#

you´d simply use the OnCollisionEnter call

tame juniper
#

thanks ill try that

frail hawk
#

usually you would check for a particular tag inside this event to trim things down

tender dagger
#

Fuck code

#

For it is the bane of all creativity in all my experiences

tired python
naive pawn
#

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

tired python
dry hawk
#

why when importing and opening the demo this happened

#

@everyone

frail hawk
#

why did you ping me?

dry hawk
#

i need help in this

naive pawn
tired python
#

holy crap

naive pawn
#

this isn't even a coding question

slim solar
frail hawk
#

so what exactly is happening, can you tell us

naive pawn
#

you're asking about the light, right?

naive pawn
dry hawk
#

im new to unity

tired python
#

i predict chat's gonna get real fast real soon

naive pawn
#

no, those pings are disabled

#

it's not yellow to you, is it

dry hawk
#

anyways since your here can you help

naive pawn
#

you haven't said what the issue is

tired python
dry hawk
#

i imported an asset

#

and it isnt like the tutorial

naive pawn
#

that indicates a mention

polar acorn
dry hawk
naive pawn
#

use your words

#

we cannot read your mind

tired python
dry hawk
naive pawn
dry hawk
#

i dont see a red bird

naive pawn
naive pawn
tired python
# dry hawk

don't use that tutorial. that's from a long time ago. use newer tutorials. unity has changed

dry hawk
#

can anyone reccomande me a tutorial for 2 d(since its easier)

naive pawn
#

(it's not easier)

dry hawk
#

i see

#

i have made cube runner game following brackeys

naive pawn
#

2d and 3d are different, not harder or easier

dry hawk
#

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

tired python
timid saddle
#

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?

wintry quarry
timid saddle
wintry quarry
#

E.g.

Vector3 localPos = myCam.transform.InverseTransformPoint(theObject.position);
if (localPos.x > 0) Debug.Log("Right side");
wintry quarry
timid saddle
last bramble
#

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.

frail hawk
#

check the pinned channel messages

fleet crest
#

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?

polar acorn
fleet crest
#

Lets say excessive rpg damage formulas-

naive pawn
#

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

fleet crest
#

Sooooo i can thereotically make "infinite" numbers but in reality they are just multiple floats?

naive pawn
#

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

ivory bobcat
naive pawn
#

but yeah probably start with doubles instead of floats

fleet crest
#

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?

naive pawn
#

oh, no clue what that is

fleet crest
#

Rpg framework

#

Also, im still searching over here and, i found big integers

eternal needle
fleet crest
eternal needle
#

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.

fleet crest
#

Ok now you gave me an idea with this

#

I know string probably have their own limits (i havent experimented with strings yet)

eternal needle
#

a string isn't a number, so you aren't going to be doing math directly on it

fleet crest
#

ah i was about to say

fleet crest
eternal needle
#

if you're doing a decent amount of calculations per frame, it will start to slow down as you get to large numbers

rugged beacon
#

mantissa = 1 exponent = 18
number = 1 × 10^18

you can make a struct like this , add custom +-*/ operator and the comparer

fleet crest
#

So basically, the number itself doesnt need to be big

#

Is what your trying to say?

eternal needle
#

yes

fleet crest
#

Gotcha! Ill see what i can do with this info!

cedar kiln
#

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

radiant voidBOT
cedar kiln
#

Interesting

eternal needle
cedar kiln
fleet crest
#

Me wanting to be over the top-

eternal needle
#

basically any clicker game already has this implemented

cedar kiln
rugged beacon
#

big number do give me dopamine fr
some game also just leave the overflow part as an achievement rather fixing it

fleet crest
#

Like even if its not the "real" number i want people to see high numbers

#

Highscore comparing type of stuff

cedar kiln
#

1500000000 health is pretty much immortal like there’s no way you die with that much health😭

fleet crest
#

Watch

#

Ok jokes aside ill go this route

hallow rock
#

tryna add my friends to a project and all their projects are empty/

#

can someone try to fix this?

polar acorn
#

don't crosspost

hallow rock
#

what does that mean?

hallow rock
naive pawn
hallow rock
#

ar

#

alr

fleet crest
#

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

short hazel
#

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
rocky canyon
# fleet crest 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

fleet crest
#

Aaaa ok

#

But there is no way to edit a string then?

rocky canyon
#

you can edit a copy and reassign it..

fleet crest
#

Ah thats good

rocky canyon
# fleet crest 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"```
fleet crest
#

And strings can contain numbers right? Even if they arent use in math?

fleet crest
rocky canyon
#

yup..

0123 can be an integer.. or a string..

fleet crest
#

Ok this is perfect!

rocky canyon
#

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

fleet crest
#

And i can atleast split a string for ui purposes right?

rocky canyon
#

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

fleet crest
#

Gotcha. Just making sure

#

Just incase if i do make a copy, what happens to the original string?

rocky canyon
rocky canyon
fleet crest
rocky canyon
#

why not just reassign it w/ the copy?

fleet crest
#

Ah thats what you meant by reassign

#

Sorry lol im still getting used to the terminology

rocky canyon
#
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;

tired python
rocky canyon
#

it helped me to use note paper to right down keywords that really helped with searching

fleet crest
#

Ooo good idea!

rocky canyon
#

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

fleet crest
rocky canyon
solar hill
tired python
rocky canyon
#

👍 lo

rocky canyon
tired python
rocky canyon
solar hill
#

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

rocky canyon
tired python
rocky canyon
polar acorn
solar hill
#

for the ducks at least

#

you dont need objectpooling for everything but whatever is getting spawned/destroyed the most often in your scene

tired python
tired python
polar acorn
#

Fair. It's basically the same thing under the hood

tired python
#

is it expensive to destroy and instantiate gameobjects

solar hill
#

very

#

its probably the most expensive thing in your scene right now lol

solar hill
tired python
#

ok, i think i might wanna learn abt object spooling in that case, @solar hill thx for the idea

rocky canyon
tired python
#

oh also, ur pfp gives me the heeby jeebies

solar hill
tired python
rocky canyon
solar hill
#

not even the scariest matthew mcconaughey looked in that show

tired python
#

i think i will go sleep now

north kiln
marsh field
rocky canyon
naive pawn
blissful yacht
timber tide
#

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

blissful yacht
gray narwhal
#

!IDE

radiant voidBOT
left jetty
#

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

patent vortex
#

What tutorial are you following?

left jetty
#

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...

▶ Play video
patent vortex
#

What part of the tutorial are you stuck on?

left jetty
#

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 -^-;

viral magnet
#

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

sour fulcrum
#

!ide

radiant voidBOT
viral magnet
#

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

midnight plover
# viral magnet it still didt ork

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?

viral magnet
#

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

nimble apex
#

so the problem is ur VSC isnt configured

viral magnet
#

What does that mean 💔

teal viper
#

!ide

radiant voidBOT
viral magnet
#

I’m ok 7 minutes of beginner tutorial and 50 minutes of trying to fix it

viral magnet
#

Didn’t work

nimble apex
#

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

verbal dome
viral magnet
#

Could you please help me properly configure it if it doesn’t bother you

viral magnet
verbal dome
#

Run what externally?

viral magnet
#

That’s what is says

viral magnet
nimble apex
#

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?

viral magnet
#

Yes kyubey the gost

nimble apex
#

thats not how u do it

viral magnet
#

And I open them from unity

verbal dome
#

So do you have these packages installed in unity or not?

viral magnet
#

Let me check

verbal dome
#

You need the second one only

#

Uninstall the 1st one if it's there

viral magnet
verbal dome
#

That's not the package manager

#

Go Window > Package manager

viral magnet
#

Ok

nimble apex
viral magnet
verbal dome
#

Sure yeah

viral magnet
#

I got these two

#

I’m on macOS

nimble apex
viral magnet
#

Thanks for helping tho

verbal dome
#

The page we linked you to tells you what to do

viral magnet
#

Mine is at 2.0.25

#

I followed everything

teal viper
# viral magnet

Also, if you keep on posting photos, you risk being killed.

viral magnet
#

Oh

#

Literally?

teal viper
#

Literally.

nimble apex
#

really

#

u need to learn how to take screenshots on mac

verbal dome
#

(As dlich's lawyer, that was not a direct threat)

viral magnet
#

My Mac doesn’t have wit

#

WiFi

#

I’m in the bus

nimble apex
verbal dome
viral magnet
#

Ok fine

#

So your eyes don’t die

#

So then what?

teal viper
#

Then throw away your Mac and get a windows pc

viral magnet
#

💔 I wish

teal viper
#

Just kidding. But it's likely something mac specific.

viral magnet
#

💔

#

Just suggest game object 💔

nimble apex
# viral magnet 💔

ok , now i want u to check from scratch

  1. is the unity ur using later than 2021
  2. do u have a working vsc now , in ur mac
viral magnet
#

Yes

#

I downloaded the latest version

#

Unity 6.2

#

And VSC is installed

nimble apex
#

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

viral magnet
#

Got only visual scripting at 1.9.8 and visual studio éditer at 2.0.25

nimble apex
#

then install the 2.0.25

#

visual scripting have nothing to do, plz ignore it

viral magnet
#

It is installed?

#

It says 2.0.25 on it

nimble apex
#

click onto the 2.0.25 item , show the detail page, and then screenshot the whole package manager

viral magnet
#

Ok one second I’m at the elevator

sour fulcrum
#

bro come back later 😭

teal viper
#

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.

nimble apex
#

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

midnight plover
#

this should be what you need

viral magnet
#

this is what i have rn

#

then why doesnt game object show

#

and other thing

#

it shows general

nimble apex
#

if u install multiple version vsc, plz make sure u choose the correct one

teal viper
# viral magnet

These messages in the output look extremely sus.
I feel like this is a Mac specific issue after all.

viral magnet
#

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

teal viper
#

I'd check the C#/C# devkit and unity output logs in vs code. They might have more info.

viral magnet
#

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

nimble apex
restive sierra
# viral magnet

You need the Visual Studio Code package, this is for VS proper

viral magnet
restive sierra
#

Oh nvm, it's the same one

viral magnet
#

visual studio editer doesnt do anything right

#

cuz the only problem is not suggesting gameObject and things like tht

#

like .name

nimble apex
teal viper
sour fulcrum
#

what's making it pick up the functions in this screenshot but not local variables, out of curiousity

viral magnet
#

its not givng me the unity variables to configure the,m

#

i open it from unity

nimble apex
#

ok

viral magnet
#

never opened it externally

nimble apex
viral magnet
#

so i dont understand why its not giving me the unity variables

nimble apex
#

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

viral magnet
#

i may have downloaded it once or twice

nimble apex
#

im talking about is there multiple vsc existed in ur mac

teal viper
viral magnet
#

right now no

#

wait it doesnt show in the applications window

teal viper
#

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.

viral magnet
#

in launch pad there is only one

#

so yea

#

like for a second

#

i swear to god

#

i saw gameobject

nimble apex
viral magnet
#

and it disappeared right after

#

do you want me to delete VSC and reinstall it?

nimble apex
#

im pretty sure the problem is inside VSC

teal viper
#

You should debug the issue via the extension logs... I'm not gonna repeat it again...

nimble apex
viral magnet
#

how do i check logs

teal viper
#

Check my screenshots

nimble apex
#

go to ur terminal , output , and type in the devkit, or choose it

viral magnet
#

uh im on mac

#

should i got to console

fierce fog
#

no it's output

nimble apex
#

hold on

teal viper
visual heath
#

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?

viral magnet
#

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

tender mirage
#

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
viral magnet
#

mb gng im kinda dumb

nimble apex
#

is this matter?

viral magnet
#

probably

teal viper
viral magnet
nimble apex
#

@viral magnet now, just like what @teal viper said, i want u to search for unity output

#

should be here

teal viper
fierce fog
#

i havent used tuples in c# but isnt it better to use a struct here anyway

viral magnet
#

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

teal viper
tender mirage
nimble apex
#

unity VSC output dump

fierce fog
#

well not smaller

sour fulcrum
#

tuples are fine to use in c#

nimble apex
#

@viral magnet can u get into the thread?

tender mirage
sour fulcrum
teal viper
tender mirage
sour fulcrum
#

eg. tileProgresses[intPos] = (elapsed, tileProgresses[intPos].Item1)
would work

fierce fog
tender mirage
tender mirage
sour fulcrum
#

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

fierce fog
#

i don't remember exactly but i think it's just structs can't have methods

viral magnet
#

ok done

sour fulcrum
fierce fog
#

i have no idea how to explain this though so you're better off watching a video like what batby said

tender mirage
sour fulcrum
#

For a vague point of comparison stuff like Vector2 and Vector3's are structs

naive pawn
#

think of structs/value types as bundles of data and classes/reference types as discrete, persistent objects

tender mirage
naive pawn
#

no

#

structs are value types, classes are reference types, they have different behaviors and semantics

sour fulcrum
#

(but they are lighter because of those differences yes)

tender mirage
naive pawn
#

but mainly, structs are not classes but X

sour fulcrum
#

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 😅

naive pawn
#

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

sour fulcrum
#

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

formal sleet
#

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

naive pawn
#

there's no best, but transform is definitely off the table

formal sleet
#

What gives each one better the others

naive pawn
#

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

naive pawn
#

even with the other 2, you could make your own systems of making forces apply correctly

viral magnet
#

im new to coding and just wanna know why for future projects

formal sleet
viral magnet
#

mb

naive pawn
# viral magnet why

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

undone wave
#

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)

naive pawn
#

this is also why you can't use a CC with a rigidbody or transform with a CC, for example

viral magnet
naive pawn
#

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

undone wave
# undone wave sorry to interrupt, but it seems I need help again **Intented Effect** when pre...

-# 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)
formal sleet
#

so if I want a player to move left and right and can jump i can use MovePosition?

nimble apex
viral magnet
#

i think

formal sleet
viral magnet
#

kyubey

#

do i justndwonload rider

#

it sounds a lot better

formal sleet
#

like a bool isMoving if is true i play movingAnim

formal sleet
#

for the rest of the things it's awesome

#

Do you guys suggest to use a version control like github?

nimble apex
#

and community version is non-commercial

#

and yeah, u still need to test whether it will work

viral magnet
#

Why is it so hard

#

Should I just delete unity snd vs code

#

And set it all up from the start

fickle plume
#

Easiest way is to install VS from the Hub itself.

#

Just make sure to uninstall any VSCode copies before.

viral magnet
#

I’ll do that tomorrow

fickle plume
#

Default install should configure itself without additional setup

viral magnet
#

Guys if you find anything pls dm me

#

Thanks for the help

tender mirage
# sour fulcrum i'd probably watch or read a guide on them before using them, they can be slight...

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();

}
undone wave
#

It appears the problem was that I didn't notice the "Geometry Type" field when merging the tilemap colliders

viral magnet
#

yo guys im backkkkk

#

so i deleted unity

hexed terrace
#

this is a code channel bud

viral magnet
#

yeah

#

cuz VSSTUDIO wasnt working

#

so im deleting everything and setting it up again

balmy vortex
#

does Random.Range(1, 3) actually pick a number between 1-3 or are one of the end points excluded?

sour fulcrum
#

that will be $5

night raptor
formal sleet
#

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);
        }
    }
sour fulcrum
#

int random range is max exclusive so it can be easily used for indexing

formal sleet
balmy vortex
#

or like am I stupid

balmy vortex
night raptor
#

Some Random implementations return 1-2.999999 for floats but unity's one seem to include 3 as well

naive pawn
split mason
#

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

split mason
naive pawn
#

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

formal sleet
tender mirage
viral magnet
#

bro my VSC still doesnt work

naive pawn
viral magnet
#

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

naive pawn
#

so you have an external .net installation?

#

are you using it for anything? (like, do you have other c# projects)

viral magnet
#

no

#

only 1 so far

#

so basically

#

the problem is that

#

it doesnt recommend things like gameObject

tender mirage
#

Did you configure VS in unity as well?

naive pawn
naive pawn
viral magnet
#

how do i configure it

#

sorry im new to this

naive pawn
viral magnet
#

how do i uninstall it

naive pawn
#

!vsc

radiant voidBOT
# naive pawn !vsc
<:error:1413114584763596884> Command not found

There's no command called vsc.

naive pawn
#

!vscode

radiant voidBOT
viral magnet
#

how do i remove the old one

naive pawn
#

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 notlikethis

viral magnet
#

uh because i tried 10

#

and it didnt work

#

and 8

#

and it didnt work

naive pawn
#

what do you mean you tried those

#

you don't have to install external .net at all

viral magnet
#

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

naive pawn
#

now restart vsc

charred monolith
#

aka change it to visual studio

#

or whatever ide u have

nimble apex
#

is there a serialized field for "any assets"?

charred monolith
naive pawn
#

nothing to do with serialization or fields

nimble apex
#

sry

#

i think a thread would be better, hold on

naive pawn
#

i mean, if my understanding is correct, it's a single word answer

#

it'd be UnityEngine.Object

#

(or just Object, assuming using UnityEngine;)

nimble apex
#

GUID load system

light cave
#

is using chatgpt a bad habit?

naive pawn
#

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

light cave
#

okay

#

i have to try hard cuz i have to make a 2d top down car game and the deadline is december 12

nimble apex
#

to be simple, by the day they needed to do demo, they couldnt even open the app

#

so , yeah, dont do it

visual linden
#

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.

rough granite
rough granite
nimble apex
#

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"

light cave
#

then i just use chatgpt carefully when needed

#

sometimes it sees things that i don't and its good for me

naive pawn
fickle plume
sour fulcrum
visual linden
sour fulcrum
#

there are a lot of reactionary gifs i want to use here

visual linden
#

I definitely feel that

sour fulcrum
#

good to know that if i wanna be hired i gotta fake my ai use 😛

tender mirage
#

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

rough granite
trim eagle
#

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

hot wadi
#

Does Unity disable a game object's components and all their children before actually Destroy() it?

wintry quarry
hot wadi
wintry quarry
hot wadi
#

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?

wintry quarry
#

I highly recommend adding a bunch of Debug.Log statements to OnDisable and OnDestroy so you can see for yourself

hot wadi
# wintry quarry I highly recommend adding a bunch of Debug.Log statements to OnDisable and OnDes...

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

sour fulcrum
#

sounds like a rough divorce

slow mantle
#

Has anyone used BreakInfinity for really really big numbers? I need some help with number formatting.

slender nymph
slow mantle
#

I basically just don't know how to do it- I don't know how to display numbers in scientific notation.

slender nymph
#

so you didn't look at the documentation for it?

hot wadi
#

"Scientific notation" is a vague description

naive pawn
slow mantle
slender nymph
#

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

slow mantle
#

Oh, I definitely read this wrong.

#

Okay, thanks for the clarification.

naive pawn
#

ToString uses the G format, doesn't scientific usually refer to E, the exponential format

eternal needle
naive pawn
#

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?

slender nymph
#

FormatGeneral looks like it always uses the "G" format, weven when calling ToDouble().ToString()

naive pawn
#

sometimes it doesn't go that route

#

sometimes it builds its own exponential string

slender nymph
#

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

naive pawn
#

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

languid pagoda
#

Is there a way to make it so when transform.position is set some custom code also gets called?

slender nymph
#

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

slender nymph
languid pagoda
frail hawk
#

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

naive pawn
languid pagoda
#

probably performance

naive pawn
#

probably

#

wouldn't want that overhead for literally everything

languid pagoda
naive pawn
#

these would be on significantly different scales

#

an overhead on every property? that affects every component

languid pagoda
#

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

astral cedar
#

The rotationOffset is (0,90,0) and changing it will make the gun look in another direction

languid pagoda
#

does the gun rotate if you disable the script?

#

like have you ensured that script is the cause of it?

astral cedar
#

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

languid pagoda
#

ok you''re going to need to show your full code for that script and the one thats rotating the camera

keen dew
#

This code isn't going to work even if you fix the rotation

keen dew
#

If the code runs every frame it'll start over every time and the (wrong) lerp isn't doing anything

astral cedar
glad dagger
#

hey i started doing terains and i cant find the add terain layers feature in it

languid pagoda
glad dagger
astral cedar
#

its okay

astral cedar
#

instead of making a new quaterion ill simply use the transform rotation

tender mirage
#

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);

}
cosmic quail
naive pawn
#

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

tender mirage
#

I added a debug text to see what was going on, it seems to behave normally.

cosmic quail
#

i think you're destroying the clone but you're trying to destroy the original? or i'm just understanding it wrong

tender mirage
#

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

tranquil stream
#

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)))

tender mirage
#

it also stores the tiles destroyed amount via dictionary

tranquil stream
#

Im so frustrated I tried everything to fix it

#

(Im a new dev)

polar acorn
tranquil stream
#

Sprite

hot wadi
tranquil stream
#

I just wanna get past this stupid project 😭

naive pawn
#

check your sorting layers and orders

queen adder
#

how do i make this texture repeat . when increase the scale it just stretches

tranquil stream
tender mirage
# naive pawn you can never have them "not be a reference anymore"

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);
charred monolith
#

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?

polar acorn
tranquil stream
#

I told you what it was

#

How do I fix it

#

Lwk might just do unity learn atp

polar acorn
tranquil stream
#

Lit shader?

#

Wdym

polar acorn
#

is the shader you are using a lit one

#

or unlit

tranquil stream
#

How do I check

polar acorn
#

Look at the name of the shader for this object's material

#

and see whether the name says "lit" or "unlit"

tranquil stream
#

The material says sprite lit default

polar acorn
#

If you don't want it to use lights, switch to unlit

tranquil stream
#

The light is blue?

#

Its supposed to be blue

#

And it is blue

#

Also

polar acorn
#

The default lighting for a URP scene has a yellowish directional light to simulate sunlight

tranquil stream
#

Still doesnt fix the player not appearing and the pipe like leg thingies not appearing

#

Huh

charred monolith
tranquil stream
#

Well it worked before

polar acorn
tranquil stream
#

Yes

#

Tbh

#

It all worked before

#

I just added some text buttons

#

Worked fine

#

I open the project the next day

#

Bam

polar acorn
tranquil stream
#

Yellow

#

Everythings broken

polar acorn
tranquil stream
#

You can read it fine?

hot wadi
tranquil stream
#

Its just my style of writing

frail hawk
polar acorn
polar acorn
tranquil stream
#

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

polar acorn
charred monolith
tranquil stream
#

Okay then do it

#

Asshole

polar acorn
charred monolith
polar acorn
hot wadi
astral cedar
charred monolith
charred monolith
hot wadi
charred monolith
polar acorn
polar acorn
# charred monolith 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.

hot wadi
#

var newMeteor = Instantiate(prefab).GetComponent<Meteor>();
newMeteor.ExplosionRadius = 500;

polar acorn
tired python
#

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.

slender nymph
#

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

tired python
#

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

frail hawk
#

what did you want to pool. i remember you were wroking on a simple 2d game.