#💻┃code-beginner

1 messages · Page 784 of 1

alpine bronze
#

i wanted to use integers but I cant with Time.deltaTime

#

im just fucking around with unity but I know C#

sour fulcrum
#

you can cast

umbral bough
#

it really depends on the result you actually want

alpine bronze
#

i just want the more time passes by the higher the score goes up

umbral bough
#

there are floor, ceil, round, explicit casts etc.

umbral bough
alpine bronze
#

I found Mathf.FloorToInt(); that worked

umbral bough
#

You can use either, mathf is just more common

umbral bough
sour fulcrum
#

If the number ends in .5 so it is halfway between two integers, one of which is even and the other odd, the even number is returned.
Mathf.Round is a tiny bit weird tho

umbral bough
#

you can easily make your own implementation tho

verbal dome
#

Even if you multiply it first

#

It can become super inconsistent, for example at a high framerate the deltaTime could always be rounded to 0

umbral bough
sour fulcrum
#

thats not where you would use that in the code

verbal dome
#

For example

alpine bronze
#

classic

umbral bough
umbral bough
verbal dome
#

XR is an API/namespace in XRModule, I can see how that can be confusing though

umbral bough
#

Yeah, it makes sense now.
However, the deprecation warning is really poorly written.
I've been going through docs and I am having a hard time finding a replacement for the GetNativePrt() method.
It'd be nice if something's getting deprecated to at least leave the name of the replacement function, similar to how it's done with rb's linearVelocity etc.

#

This is all the additional context I have for it, I don't know p much anything about vr development so that makes it even more difficult for me to find the appropriate replacement function :/

sour fulcrum
#

it is very difficult to read these screenshots ngl

umbral bough
#

get { return XRDevice.GetNativePtr() != System.IntPtr.Zero; }

#

That's what I'm trying to update to the latest api

#

This is the warning:
Assets/steamvr_unity_plugin/Assets/SteamVR/Scripts/SteamVR.cs(131,17): warning CS0618: 'XRDevice' is obsolete: 'UnityEngine.VRModule is deprecated and will be removed in a future version. Please use the APIs in the UnityEngine.XRModule instead'

#

As you can see, deprecation warning gives you nothing other than the package you are supposed to use.

verbal dome
#

So I would start by looking at what is the main replacement for XRDevice and see if it's something you can null check/has something similiar

#

(Or simply a way to check if an XR device exists)

umbral bough
# verbal dome (Or simply a way to check if an XR device exists)

Yeah, I've been trying to look for that, but from what I can tell, there is no way to just get the device and check if it's null.
Closest I've gotten is the following:

get { return UnityEngine.XR.InputDevices.GetDeviceAtXRNode(XRNode.Head) != null; }

However, that's just me taking a wild guess, and XRNode.Head just seemed like the right choice as I am assuming that's the main part of the vr set.
But I am not gonna play smart, will just leave this as a comment on the PR and see what devs have to say about it.
Thanks a lot for taking your time and pointing me in the right direction!

crimson laurel
#

What would be the equivalent of a 'module script' in unity?

e.g. a script with functions that can be called by any other script after it requires them (or whatever method that I should be using instead)

I can tell unity is far different from lua, but since that was pretty core to making stuff on roblox I'm just wondering what I should do to segment core stuff like hitboxes into one script that any other can use

verbal dome
#

Or static methods in general

#

It's common if you need some utility methods that can be called from anywhere without needing an instance of the class

crimson laurel
#

yeah maybe, I'll try'em

sour fulcrum
#

the more specific you can get with the example the more specific we can try and explain the equivilent

verbal dome
#

Yep, 'module script' is a bit ambiguous but

a script with functions that can be called by any other script
Really just sounds like statics or singleton

crimson laurel
sour fulcrum
#

sure

#

so you'd write 1 script that can handle hitboxes

#

what's the issue unity wise from there in your mind currently

crimson laurel
#

nothing, just wondering what exactly I should use for it

#

which is why I asked

sour fulcrum
#

well based on the more specific example static stuff probably is not the answer

#

a "module" script is just a script really

#

it's as module as you design it to be

verbal dome
#

A MonoBehaviour component script to be more precise

#

That crossed my mind first but i thought it's too obvious

inland crystal
#

Sorry this reply is a little late, but one important difference is that System.Math tends to deal with doubles, while UnityEngine.Mathf uses single precision floats (thats why the 'f' is in the name). For that reason it could potentially be more performant if you're doing a ton of calculations per frame.

topaz hatch
#

I don't know if this is a beginner question, but do any devs have tips on how to make sure yield return new WaitForSeconds() counts consistently on WebGL?

#

As in, if in my IEnumerator function has the script wait 3 seconds in-engine, it will also do that on WebGL regardless of GPU load/computer specs? Or is that just unavoidable?

wintry quarry
#

It will always be subject to wherever your frames land on the timeline

#

Can you explain what you're trying to do and we can discuss whether WaitForSeconds is an appropriate tool for doing it?

sour fulcrum
#

try turning this on

#

might be related to the problem but needs more context

wintry quarry
#

Just to explain how it works - if you do WaitForSeconds(3) it will resume on the next frame after 3 seconds have elapsed This may be 3.01 seconds or 3.056 seconds etc...

topaz hatch
# wintry quarry Can you explain what you're trying to do and we can discuss whether WaitForSecon...

In the scene I'm working on, there is a character walking around and looking at things. There is an item that when clicked on, will trigger an end sequence where the following happens:

  • Character moves towards a specific spot.
  • Character then looks at the item you clicked.
  • If your dialogue box is open, close it.
  • Character yaps about the story.
  • Sequence ends and it loads in the next scene.

I put in some wait times at the start (the clickable item also has things to read so I want the player to be able to read it.) and in between dialogue.

wintry quarry
#

That doesn't sound like something that needs precise timing exactly

topaz hatch
#

I'm making a new build to post, but when testing it out on WebGL, it seemed to take a lot longer for seconds to go by than when I tested it in-engine. Maybe it was just a fluke on my end. So I'm going to make a new build and see if the problem comes up again.

wintry quarry
#

The difference in timing should be no more than the duration of your slowest frame

#

if it's longer than that, something else is going on.

#

if your framerate is really slow it could be perceptible

#

but I'm talking like 10fps or worse

topaz hatch
#

Not that I noticed at the time. I did find an error in my code regarding locally calling and assigning something to a variable so maybe it was just the game soft crashing and I mistook that as a time delay in my IEnumerators script

lethal gull
topaz hatch
#

I am. I'm making a new build right now

alpine bronze
topaz hatch
bitter pine
#

ok, so i have 2 step sounds and when i walk i want them to play with 0.5 seconds in between each step, it needs to go one after the other though, any ideas? ive tried messing around with coroutines and while loops but i cant seem to figure it out, i may just be dumb tho

sour fulcrum
#

show what you've tried

bitter pine
#
{
    float num = 0;
    if (num == 0)
    {
        num = 1;
        Footsteps[1].PlayOneShot(Footsteps[1].clip);
    }
    else if (num == 1)
    {
        num = 0;
        Footsteps[0].PlayOneShot(Footsteps[0].clip);
        Delay(0.5f);
    }
}

IEnumerator Delay(float delay)
{
    yield return new WaitForSeconds(delay);
}```
#

it will call the function if your moving

#

ive also tried doing it in the ienumerator function itself

#

wait i think i forgot to use start coroutine

sour fulcrum
#

thats 1 thing

#

but keep in mind

topaz hatch
#

Okay, it worked! (but now my decals are missing???? I'm so tired dog)

sour fulcrum
#

only yield things are actually going to stop a function in place until it "yields"
those only work in IEnumator functions (and other async related things)
those only work when run with startcoroutine

#

all three need to be true

bitter pine
#

ah

#

i normally dont forget to use start coroutine but ig i forgo

sour fulcrum
#

and in that snippet you posted it still wont work if playsteps is not also a running coroutine

topaz hatch
#

I don't know why this is the case.

sour fulcrum
#

since your starting that delay but nothing cares about it

#

dunno about the decal stuff

#

cute game

topaz hatch
#

I'll ask around. I'll hold off on posting until your done helping Davey. I'm cutting in to the chatter

polar acorn
topaz hatch
#

That's in the projects tab right? I'll go check

timber tide
#

WebGL and decals a little wonky, but yeah try the URP renderer asset

shell sorrel
#

WebGl ahs a lot of weirdness going on

naive pawn
# bitter pine ```void PlaySteps() { float num = 0; if (num == 0) { num = 1...

you have the right idea with the logic flow, but it isn't set up correctly at all

  • PlaySteps doesn't have anything that would make it wait. the yield in Delay makes Delay wait, not PlaySteps (and only if used as a coroutine)
  • every time you call PlaySteps, you create a new variable num that starts at 0. that'll happen every time you call PlaySteps
    you'll want to have some loop that's aware of time (aka in a coroutine or in an Update message) with some persistent state (a variable that's in a higher scope than a single sound effect)
shell sorrel
#

iirc it does not like the dbuffer ones

bitter pine
topaz hatch
#

I'm struggling to find the relevant settings for decals

#

It's so confusing man

polar acorn
topaz hatch
#

Project Settings?

polar acorn
#

I think so, should be under the "Graphics" section

naive pawn
#

hmm, is this code related

#

i haven't exactly been following but it kinda seems not?

polar acorn
#

It was. It's sort of evolved

topaz hatch
#

I can move the convo to the appropriate channel

polar acorn
naive pawn
polar acorn
naive pawn
#

complaint of theseus

carmine oasis
#

hey guys

#

where can I get help ?

timber tide
carmine oasis
#

yes ?

#

I am having problem with InputSystem

timber tide
carmine oasis
#

can u help me ther e

pearl isle
#

hello! I was wondering if anyone could help me with a collision issue in Unity 2D? (at least im pretty sure its a collision issue)

naive pawn
#

!ask

radiant voidBOT
# naive pawn !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

naive pawn
#

can't help without info 😉

pearl isle
#

ah alright my bad! blush

ivory bobcat
pearl isle
#

so I have this collision box with IsTriggered activated (idk if thats the right word), on the same layer as my character, yet for some reason the player does not activate it. Ive also added the beginning of my script; I only get the first debug.log, the second one doesn't show. (keep in mind im relatively new to the world of coding haha)

naive pawn
#

IsTriggered activated (idk if thats the right word)
there's no fixed word for that, so "activated" is ok - though "active" is also a specific thing in unity, so you might want to consider alternatives. you could just say it's a trigger in this case

#

(also yeah, is trigger, not is triggered)

pearl isle
#

ah alright thank you!

naive pawn
#

do either have a rigidbody

wintry quarry
pearl isle
wintry quarry
sour fulcrum
#

If you mean IsTrigger then as it’s a bool the appropriate/common terms would be enabled & disabled

naive pawn
#

also, put a Debuglog at the top of the message to see if it's being called, outside of any logic

pearl isle
#

first one is the non-moving object (the orange shape in the original image i sent) and the second is the player character

fervent lagoon
#

I’m new here and I was just checking, is there any reason a specific bar of starter code wouldn’t want to interact as it should normally when opening through 6000.3f1 of unity and visual studios 2026 as the coder

naive pawn
#

that's not much info to go off of

fervent lagoon
#

Yeah I get that lmao

naive pawn
#

what do you mean by "a specific bar", "starter code", and what interaction are you referring to

visual linden
fervent lagoon
#

I haven’t inputted any code and I’m just staring at the first thing you have when you pull an empty script from unity, but the words aren’t colored or doing anything like the walkthrough I’m following has it

naive pawn
#

oh that's a much better description

#

that means your ide is unconfigured

fervent lagoon
naive pawn
#

!ide

radiant voidBOT
fervent lagoon
#

Hmmm I’ll look into it more through this, thanks!

pearl isle
naive pawn
#

no, in the OnTriggerEnter2D, the thing you're having issues with

pearl isle
#

the tutobase awake called

cosmic quail
pearl isle
tiny solar
#

Hello, I'm trying to add some optional buttons for my 2D web game to make it playable in mobile. I want to detect the buttons being clicked down and released propery. But I could not find a way to check whether the button is being pressed. Buttons defult come with the condition OnClick. Is there a deferent library or any other in built way to ditect whether buttons are being clicked down or atleast a way to find when they are released?

slender nymph
#

look into the Input System's On-screen Controls

pearl isle
cosmic quail
pearl isle
tiny solar
slender nymph
#

tryitandsee
as for "as efficient", you'd have to profile it to find out

tiny solar
#

Ok, Thank you

slender nymph
#

here's a quick little hint at the "efficiency" part of your question though, you can look at the actual code for the on-screen controls related components to find out how they actually work, it is available not only in the package files but also on github to view

pliant dome
#

I wish I could make a hexagonal prism collider for the player

#

Can I make custom shaped colliders for the player?

neat briar
pliant dome
#

Hi?

neat briar
#

how s your day going today dude

polar acorn
polar acorn
neat briar
#

sorry for that

pliant dome
#

Lemme try the meshg collider rq

neat briar
polar acorn
#

Remember that you can have a mesh collider that is different than the mesh that's rendered

radiant voidBOT
# polar acorn !collab

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
• ** Collaboration & Jobs**

polar acorn
#

If you're looking for work, go there

neat briar
#

okay but I can make it just tell me what are you looking for if you need so okay got it

polar acorn
#

I'm beginning to see why Discord has flagged you as "likely spammer"

west jetty
#

Hey is anyone facing the issue of not able to see the camera border in unity 6

fickle plume
#

!warn 1258003148736565382 There's no self-promotion on the server. You've been directed to forums already.

radiant voidBOT
neat briar
#

okay got it

naive pawn
naive pawn
west jetty
lone sable
#

I updated Unity to 2022.3.62f3 due to the security issue, and now some code that I had working is no longer working. (Surprise...)

Specifically, I have aimAction.action.Disable(); to disable aiming controls. (Used in tutorials and a few other locations.). This goes for all my other input blockers.

I checked and I am making the call to it, however its still providing updates. Any ideas why this might be happening?

west jetty
naive pawn
lone sable
naive pawn
lone sable
naive pawn
#

so, this shouldntve worked before hand

lone sable
#

Well, it did.

naive pawn
#

PlayerInput creates its own instance of the InputActionsAsset, if you modify the actions or whatever from the source asset it won't affect the instance that PlayerInput uses

lone sable
#

So then whats the simple fix? This isn't really something I'd like to re-write being this deep into the project. And again, it worked before this on 2022.3.43f1

#

And seeing as how I use this a fair bit over my entire project, I'm deff not looking forward to it.

naive pawn
#

to be honest, i think either you're mistaken about something, or it was working due to a bug (that was fixed)
playerinput just doesn't propagate changes from its asset, since it instantiates its own copy

#

how ive done it (in the case of rebinding controls) is that i use an InputActionReference to specify in the editor which action to target, but i get the corresponding action from the active player input to modify that instead (or sync the changes back to the playerinput)

lone sable
#

I mean, seeing as how again, I've been using this method for a fairly long time now, I don't see how "I could be mistaken" from something working to not working.

naive pawn
#

oh i don't mean that, i shouldve been more specific, mb
what i meant there is that there might be some other fact that made it work, and it's not just a playerinput propagating changes to its source asset

#

i don't really know what that might be, and to be clear i'm not trying to blame you - that's just the possibilities i see given what i know

naive pawn
# naive pawn how ive done it (in the case of rebinding controls) is that i use an InputAction...
    public InputActionReference actionReference;
    InputAction action => actionReference.action;
    InputAction playerAction => playerInput.actions.FindAction(action.id);
    void SyncOverride() {
        string overridePath = action.bindings[bindingIndex].overridePath;
        if (!string.IsNullOrEmpty(overridePath)) {
            playerAction.ApplyBindingOverride(bindingIndex, overridePath);
        } else {
            playerAction.RemoveBindingOverride(bindingIndex);
        }
    }
```this for example
naive pawn
#

hmm yeah maybe that's the case

action.actionMap.asset.Disable();

#

it does copy the asset. i don't know why i wrote the code there like that, i wouldn't expect that Disable to propagate

    private void CopyActionAssetAndApplyBindingOverrides()
    {
        InputActionAsset inputActionAsset = m_Actions;
        m_Actions = Object.Instantiate(m_Actions);
//                  ^~~~~~~~~~~~~~~~~~
        /* copy binding overrides */
    }
#

or maybe the actionmaps inside aren't deeply cloned. that's a bit too deep than what i have time for, sorry.
maybe try #🖱️┃input-system

lone sable
#

I'll just have to move everything over to playerInput.actions.FindAction(aimAction.action.id).Enable(); I guess.

Just bothers me that I've been using this for well over 2 years now, and being forced to update due to a security issue basically breaks everything.

heavy basalt
#

hello, im wondering if its possible for the direction of a moving platform on a spline to be reversed if the player's camera transform is facing in the opposite direction of the movement?

naive pawn
#

split that down into separate parts

#

you described it, so it's possible (unless you're using a system that doesn't support that, but you didn't specify)

heavy basalt
# naive pawn you described it, so it's possible (unless you're using a system that doesn't su...

im not sure if its a system issue. I haven't done custom spline movement like this before so its all a bit new to me at the moment, and sort of what seems to be going wrong too. so right now im calculating the dot product of the forward transform of the platform and the forward transform of my player camera (attached to the player as a 3rd person free cam). it is successfully computing the dot product but the movement isn't changing as I hope. the player is also parented to the boat so that the player doesn't slip off with the movement. I'm handling this in my update() function. the player also doesn't use rigidbodies, its the third person character controller from the unity asset store for context

#

if im still slipping up on the explanation, do tell cryign

#
    {
        Floater floater = boat.GetComponent<Floater>();
       
        Vector3 boatForward = boat.transform.forward;
        boatForward.y = 0;
        Vector3 cameraForward = floater.cameraTransform.forward;
        cameraForward.y = 0;

        float dot = Vector3.Dot(boatForward.normalized, cameraForward.normalized);
        Debug.Log("Dot product: " + dot);
        float angle = Mathf.Acos(dot) * Mathf.Rad2Deg;     
        if(dot > 0)
        {
            
        }
        else if(dot < 0)
        {
            
           
        }

        
    } ```
#

this is sort of what i'm doing

naive pawn
#

but the movement isn't changing as I hope
well, you don't seem to have anything that would do that?

heavy basalt
#

sorry, I tried this: ``` void Update()
{
Floater floater = boat.GetComponent<Floater>();

    Vector3 boatForward = boat.transform.forward;
    boatForward.y = 0;
    Vector3 cameraForward = floater.cameraTransform.forward;
    cameraForward.y = 0;

    float dot = Vector3.Dot(boatForward.normalized, cameraForward.normalized);
    Debug.Log("Dot product: " + dot);
    float angle = Mathf.Acos(dot) * Mathf.Rad2Deg;     
    if(dot > 0)
    {
        //t += Time.deltaTime * speed;
        dist += speed * Time.deltaTime;
    }
    else if(dot < 0)
    {
        //t -= Time.deltaTime * speed;  
        dist -= speed * Time.deltaTime;   
    }
   // t = Mathf.Clamp01(t);
    dist = Mathf.Clamp(dist, 0f, length); 
    float t = dist/length; 
    transform.position = splineAnim.Container.EvaluatePosition(t);
} ```
naive pawn
#

is the boat rotating at all?

#

(in other methods)

heavy basalt
#

no, it doesn't rotate at all

naive pawn
#

and it points in the direction of travel?

heavy basalt
#

right now on play, its completely static in its starting position

naive pawn
#

try adding some logs to see what's going on

verbal dome
#

That code looks fine to me 🤔 Is the dot product log printing what you expect?

#

And is speed non-zero

heavy basalt
#

the dot product log is printing what I expect and speed is set to 2, which was working before

naive pawn
#

try logging the dist, this will narrow down the issue

heavy basalt
#

i don't necessarily need to rotate the platform also, the reverse movement based on camera transform is mimicking ping pong

median hatch
#

stupid question but is the object static

heavy basalt
#

or thats how I would like for it to behave

median hatch
#

can happen

verbal dome
heavy basalt
naive pawn
heavy basalt
heavy basalt
verbal dome
heavy basalt
verbal dome
#

But you are modifying transform.position which is the child's transform, right

heavy basalt
#

now that you've said it

heavy basalt
naive pawn
#

you're probably just gonna have to debug more to figure out what exactly is going on

#

(if the issue wasn't just that you were moving the wrong object)

pliant dome
#

I have both a box collider and a capsule collider in my player. In a OnCollision method when colliding with whatever I tagged ground. Could I assign specific colliders for when it collides with the ground?

#

I only want the box collider to have the property of being grounded

#

but I still need the capsule collider there to collide with stuff

naive pawn
#

you could have the colliders have separate layer overrides, or you could separate them out to different objects

cloud agate
#
    {
        float posx = (mapList.entry[index].x1 + mapList.entry[index].x2) / 2f;
        float posy = (mapList.entry[index].y1 + mapList.entry[index].y2) / 2f;
        Vector2 position = new Vector2(posx, posy);
        Debug.Log("Spawned a marker in: " + position);
        GameObject markerInstance = Instantiate(marker, position, Quaternion.identity);
    }

I have this code for spawning markers in the middle of rectangles on my HUD. for some reason it spawns them wrong though

chrome apex
#

!code

radiant voidBOT
naive pawn
solar hill
#

whats the expected result and whats the actual result

chrome apex
#

I don't understand this. When I add this line:

bramble.transform.localRotation = Quaternion.Euler(0f, (Random.Range(0f, 360f)), 0f);

The rotation doesn't work. It rotates on a random axis it seems like. When I rotate it manually in scene view, it works perfectly. How is that possible?

pliant dome
#

Well how its set up with the child

#

I mean

solar hill
#

does the parent have any non 0,0,0 rotations?

chrome apex
# solar hill does this object have a parent?

OK for reference;

void InstantiateBrambles()
    {
        Vector3 pos = new Vector3(0f, 0f, startOffset);

        for (int i = 0; i < 5f; i++)
            {
            int rand = Random.Range(0, 2);
            GameObject bramble = Instantiate(Brambles[rand]);
            bramble.transform.SetParent(gameObject.transform);
            bramble.transform.localPosition = pos;
            bramble.transform.localRotation = Quaternion.Euler(0f, (Random.Range(0f, 360f)), 0f);
            pos += new Vector3(0f, 0f, nextOffset);
        }

It should be noted when I rotate in world space, I get the same kind of weird behavior

verbal dome
solar hill
solar hill
#

also side note ive never seen a for loop use a float

#

at least in this context

#

when you are just incrementing i

naive pawn
#

that probably shouldn't be there but it doesn't change the behaviour

chrome apex
#

I understand what you're saying but that part works

solar hill
#

has "side note" lost all its meaning already 😔

chrome apex
#

I will quickly take a pic of how they look vs how they look if I don't apply rotation

solar hill
#

if you havent

naive pawn
chrome apex
#

here, wrong one

naive pawn
cloud agate
# solar hill wrong how?

forgot one line in the bottom

markerInstance.transform.SetParent(MapHUD.transform, false);

And this is how it instantiates

#

the debug log gives the correct pos

chrome apex
#

here is default

verbal dome
solar hill
verbal dome
#

Oh, your object/its mesh just isn't oriented properly

chrome apex
#

as you can see, in the first image, the selected bramble is offset by only 8 degrees

solar hill
#

yeah but notice they all share the same X rotation

verbal dome
solar hill
#

try

bramble.transform.localRotation = Quaternion.Euler(-90f, (Random.Range(0f, 360f)), 0f);

#

they are actually all rotating correctly on the y axis

chrome apex
solar hill
#

the mesh itself

#

it might have an incorrect up axis set up or something UnityChanHuh

verbal dome
#

Did you make the mesh in blender?

chrome apex
solar hill
#

whatdo you mean 0,0,0

#

the second screenshot has x at -90

#

thats not 0,0,0

#

thats -90,0,0

chrome apex
#

I'm stupid

#

I didn't even see that

#

yes, obvious blender problem

#

my brain is small

#

thanks anyway tho

solar hill
#

also please "fix" that for loop

#

youre wasting perfectly good bytes of memory for that float mad

naive pawn
solar hill
#

honest to god

#

i couldnt actually think of it

#

embarassing considering i just had a midterm regarding exactly memory types 😔

pliant dome
#

My capsule collider is too ingrained with how it changes in size whenever I airdash in the enum so changing the the capsule collider to be its own child is gonna be so hard omg

#

Im so cooked

naive pawn
#

C does weird things to you

chrome apex
#

friendship ended with float, int is now my best friend

solar hill
#

always use Bytes for for loops /s

pliant dome
#

why is the interactions between ledges and the collider and the raycast so absurdly difficult? Its just esentially a platformer thing

naive pawn
#

i mean, it depends on how you're going about it too

#

were you the person asking about detecting ledges vs walls

pliant dome
#

Yeah but that was a while back. I solve one issue then a new crops up. I know thats coding in a nutshell but its ALWAYS about the ledge

#

About how I slide down the ledge cuz of capsule collider or the boxcast causing issues with how big or small it is or just anything!

naive pawn
#

i was gonna ask yeah, wouldn't raycasts/overlap checks be easier than collision checks for your purposes

cloud agate
#

I even get negative values for mouse position from this

naive pawn
#

make sure to read docs

pliant dome
wintry quarry
verbal dome
#

What issues?

#

(Have you tried circlecasts/spherecasts?)

naive pawn
# cloud agate I realized that the issue is that I record the mouse position wrong. Or the game...

The current mouse position in pixel coordinates.

The bottom-left of the screen or window is at (0, 0). The top-right of the screen or window is at (Screen.width, Screen.height).

When running in windowed mode with an unconfined cursor, position values smaller than 0 or greater than the screen dimensions (Screen.width,Screen.height) indicate that the mouse cursor is outside of the game window.
https://docs.unity3d.com/ScriptReference/Input-mousePosition.html

this means it's in screen space. you can use Camera.ScreenToViewportPoint or similar methods to convert this into viewport space

wintry quarry
#

What are you trying to achieve here exactly?

pliant dome
naive pawn
#

if im remembering correctly, it's pretty much the exact region you want to check for collision, no?

lone sable
#

So much for LTS... Really glad thats a thing.

I'm now trying to disable all input actions.

foreach (var item in playerInput.currentActionMap) {
   item.Disable();
}

This works, however, UI navigation is still allowed.. even though its included in the action map list... Why?

naive pawn
#

make the wall and ground all a uniform "terrain" layer

if you cast down and hit, grounded
if you cast, i guess in the direction you're facing (projected to the horizontal plane) and hit, you're facing a ledge

cloud agate
naive pawn
lone sable
naive pawn
#

Input Action System
not sure what you mean by that, that's not a thing

#

not sure what you mean by the LTS thing either. LTS doesn't mean stable

#

it's supposed to be stable, but that's not exactly what the goal of it is

pliant dome
#

but since you cant assign specific colliders in a OnCollision Script I couldnt do this

naive pawn
#

you can separate them out into separate children, so you can do that

#

but you should not

#

it sounds like you're really overcomplicating this

#

you need to step back and think about your design before making it more complex to solve a specific issue

pliant dome
#

But if I make it more simple nothing gets accomplished

verbal dome
#

Are we talking 2D or 3D here btw?

pliant dome
#

3D

pliant dome
naive pawn
verbal dome
#

It's also possible to see which collider was hit from the contact point that you can get with Collision.GetContacts

#

Without having a separate child

#

Just FYI

pliant dome
#

But I cant

naive pawn
#

oh damn, forgot that was a thing

naive pawn
#

but no, that does not sound like it'd make it simpler

pliant dome
#

A capsule is close but the fact that the ends are round causes issues for me

verbal dome
#

Are we using a solid (non trigger) collider to detect ledges here? 🤔

naive pawn
#

i feel like you just want to complain rather than find a solution at this point

verbal dome
#

I'd usually go with a physics query, or a trigger collider at least

solar hill
#

i also might be imagining things but didnt we already discuss this exact problem before?

naive pawn
#

yes

solar hill
#

and the solution was also "simplify" it

naive pawn
#

hmm i don't remember how it ended 🤷

pliant dome
#

Simplifying it would be reverting back to a point where I would just encounter the same issues though

solar hill
#

not really, theres a difference between simplify it and just using an earlier version

naive pawn
#

...so you're just discarding the idea because you think it won't work, or...?

solar hill
#

you still need a solution youre just going to have to have a different approach

#

time sunk fallacy or whatever, sometimes its easier to start fresh

pliant dome
#

Like the collider thing. If I decide "okay lets keep it as a casule and only a capsule. All the issues would still be present

solar hill
#

you have version control (i hope) so nothing is ever truly lost when you experiment

verbal dome
#

Cause otherwise this is just a pointless rant

naive pawn
#

also didn't you want to use a boxcollider or something

solar hill
#

it would be easier if you had a list of issues specifically caused by using a capsule collider

#

a lot of your issues might be interconnected enough that a singular implementation could solve them

pliant dome
solar hill
#

theres no vc in this server

pliant dome
#

Oh then call just a sec?

verbal dome
#

Better just make a thread

pliant dome
#

damn

verbal dome
#

Video + explanation can go a long way

naive pawn
solar hill
#

you can also just take your time

naive pawn
#

i'm trying to help here but i can't if you just deflect that it'd have the same issues as before, when i don't even know what the issues you had before were

solar hill
#

you dont have to list all the problems in like a second lol

#

record a video and write up something from 1. to n.

molten dock
#

u guys know any tips or guides on avoiding build only bugs

naive pawn
#

the only way to not have bugs at all is not have any code

wintry quarry
verbal dome
naive pawn
# naive pawn the only way to not have bugs at all is not have any code

learn well-known patterns and where/when to use them, use available tooling to your advantage - these can help reduce risk of bugs
but they're kinda inevitable, we can't see the future
you'll get better at identifying bug-prone code (antipatterns), or fixing bugs as you get more experience

verbal dome
#

Unless you mean build errors

alpine bronze
#

Hey what are good sources to learn all the unity specific methods, properties etc for someone who already has a solid C# background?

#

Or is the documentation that good 🤣

timber tide
#

clicking the (?) on the component on the editor

#

usually just get the methods, but sometimes an overview

naive pawn
naive pawn
timber tide
#

if you are into shaders though I would marathon through the shader graph docs and all nodes specifically, also Daniel Ilett has a nice resource for that

crimson laurel
#

how do you put multiple different types of values in a dictionary/array? (e.g. ints and strings in 1)

got a hitbox system working, but passing all these different variables for the properties of the hitbox is obviously not that great

I want to pass a dictionary/array through the parameters which contain the information, but since stuff like what shape the hitbox should be would be a string, I can't pass it alongside other stuff

    Dictionary<string, int> amounts = new()
    {
        ["hitboxSize"] = vector2 stuff,
        ["hitboxShape"] = "Square",
    };
slender nymph
#

you don't. why does this need to be a Dictionary and not just some custom class or struct that holds the data?

crimson laurel
wintry quarry
crimson laurel
#

mk

wintry quarry
# crimson laurel mk

For example:

enum HitboxShape {
  Square,
  Circle,
  Capsule,
}

class Hitbox {
  Vector2 size;
  HitboxShape shape;
}```
#

definitely avoid strings for data wherever possible.

crimson laurel
#

gotcha

loud spear
#

i am trying to make a multiplayer pvp pve project and now im strugeling with damage comunication. Is it smart to make a server gameobject wich handels all the damage and says to the objects on the clientside that they take damage?

crimson laurel
naive pawn
#

something like CreateHitbox definitely seems like it'd want to have some data, not just a type

crimson laurel
naive pawn
#

the statement you wrote just.. doesn't make sense

#

what does CreateHitbox take

crimson laurel
naive pawn
#

this is definitely not what one might say would work

ivory bobcat
crimson laurel
#

you can lowkey just ignore what I wrote and tell me what I should actually be doing

naive pawn
#

i don't know what you're trying to do

#

what does CreateHitbox take

edgy sinew
#

what is the ultimate goal here?

crimson laurel
#

I want it to take a group of values

#

eg. the size, location, owner of the hitbox, etc

naive pawn
#

cool, so attahcHitboxInfo is not a group of values

#

it is the shape of a group of values - a template, a blueprint, whatever analogy you're familiar with

#

doesn't lua have this concept too

crimson laurel
#

I dunno man

naive pawn
#

yeah lua has classes too

crimson laurel
#

unity doesnt have regular tables so

#

well atleast C# doesnt

ivory bobcat
#

How to post code:

#

!code

radiant voidBOT
crimson laurel
#

I know

naive pawn
crimson laurel
#

again

naive pawn
#

but even so - you understand the difference between classes and their instances, right?

#

lua has this distinction

edgy sinew
#

The var keyword in Unity (C#) is used for implicitly typed local variables, where the compiler automatically determines the variable's type based on the value it's assigned.

naive pawn
#

attackHitboxInfo isn't a table there, it's table, the constructor

crimson laurel
#

I'd rather you just fill me in on what I should actually be doing to make a single script handle hitbox creation

naive pawn
naive pawn
crimson laurel
#

instead of trying to make comparisons to lua when I'm in the dark on the C# side

naive pawn
#

...which is why i'm trying to give analogies to lua...

edgy sinew
crimson laurel
#

ok I appreciate you tryna help but ill just

ivory bobcat
crimson laurel
#

keep goin and find another way

#

thanks

naive pawn
#

@crimson laurel

#

whoops didn't mean to do that

ivory bobcat
#

In your case, you'd pass an instance of your struct etc

naive pawn
#

@crimson laurel if you've used classes in lua, this is a concept you're already aware of, and you just need to apply it here.
if not, you'll have to learn this concept. see the beginner c# resources pinned here

wintry quarry
#

I feel you're just missing the basics of using types, parameters, classes, structs, and methods in C# here.

undone wave
#

dunno if this is more fitting here or in #🏃┃animation but
i made a bunch of rigs for the player character in different angles and set them up so that they have the same sprites/bones/etc
now in Editor Mode, I can just change the Prefab using the dropdown in the Inspector, but how do I do that during runtime, and more specifically, through code?

#

i did find a 'swap prefab' function in the docs, and it seems to have been deprecated

deep depot
#

hey can anybody hop in vc and help me out with some unity issues

undone wave
snow raven
#

Hey all

I've seen so many ways of doing the ground check for a 2d platformer now a days, what's the most up to date and recommended by the community?

I'm also going to have wall jumps

Ray casting, OnCollisionEnter2D, contactFilter2D

It seems that the recommended one, by a unity dev is contactFilter2d? https://github.com/Unity-Technologies/PhysicsExamples2D/blob/d957391d0a2b70225ffdcaede90f40d679df5d1e/Assets/Scripts/SceneSpecific/Miscellaneous/SimpleGroundedController.cs#L17

Thanks 🙂

GitHub

Examples of various Unity 2D Physics components and features. - Unity-Technologies/PhysicsExamples2D

keen dew
#

There is no recommended method. You can use whatever you want and that fits the rest of the game's structure

snow raven
#

I went with contact filter 🙂 Seems to work fine for what I need

livid anchor
#

Hey folks, I have a problem with maths...
I have a drone moving in top-down view on X,Z.
I would like to make the drone tilt slightly in the direction it is moving. Like moving left (X = -1) => Tilt left 30°

How do I code that ? With a smooth tilt animation on top of it :/

midnight plover
livid anchor
midnight plover
livid anchor
midnight plover
livid anchor
midnight plover
# livid anchor I'm a pure beginner, I don't know crap about what You're talking about 🙂

what words dont you understand of what I suggested and where does google fail in reseraching those terms 😉 First thing to learn, read the unity docs about topics you dont know. If its still not clear, just come back and ask 🙂 The velocity is the directional vector of your current rigidbodies positional change: https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Rigidbody-linearVelocity.html

#

If you move with adding forces, it will change the velocity according to the physical calculations

livid anchor
#

I'll read that and check if I can work with it

#

DroneBody.transform.rotation = Quaternion.Euler(droneTilt.z, droneTilt.y, droneTilt.x * -1); ```

Seems like this is as simple as that 🙂
midnight plover
livid anchor
radiant voidBOT
# naive pawn !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

final sluice
#

I need a direction on what I should do. Im making a strategy game with castles and walls. Im trying to make an Enemy AI that will priotize breaking the castle but if there is no path, it will break down its closest wall. How do I do this ?

naive pawn
#

break down the behaviour into simple parts and then figure out how to implement those simple parts
might be pathfinding, finding the wall, breaking the wall for example. how you split it up exactly depends on what you have already

trail crest
#

Easiest way would probably be to use the NavMesh and have the walls act as Nav Mesh Obstacles. If the enemy can pathfind to the target, all is good. If it can't, just use something like a Raycast towards the target to get the wall in front of them or use Vector3.Distance to find the distance of every wall, then get the closest one either to the player or to the target

ivory breach
#

!code

radiant voidBOT
real thunder
#

lil question, Random.value is 0 1 inclusive right?
so
if I use Random.value <= chance it would return true if chance is 0 and value is 0

#

if I use Random.value < chance it would return false if chance is 1 and value is 1

#

do I trim 1 or 0 away or something for checking random chances?

iron wind
#

Yes it's 0 to 1 inclusive. Whether you use < 0.5 or <= 0.5 makes practically no difference.

night raptor
iron wind
#

for reference there's about 1 billion numbers that a float can represent in 0 < x < 1 range

real thunder
#

yeah whatever

night raptor
#

You can always make a loop and count how often you get exactly 1 or 0, not very often is the answer I'm sure

real thunder
#

I just assumed that to check if a crit chance worked out or something I meant to do Random.value <= chance
but after decent amount of time I realized that it won't work I expect it to work on if chance is 0 and random value returned is 0

#

and I can't fix it by replacing <= with < either

#

so I have to specify I don't want 0 or 1

#

right?

#

what's the easierst way to check a chance

final sluice
#

I have this image, I want to make it into a jpg image with the white corners all got cut out, is there a way to do such thing ?

#

Sorry if this is not the right place to ask

keen dew
#

You don't need to check the random value if the chance is 0 or 1. if(chance > 0 && Random.value <= chance) for example

real thunder
#

oh makes sense, thanks

keen dew
final sluice
keen dew
#

With any image editing software

hexed terrace
#

this is a code channel

final sluice
#

yeah ok sorry I will bring this question over 2d-tools

austere dove
rocky canyon
#

Photopea if u want an online workflow

hexed terrace
#

the conversation was moved to the correct channel, let's not drag up an off topic chat 🙂

tulip vortex
#

hello ! I have a problem, I'm trying to get the position of a part of a model but all of the local positions 0,0,0
I searched a little but didn't find anything useful, or didn't understand what was said

wintry quarry
tulip vortex
# wintry quarry Can you elaborate more on what you mean by this and what code you tried?

I have a board, with a lot of tiles, all of those tiles are at position 0,0,0
I tried drawing a sphere gizmos at the position of one of my tile and it drew it at the center of my board
I understood that there was local positions and world positions but I'm using transform.position and if I understood correctly it should return the world position of the object

#

also when I debug.log my tile position with transform.position it gives me the correct (I suppose) world position

keen dew
#

If transform.position is correct but the gizmo is not in the right place then the problem is how you place the gizmo

tulip vortex
keen dew
#

You'll have to show the code if you want someone to tell what's wrong with it

tulip vortex
#

oh sure sorry !

void OnDrawGizmos()
    {
        if (currentTile != null)
        {
            Gizmos.color = Color.red;
            Gizmos.DrawSphere(currentTile.transform.position, 1f);
        }
    }

here is the gizmos code

keen dew
#

And if you log the position how did you confirm that it's correct and different from where the gizmo goes?

tulip vortex
#

but I might have an idea of what's causing the problem

#

I told my friend I was receiving his assets 90 degress on the side and he told me to check that box

#

So i'm curious, does this mess with everything ?

#

because looking further at the logged position, it's completely outside the board, in fact it's under the board around where it would have been if the board was 90

#

ok I don't know I'm lost ._.

high mauve
#

hey i need help with a project i want to steer a plane using gyroscopic input of android device how can i do it i searched the forum but i couldn't find any thing use full

wintry quarry
high mauve
#

well i cant understand what kind of output will it give like using gyroscope will it give me input in x,y,z chage and i yes how can i use it to steer the plane
is it possible to move the plane using a vector force as i dont want to do all the friction and drag things

wintry quarry
#

You probably want to use the Attitude sensor if available, not the gyroscope exactly

#

It depends exactly what you're going for

high mauve
#

ok thanks will do

rocky canyon
#

w/e the output you can probably normalize it 0 -> 1 or -1 -> 1

#

and apply that to ur movement

undone terrace
#

Help Why doesn't this come up?

#

And yes I downloaded it with Visual Studio Code installer

#

but it just doesnt come up

#

"C#" doesnt come up either

swift crag
#

they are two completely unrelated editors (thank you, Microsoft!)

swift crag
#

i'm unclear on what it actually does, actually

tulip vortex
tulip vortex
swift crag
#

That’s what I expected it to do, haha

#

Maybe I just haven’t noticed because I always use the “apply transforms” option in Blender’s FBX exporter

#

When two systems disagree about which direction each axis points, you have to rotate the model to compensate

#

To “bake” that conversion would be to change the mesh itself, instead of just giving the entire object a default rotation

#

So that makes sense

rocky canyon
#

but yea, that doesn't look like vscode (your image)..
looks like visualstudio instead

pliant dome
#

Okay so I took a few steps back and now Im just trying to figure out how to properly detect when Im not touching the ground using boxcast because when I jump for like a frame or 2 Im grounded even when Im not supposed to which messes with alot of stuff

#

I made the box cast super short and this still didnt fix the issue

naive wigeon
#

are there any good resources to create a building system similar to valheims? Code monkeys isnt quite what im looking for and I cant seem to find many resources about modular snapping/rotation online

left sail
#

Hello, I'm here to ask for help with my vehicle which only does Tanger and drift. I've tried modifying it with all the scripts from YouTube, but nothing works; it hasn't changed for an hour.

I spent all day on a tiny bug like this, and I still haven't fixed it. If anyone knows about vehicles...

dusk jay
#

quick question i have my player inside this gameObject just to be able to move freely since without the GameObject my player would be fixed in 0, 0, 0 now i wonder how do i share a variable from GameObject to PlayerSprite, can someone explain to me how to do it?

lyric igloo
#

using UnityEngine;

public class movement : MonoBehaviour
{
public float speed = 40f;

// Update is called once per frame
void Update()
{
    float horizontal = Input.GetAxisRaw("Horizontal");
    float vertical = Input.GetAxisRaw("vertical");
    float moveAmount = new Vector2 (horizontal, vertical).magnitude;

    Vector3 movement = new Vector3(horizontal, vertical, 0f) * speed * Time.deltaTime;
    transform.position += movement;
}

}
that code is goona work?

dusk jay
#

test it

lyric igloo
#

i did its teling me this ArgumentException: Input Axis vertical is not setup.
To change the input settings use: Edit -> Project Settings... -> Input Manager
UnityEngine.Internal.InputUnsafeUtility.GetAxisRaw (System.String axisName) (at <f4e06d84f805445ca5ae28cb191715cf>:0)
UnityEngine.Input.GetAxisRaw (System.String axisName) (at <f4e06d84f805445ca5ae28cb191715cf>:0)
movement.Update () (at Assets/movement.cs:14)

#

thats the input mangar somthing worng?

swift crag
lyric igloo
#

wym?

gloomy heart
#

case sensitive

dusk jay
#

u have this: float vertical = Input.GetAxisRaw("vertical");
u need this: float vertical = Input.GetAxisRaw("Vertical");

lyric igloo
#

oh never mind thanks its fixed

dusk jay
#

quick question i have my player inside this gameObject just to be able to move freely since without the GameObject my player would be fixed in 0, 0, 0 now i wonder how do i share a variable from GameObject to PlayerSprite, can someone explain to me how to do it?

swift crag
dusk jay
#

thx that should do

swift crag
#

A component on GameObject can store a reference to a component on PlayerSprite

#

or vice-versa

#

you can then access the public fields of that component

dusk jay
#

i know about the logic i just didnt know how to do it in Unity specificly as i have coded in other languages and engines

swift crag
#

and yeah, this is the correct way to handle that

#

parent it to another object that moves around

dusk jay
#

thx

somber ivy
#

Hello:)

#

I'd like to ask if anyone know

#

what this

#

Screen position out of view frustum (screen pos 601.000000, 395.000000, 0.000000) (Camera rect 0 0 1059 494)

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

#

mean

#

😭 😭

frail hawk
#

thank god

frail hawk
#

the bot is doing a great job

deep depot
#

hey does anybody have a second to vc about some unity questions

frail hawk
#

better ask here so more people might help you

deep depot
#

here as in this subchat?

frail hawk
#

depends on your questions if code related yes

deep depot
#

yes, i cant get my capsule (player) to bind to a controller. my code may be bad

naive pawn
#

like i mentioned before,

#

!ask

radiant voidBOT
# naive pawn !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

naive pawn
#

you're gonna have to give some more detail than that

#

what do you mean by "bind", and what do you mean by "controller" here?

deep depot
#

well, ill put this out there i have NO idea what im doing. ive just started learning all of this in the past 3 days. so i had gemini write me a character movement script that is supposed to be binded to WASD. I link the "character conntroller" to that script component and i get an error. i was hoping someone could look at my code and tell me whats wrong with it as i dont even know what to look for.'

frail hawk
#

the answer is easy, do not use ai as a beginner

#

learn c#

frosty hound
#

At the very least, you need to share the error.

deep depot
#

i dont know where to start leearning tho. im not really good with youtube tutorials. and every other person ive contacted has just say use AI

frosty hound
#

But mainly, you should actually do a tutorial on character movement so you're doing the thing yourself.

radiant voidBOT
frosty hound
#

Unity has an entire series on learning the engine and basic coding. Including on how to make things move.

deep depot
#

UnityConnectWebRequestException: Token Exchange failed due a failure with the web request.
UnityEditor.Connect.TokenExchange.VerifyTokenExchangeResponse (UnityEngine.Networking.UnityWebRequest exchangeRequest) (at <653e87cf2eee46cba35f0658f2b1887c>:0)
UnityEditor.Connect.TokenExchange.TokenExchangeRequestAsync (UnityEditor.Connect.TokenExchangeRequest tokenExchangeRequest, System.Threading.CancellationToken cancellationToken) (at <653e87cf2eee46cba35f0658f2b1887c>:0)
UnityEditor.Connect.TokenExchange.GetServiceTokenAsync (System.String genesisToken, System.Threading.CancellationToken cancellationToken) (at <653e87cf2eee46cba35f0658f2b1887c>:0)
UnityEditor.Connect.ServiceToken.GetServiceTokenAsync (System.String genesisToken, System.Threading.CancellationToken cancellationToken) (at <653e87cf2eee46cba35f0658f2b1887c>:0)
UnityEditor.Connect.UnityConnect.RequestNewServiceToken () (at <653e87cf2eee46cba35f0658f2b1887c>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <1eb9db207454431c84a47bcd81e79c37>:0)

frosty hound
#

That has nothing to do with your code, that's something to do with the editor.

deep depot
#

oh lord

frosty hound
#

You can use Google (I know, in the world of AI this is a scary thing), to search the exact error up and see what people are saying about it. You're not going to be the only one who would have had it.

deep depot
#

do i just paste my error in to the search engine

frosty hound
#

Have you never used Google before?

deep depot
#

i just didnt know if i out the whole thing or if just a piece of it will do

frosty hound
#

You type something in it and it'll find similar results. So something like UnityConnectWebRequestException: Token Exchange failed due a failure with the web request. would be enough to get something back.

undone terrace
# rocky canyon

I downloaded the Game Development with Unity thing. But nothing comes up when I write something ( like it doesnt recommend things ).

#

ANd since I'm new I would like Visual Studio to show me recommend script

#

But I'm gonna download Visual Studio ig

deep depot
#

ive heard anti gravity is nice alternative to visual studio

undone terrace
#

I'm not using knockoffs

frosty hound
#

Nor should you, as they don't work with Unity's auto completion.

#

!ide

radiant voidBOT
undone terrace
frosty hound
#

This has the guides for setting up VS or VSCode with Unity. If you install VS through the Unity Hub, it'll auto configure.

undone terrace
#

the pink one

undone terrace
naive pawn
#

right, that's what the configuration instructions are for

frosty hound
#

Look, just follow the IDE Configuration instructions.

naive pawn
#

also vs is usually referred to as purple, i don't think ive heard anyone refer it to pink. that's a first for me lol

undone terrace
#

I did this

#

but it changed literally nothing

frosty hound
#

That was all the steps in the configuration guide?

#

Just installing that module?

undone terrace
#

"

Select Modify or Install to complete the installation."

#

It tells me literally

#

nothing

#

about my goal.

frosty hound
#

You installed the module?

undone terrace
#

These things have nothing to do with the Unity thing

Download the Visual Studio installer, or open it if already installed.

Select Install, or Modify if Visual Studio is already installed.

Select the Workloads tab, then select the Game development with Unity workload.

If Unity isn't already installed, select Unity Hub under Optional.

undone terrace
#

And it still doesn't recommend me anything

#

no script

#

no nothing

frosty hound
#

And you decided to stop reading after that point?

undone terrace
#

In the Unity Editor, select the Edit > Preferences menu.

On the left, select the External Tools tab.

#

I did this.

#

I watched 4 tutorials on it

#

The rest is about how to set up Unity

#

Now VS with Unity

#

But it's not different with the blue one

frosty hound
#

Okay and in your opinion, those steps don't matter?

undone terrace
#

VS has nothing to do with Unity directly,

#

If it says "How to set up unity"

#

and another thing says

#

"How to set up unity with VS"

frosty hound
#

Okay, sure. Good luck. 👍

undone terrace
#

I only read the second thing.

#

Alr. Tell me what this has to do with VS?:

Open the Unity Hub, which was installed during the Visual Studio Tools for Unity installation.

On the left of the Unity Hub window, select the Installs tab.

Select the Add button.

In the Add Unity Version window, select a version of Unity to install.

Select Next to continue the installation.

In the Add modules to your install step, select Done.

#

One single thing?

#

I downloaded Unity Hub 1 year ago.

#

Exactly.

#

Nothing.

#

Maybe, just maybe you could help next time. Telling somebody to read things they already read, which have nothing to do with VS does not help.

#

I am not sure if you even read the article.

polar acorn
#

In order

undone terrace
# polar acorn You should actually do all of the steps instead of just picking the ones that lo...

As I said.

What does this have to do with VS?

Open the Unity Hub, which was installed during the Visual Studio Tools for Unity installation.

On the left of the Unity Hub window, select the Installs tab.

Select the Add button.

In the Add Unity Version window, select a version of Unity to install.

Select Next to continue the installation.

In the Add modules to your install step, select Done.

#

"If .... you're read to set up Unity". Guess what. I set up unity 1 year ago.

#

So it's not actually needed to read "How to set up unity".

#

But "Configure Unity to use Visual Studio" is very interesting.

#

So I read that.

fickle plume
#

@undone terrace Stop spamming the channel and follow instructions

undone terrace
#

I followed the instructions. I watched 3 tutorials. Nobody could help. Now I ask for help and they tell me to follow instructions?

polar acorn
#

Because the instructions have worked for everyone who's actually done them

naive pawn
#

have you set the external tools

frosty hound
#

Like, let's use a bit of critical thinking. If you have installed Unity, then obviously you can skip that part to the Configure Unity to use Visual Studio that follows. This article, from microsoft, is an all encompassing article for setting up both VS and Unity and then configuring them to work together.

undone terrace
polar acorn
undone terrace
polar acorn
undone terrace
#

Yes IDK

#

That's what I'm asking

frosty hound
#

You wouldn't. Reading comprehension is clearly something you're struggling with. Skip to the Configure Unity to use Visual Studio part.

naive pawn
undone terrace
#

I will not paste this again, because Iwill get banned.

#

I will explain myself one last time.

frosty hound
#

Honestly, this article has less words in it than you've posted here arguing lol.

undone terrace
#

1 Year Ago I downloaded Unity.

frosty hound
#

Great

undone terrace
#

2 Articles: How to download Unity. How to download VS.

frosty hound
#

Sound perfect

undone terrace
#

Why should I read "How to download Unity"?

frosty hound
#

You shoulnd't, nobody is askin you to.

naive pawn
#

no-one is telling you to

polar acorn
frosty hound
#

It's baffling that you're hung up on that fact.

undone terrace
undone terrace
#

Yet nobody asnwered me to this question.

undone terrace
#

Where?

polar acorn
#

You were given exactly what to do

frosty hound
#

Alright, this is going in circles lol. Make a thread if you want to continue this, please.

polar acorn
#

I literally just posted a screenshot

#

read it

undone terrace
#

I am repeating myself. I READ THE ARTICLE

#

THE ARTICLE COULDNT HELP

#

NOW IM ASKING FOR HELP

#

That's what Humans are for.

#

I watched 3 tutorials, READ THE ARTICLE, and I don't know what to do?

polar acorn
#

And humans wrote that article

#

which tells you what to do

#

and when you asked for clarification of if you can skip a thing

undone terrace
#

This Channel is COMPLETLY USELESS, if everybody just says "Read an article".

polar acorn
#

you were told to

undone terrace
polar acorn
#

and then you invented a different thing that you thought you were told to do

naive pawn
#

like, those are the steps to do it

#

what exactly are you expecting us to do?

undone terrace
#

I'd like to know, why My Unity is not able to recommend me scripts.

#

I sended you photos

#

I can give more information

#

I was answered to read the article.

naive pawn
#

that would be because it's not configured

undone terrace
#

I read the article.

frosty hound
#

You can do so in the thread

polar acorn
#

Install VS, install the module, set the editor in options, install the package

#

donezo

frosty hound
#

Make a thread, show your screenshots of your set.

undone terrace
undone terrace
polar acorn
undone terrace
#

And exactly THIS IS THE PROBLEM.

#

You got it!

naive pawn
#

i don't doubt that you've tried to configure it before. obviously, something has gone wrong. we aren't trying to find blame here

frosty hound
undone terrace
#

I am going to make a thread if you stop replying to my messages

frosty hound
#

You're just going to get muted, so either make the thread or don't.

naive pawn
#

jesus it's not that hard

frosty hound
#

Baffling

naive pawn
#

configuring VS

#

here you go

idle agate
#

hi

undone terrace
naive pawn
#

you could have done that yourself, but sure

idle agate
#

if all these idiots can do it

#

why cant i

#

!docs

radiant voidBOT
idle agate
#

!learn

radiant voidBOT
idle agate
#

!install

radiant voidBOT
# idle agate !install
When Unity fails to install checklist
  • Make sure you have enough space including on C: drive.
  • Check that it's not being blocked by antivirus/security programs.
  • Look through the logs for a real reason why the setup fails they are pinned [here](#💻┃unity-talk message).

If you still have issues, perform a clean install in another location:

  • Install the Hub and Unity in a non-system drive or a clean new folder in the root of C: drive.
  • Failing that use the recovery Refresh option or reinstall OS entirely then repeat the previous step.
frosty hound
idle agate
#

☠️

tiny gulch
#

Hello! I have an issue where I load a scene, but when I try loading it again it does not work.
ex. I have a Main Menu where I can click a button to open another scene where I can choose what ship to use. Although if I go back to the menu I cannot load the ship selection scene. I am very new to unity so plz help :]

slender nymph
#

you're gonna need to provide more info, like what happens when you try and the relevant code

tiny gulch
#

is there somewhere I can upload screenshots and code?

slender nymph
#

!code

radiant voidBOT
naive pawn
#

screenshots you can just send here, but be wary of sending too many lest you get timed out lol

tiny gulch
#

am I supposed to unload a scene? I am fumbling in the dark here
I could share my screen if possible

#

in a vc or something

frosty hound
#

If you just load another scene, it'll unloading any existing ones.

tiny gulch
#

well, then I am unsure why it does not work. Supposed to be able to switch between menus, but I cannot 😐

frosty hound
#

Put Debug.Logs where you think things should be happening to verify the code is actually being called.

naive pawn
#

could you be more specific with "it doesn't work"?

#

is it erroring, just not doing anything, or doing something unexpected?

tiny gulch
#

not doing anything

naive pawn
#

go through what osteel said

tiny gulch
#

could it be cause the references on the buttons disappear when I load another scene?

#

the object with the script has dontdestroyonload

slender nymph
#

yes, that would be exactly why

tiny gulch
#

ty, I will test

#

ok wow I'm dumb xD

#

ty for the help 😄

sour palm
#

Hay I'm having constant issues with my ledge grabbing script, from what I can deduse is that the SphereCast I have just dose not work but I have no idea why.

#

This has been going on for days now and I'm at my witts end.

wintry quarry
#

Spherecasts don't just "not work"

sour palm
#

I put in some debug.logs to see what is activating and the Spherecasts just never turns on.

wintry quarry
polar acorn
wintry quarry
#

"just never turns on" is not helpful

polar acorn
#

The sphere needs to actually hit them during its movement

sour palm
sour palm
polar acorn
#

What is the radius, length, and layer mask your passing to the cast?

#

And when are you calling the function

sour palm
#

I'm calling the function in the update. I don't think I have a radius but I do have a length of 3 and the layer mask is WhatisLedge.

keen dew
#

Why is it a spherecast at all if it doesn't have a radius

polar acorn
edgy sinew
crisp quest
#

guys i want to know by which angle my object is thrown in the air (it's in projectile motions)

#

i was thinking about making a system in which an arc appear on the path of my thrown object

placid jewel
fast zodiac
#

I have 2 objects in 2D objectA and objectB
I want objectB to always look at objectA I mean rotate its z towards objectA's position.
how can I do this?

slender nymph
#

Transform.LookAt points the Z axis at another object which is not ideal in 2d.
all that needs to be done here is set the transform.up or transform.right (depending on the direction it faces at rest) to the direction between the objects which is just (endPosition - startPosition).normalized (although you don't actually need to normalize it here since those properties are normalized automatically)

placid jewel
#

Yeah, you're right, forgot about that

fast zodiac
#

let me try this, I'm a new Unity and in programming too.

#

red one toggles between two x positions
then black always face towards red object and lerp to that position.

frosty yarrow
#

using UnityEngine;
using UnityEngine.InputSystem;
public class Gun : MonoBehaviour
{
public Transform raycastPos;
public Transform cam;
float distance = 2f;
public Rigidbody player_rb;
public Transform player;
float force = 7f;
bool looking_at_ground;
void Update()
{
Ray ray = new Ray(cam.position, cam.forward);
Vector3 origin = raycastPos.position;
Vector3 direction = cam.forward;
RaycastHit hit;
Debug.DrawRay(origin, direction * distance, Color.red);

    if (Physics.Raycast(ray, out hit , distance))
    {
        if (hit.collider.CompareTag("Ground"))
        {
            looking_at_ground = true;
        }
        else
        {
            looking_at_ground = false;
        }
    }
}

void OnFire(InputValue val)
{
    if (val.isPressed && looking_at_ground)
    {
        player_rb.AddForce(Vector3.up * force, ForceMode.Impulse);
    }
}

}
you cansome tell me why the there is no force

slender nymph
frosty yarrow
slender nymph
#

huh? i am telling you to debug your conditions mate

frosty yarrow
slender nymph
#

wdym "it is normal" what is normal, and what does "normal" mean in this context

frosty yarrow
slender nymph
#

and what object is this component attached to? and does that object have a PlayerInput component on it? because that is what is sending the OnFire message

crisp quest
tired python
#

i am having a problem picking the right rigidbody2D types and setting the right colliders with triggers.

#

this looks like a nightmare tbh, any ideas as to what i can do to resolve such kinds of issues?

midnight plover
#

What is the actual issue?

tired python
# midnight plover What is the actual issue?

I have four rigidbodies in total:-
-> The Dragon Garbage: Has a Box Collider placed on it,so that when any unit is placed on it , it blasts it away, destroying the unit.
-> The Unit: Has two colliders (circle and box), I want box to detect collision with Garbage, and i want circle collider to detect collision with enemies (to know whether an enemy is in range or not, if it is, then it shoots bullets at said enemy)
-> Enemies: Has a Polygon Collider
-> Path: Has a Collider on it. (If a unit is to be placed on the path, it detects collision and destroys the unit)

midnight plover
tired python
#

How does setting the physics matrix help?

#

Also, what's a spherecast?

cosmic dagger
tired python
cosmic dagger
placid jewel
#

get the angle of motion

real thunder
#

out of curiosity, what for does KeyCode.None exists?

tired python
#

i guess i will just need to check out how other peeps do it then

cosmic dagger
midnight plover
tired python
cosmic dagger
tired python
#

i just attached the colliders onto the actual gameObjects themselves

placid jewel
#

You can just make an empty child object and put the collider + script on it, for each collider on the object

tired python
#

ima cooked

cosmic dagger
livid anchor
#

Hey folks I would like a bit of help with a singleton issue.

I have my game manager as a singleton, I create an instance of the GM on the awake method and I use it for scoring/UI management. But also for a boolean stating if the game has been paused.

When I start the game it doesn't seem to have any issue, but if I start a new game (reload the scene), one of my script attempting to access the boolean cause an error.

I have no idea why

#

Seems like it only make the error once per script (73 times) and then stop making errors

cosmic dagger
#

Or is it initially in a different scene?

keen dew
livid anchor
north pier
#

Ok, this might not be a beginner question, but I was unsure of which channel to ask in. Is it possible to subscribe to the same events that OnTriggerEnter and OnTriggerExit methods use?

sour fulcrum
#

it is not

north pier
#

Ok, thank you. I will just have to make a script just handling that then.

torn mango
#

hi guys i need a professional opinion

#

is this an ok way to do animation transition?

#

it looks real messy to me

keen dew
torn mango
#

ok got it sorry

sour cape
#

is there anythign special u need to do to get mesh lod working in unity 6.2, i cant see it working

hexed terrace
short gust
#

kinda basic question, but I'm not quite sure about management of coroutines and if I understand it fully

if I call StartCoroutine, then cache the resulted routine into a field and after some time call StopCoroutine on that routine reference: will another StartCoroutine call with the cached routine will create a new instance of the coroutine (and so create garbage on every start of the routine) or it will reuse the same instance of the coroutine object every time (so no garbage on every start)?

frosty hound
#

It creates a new one

wintry quarry
#

you want to make a new one each time

#

You cannot restart a coroutine

frosty hound
#

What you can cache the yield instructions though, if you want to save performance.

short gust
#

oh, thanks!

wintry quarry
stone lake
#

does anyone know any good tutorials for making a substantial 3D platformer?

#

when I say substantial I mean like what 20+ hours of work total?

polar acorn
#

20 hours of work on a platformer is like, doodle jump

stone lake
#

oh

#

I mean

sour fulcrum
#

when i hear substantial that sounds more like couple years

stone lake
#

im thinking like

#

it takes a while to do

#

1month - 2months

sour fulcrum
#

there's not many tutorials like that period

stone lake
#

okay good point

#

im just

#

trying to complete a school project

#

and

#

i need something

#

it cant just be over in like 5 hours tho

polar acorn
#

Probably better to do something simple then improve it

polar dust
#

School projects probably shouldn't really be substantial, simple is better

polar acorn
#

than setting out to do something big

stone lake
#

i say school project but its an official examination board

sour fulcrum
#

make something simple then make it really simple and really good

stone lake
#

i can't really program tho...

#

thats why I need a tutorial

#

and if youre wondering why I don't just learn

#

its because I have nowhere NEAR enough time

#

im not just being lazy I promise

sour fulcrum
#

no your being lazy

#

respectfully

stone lake
#

sigh

sour fulcrum
#

that's enough time to make somethign simple

#

you got this

stone lake
#

it cant be simple 😭

#

it needs to be 2 months of work

#

thats the problem

sour fulcrum
#

learning is 2 months of work

stone lake
#

exactly

#

thats the problem

sour fulcrum
#

no

stone lake
#

i will have learnt

sour fulcrum
#

thats the solution

stone lake
#

and will have no project

sour fulcrum
#

you learn by making the project..

polar dust
#

You learn by doing

stone lake
#

but then I need a tutorial right?

#

where can I find that...

sour fulcrum
#

have you tried searching?

stone lake
#

idm learning if it ends up with a finished product

stone lake
#

theyre all super short

#

platformer wise

sour fulcrum
#

not for tutorials on how to make a full finished game

#

on how to program

polar dust
#

Surely the people who have given this task, can provide resources for learning

stone lake
#

theyre not allowed to help

#

its an exam board

#

i shouldnt have called it a school project

#

its a non exam assessment sent by a national examining body

polar dust
#

They can't help you make the project itself
Providing resources isn't the same as them making it for you

stiff birch
#

You can look for not so specific tutorials, learn, and then try to apply your new knowledge to what you actually want, experiment, fail, retry then finally succeed. Even if the result is not as shiny as Mario 64, the learning process is here and you have a thing.

stone lake
polar dust
#

You need to relay your issues to them, see what guidance or advice they give you

sour fulcrum
stone lake
#

hold on

#

i need to do all of this with the project

stiff birch
stone lake
#

i cant go in to a tutorial blind if idk if it will work out

#

or im putting the entire subject at risk

stone lake
#

i tried doing a project in unreal 5 and it failed miserably

sour fulcrum
#

you need to learn how to code

stone lake
#

so now im dedicating myself to unironically, no joke at all spending the next week pulling non stop all nighters to fix it

stone lake
#

look

#

i live in the uk right

sour fulcrum
#

then you will fail

stone lake
#

this is how much code im expected to know:

stone lake
#

basically nobody in my class knows how to code

sour fulcrum
#

to learn how to code

stone lake
#

...they just follow tutorials

sour fulcrum
#

follow those tutorials then

stone lake
stone lake
stiff birch
#

!learn

radiant voidBOT
sour fulcrum
#

is this a post high school thing

stone lake
#

but i need it if i want to go to uni

polar dust
#

For your sake, you have to tell your teacher about the problems your facing. Only they know what they can and cannot provide you, and I'm sure they'd rather you have the ability to begin working

stone lake
#

im like

#

5 months into this

#

i already made a project

#

tried to learn

#

i watched tutorials

#

messed up

#

and now i am absolutely screwed beyond imagination

#

i have like 2 months to catch up and finish development

#

when other people have already finished their entire project

sour fulcrum
#

To be completely honest homie we can't help you here