#💻┃code-beginner

1 messages · Page 774 of 1

grand snow
#

im red green colour deficient too!

naive pawn
#

another thing you could consider is whether stuff is diegetic - whether they exist in the world of the game

tired python
#

so....ui is basically above the game underneath O_O

grand snow
#

well it does usually render last so thats somewhat true

tired python
#

like if in a multiplayer, the other person can look at their equipments and stuff, i won't be able to see that so that's ui

naive pawn
#

well, the inventory is UI. if you see stuff in the world on their player model, that isn't

tired python
naive pawn
#

here's another example. like before, the placement indicator could be considered UI, but it's handled closer to how the existing stuff is, so it's easier to not have it as UI in implementation

grand snow
#

so its not that we "moved it" but performed the correct actions to drop a thing on the floor

naive pawn
#

diegetic UI kind of blurs the line.
i remember seeing a game with a semi-diegetic inventory/hud that existed in world space, but that'd still be UI
halo has ammo counters on its weapons - that's certainly UI, but again, in world space

naive pawn
tired python
#

so let's say, for what's gonna happen in my game...when i select one of the units in the unit selection area, and while draggin it, since it's not deployed yet, it's UI but then when its instantiated(when i drop it), it becomes spawned object. so when i might wanna drag a unit onto some other space, i will destroy the object, spawn it's image UI at my mouse pos, and then when i drop it, it becomes a gameobject again

naive pawn
naive pawn
tired python
naive pawn
#

but what you described is viable

naive pawn
tired python
#

which one would be better in your opinion

naive pawn
#

the former would probably be easier, less moving parts

tired python
#

so while dragging, it just stops everything and then when not dragging, it resumes whatever it was doing

naive pawn
#

could work

#

if you have a central component for managing the behavior, you could enable/disable that and then use OnEnable/OnDisable to manage the animation state, cooldowns, etc when picking up/placing down

#

but that's just one way to do it, just a matter of design

frail hawk
old remnant
#

Hey I'm trying to make a tower attacking enemy but I keep getting this error

MissingReferenceException: The object of type 'UnityEngine.Transform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object+MarshalledUnityObject.TryThrowEditorNullExceptionObject (UnityEngine.Object unityObj, System.String parameterName)
UnityEngine.Bindings.ThrowHelper.ThrowNullReferenceException (System.Object obj)
UnityEngine.Transform.get_position ()
Tower.Shoot () (at Assets/Scripts/TowerScript.cs:52)
Tower.Update () (at Assets/Scripts/TowerScript.cs:40)
#

(I tried to use the null code that I found online but doesn't seem to work)

#

anyone know where the problem is?

keen dew
#

Line 52 is GameObject projGO = Instantiate(projectilePrefab, firePoint.position, firePoint.rotation); so firePoint has been destroyed

old remnant
spiral summit
#

Is the setup similar to C# › IntelliSense: Add Type on Completion

naive pawn
spiral summit
#

it has been banned, how can i replace it now

naive pawn
vast talon
#
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    [Header("Parts")]
    public CharacterController CharCont;
    public Transform playerTransform;
    public Transform camTransform;

    [Header("Constants")]
    public float movementSpeed = 100f;
    public float jumpHeight = 250f;
    public float offset_x = 10f;
    public float offset_y = 5f;

    public float offset_z = 3f;

    public const float GRAVITY = -9.81f;

    void Update()
    {
        print(CharCont.isGrounded);

        var velocity = Vector3.zero;

        velocity.z += movementSpeed * Time.deltaTime;

        if (Input.GetKeyDown(KeyCode.Space) && CharCont.isGrounded)
        {
            var target_velocity = Mathf.Sqrt(2 * jumpHeight * GRAVITY);

            velocity.y = target_velocity;
        }

        velocity.y += GRAVITY * Time.deltaTime;

        CharCont.Move(velocity);
    }

    private void LateUpdate()
    {
        var playerPos = playerTransform.transform.position;

        camTransform.position = new Vector3(playerPos.x + offset_x, playerPos.y += offset_y, playerPos.z += offset_z);
    }
}
``` so the player jitters up and down and up and down everytime it touches the floor. how do i fix this?
naive pawn
#

do you have anything interfering with the CC?

#

a rigidbody, perhaps

vast talon
#

nope. this is the only script in my game and it doesnt have arigid body

naive pawn
#

oh also your velocity seems to be wrong, you never compound gravity

vast talon
#

what do you meann?

naive pawn
#

velocity needs to persist between frames in order to add continuous acceleration correctly, but you would also need to reset the downwards velocity while on the ground to not make your velocity go infinitely downwards

vast talon
#

oh ok

naive pawn
#

your velocity is lost and recomputed every frame

#

you would need velocity to be a member field

vast talon
#
        velocity.y = -2f;
        
        if (!CharCont.isGrounded) velocity.y += GRAVITY * Time.deltaTime;``` Changed it to this
naive pawn
vast talon
#

how

naive pawn
#

consider what gravity is

#

it's an acceleration

#

if you fall for longer, you start falling faster

#

you don't compound gravity there, you basically set it to a fixed value that varies by fps a little

vast talon
#

like an example?

naive pawn
#

do you understand what needs to happen though

vast talon
#

yes

naive pawn
#
Vector3 velocity; // this being **outside** Update is important

void Update() {
  velocity.y += gravity * Time.deltaTime;
}
```just something like this would achieve an acceleration
#

but the = -2f resets the acceleration

#

you could use that to reset down velocity, but you'd need to do that only if you're already on the ground

vast talon
#

heres a video about whats going on

#

i literally could not tell you hwat happened to the quaility mustve been the monitor

#

getting a new one for chirstmas

naive pawn
#

your velocity is still not a member

#

you still haven't fixed the issue i mentioned

vast talon
#

i just quickly showed one sec

light cave
#

i am noob

#

answeh my question please

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

light cave
#

what is the diff between 2d build in render pipeline and universal 2d

#

i wanna make a top down car game

naive pawn
#

"universal" refers to the universal render pipeline, URP
they differ in render pipeline

#

BiRP is the one that unity ships with, but unity also supports "scriptable render pipelines", basically custom RPs
URP is one of the custom ones

light cave
#

so i can create custom shaders?

naive pawn
#

you mostly don't really have to care, though some assets may support one but not the other

#

shaders will need to be for one of the other, or something like that.

#

this is most definitely not a code question though

naive pawn
light cave
#

ok

vast talon
# naive pawn "universal" refers to the universal render pipeline, URP they differ in render p...
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    [Header("Parts")]
    public CharacterController CharCont;
    public Transform playerTransform;
    public Transform camTransform;

    [Header("Constants")]
    public float movementSpeed = 100f;
    public float jumpHeight = 250f;
    public float offset_x = 10f;
    public float offset_y = 5f;

    public float offset_z = 3f;

    public const float GRAVITY = -9.81f;

    private Vector3 velocity;

    void Update()
    {
        print(CharCont.isGrounded);

        Vector3 move = new Vector3(0, 0, 1) * movementSpeed;

        if (Input.GetKeyDown(KeyCode.Space) && CharCont.isGrounded)
        {
            var target_velocity = Mathf.Sqrt(2 * jumpHeight * Mathf.Abs(GRAVITY));

            velocity.y = target_velocity;
        }

        velocity.y += GRAVITY * Time.deltaTime;


        if (CharCont.isGrounded && velocity.y < 0)
            velocity.y = -2f;

        CharCont.Move((move + velocity) * Time.deltaTime);
    }

    private void LateUpdate()
    {
        var playerPos = playerTransform.transform.position;

        camTransform.position = new Vector3(
            playerPos.x + offset_x,
            playerPos.y + offset_y,
            playerPos.z + offset_z
        );
    }
}
``` ive fixed up the code a little trying to use what you explained
#

still jittery

naive pawn
#

(btw, you could just have the camera offset be a Vector3 and then add the 2 vectors)

vast talon
#

well i couldve

#

but ill do that later i need to do this

naive pawn
#

yes, that's why i said btw

vast talon
#

biggest problem first then the others

#

but it is still jittering

#

and i dont know why

naive pawn
#

is it jittering in the same way you recorded previously?

vast talon
#

yes

naive pawn
#

could you show the inspector for the floor

thorn crescent
# vast talon but it is still jittering

Isn't it obvious? You're constantly applying downwards velocity to the object on every frame despite it being grounded, the object tries to move downwards, enters the floor, and gets yeeted up so as to not be inside the floor. Only apply downwards force when not grounded.

naive pawn
#

there isn't a depenetration force afaik, since it isn't physics per-se

#

usually i see something like 0.2, so maybe there's jank there with it being so large, but i don't think it's the issue

thorn crescent
naive pawn
vast talon
naive pawn
#

does it have a rigidbody

vast talon
#

nope

#

what i think is happening is

#

once the player touches the ground

naive pawn
#

please finish your thought before pressing send

vast talon
#

it immediately jumps back to like persey 2 meters above the ground before going again and so on

vast talon
naive pawn
#

idk, i guess try changing the grounded down velocity to something like 0.2f, that's what i usually see

naive pawn
vast talon
#
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    [Header("Parts")]
    public CharacterController CharCont;
    public Transform playerTransform;
    public Transform camTransform;

    [Header("Constants")]
    public float movementSpeed = 100f;
    public float jumpHeight = 250f;
    public float offset_x = 10f;
    public float offset_y = 5f;

    public float offset_z = 3f;

    public const float GRAVITY = -9.81f;

    private Vector3 velocity;

    void Update()
    {
        print(CharCont.isGrounded);

        Vector3 move = new Vector3(0, 0, 1) * movementSpeed;


        if (Input.GetKeyDown(KeyCode.Space) && CharCont.isGrounded)
        {
            velocity.y = jumpHeight;
        }

        if (!CharCont.isGrounded) velocity.y += GRAVITY * Time.deltaTime;


        if (CharCont.isGrounded && velocity.y < 0) velocity.y = 0.2f;

        CharCont.Move((move + velocity) * Time.deltaTime);
    }

    private void LateUpdate()
    {
        var playerPos = playerTransform.transform.position;

        camTransform.position = new Vector3(
            playerPos.x + offset_x,
            playerPos.y + offset_y,
            playerPos.z + offset_z
        );
    }
}
``` the code now. it still replaces my position at like a small amount
#

which means by my suspicion it would be this line thats causing the problem:
if (CharCont.isGrounded && velocity.y < 0) velocity.y = 0.2f;

#

instead it may be trying to reset my position to be 0.2 and once it goes to the ground then it replaces the thingy

rich adder
#

why is it 0.2 ?

vast talon
#

idk man

rich adder
#

that should be 0

#

example of proper gravity ^

thorn crescent
vast talon
#

thanks for the overwhelming help guys :]

naive pawn
naive pawn
thorn crescent
# vast talon idk man

like think about it, if your character controller object, which by definition is constrained by collisions, enters another collider, regardless of having a rigidbody or not, it needs to exist outside the space of other colliders. so it will jitter towards the closed exit point, if it enters another collider, which so happens to be above the floor.
Then, you're constantly adding delta time to velocity for no reason, which gets applied as soon as the character controller is yeeted up outside the floor collider, which goes down, rinse and repeat.

naive pawn
#

0.2f makes it go away from the floor

rich adder
naive pawn
thorn crescent
naive pawn
#

isGrounded checks if it hit the ground the last move

rich adder
#

I don't use isGrounded so who knows

#

I use proper physics queries

naive pawn
#

there's been a ton of discussions here that have been resolved quite easily by just adding a grounded downvelocity

rich adder
#

isGrounded is too finnicky , I'll stick to overlap / cast

naive pawn
thorn crescent
naive pawn
naive pawn
rich adder
naive pawn
#

i definitely had this convo before.. im not super confident it was with you though

rich adder
#

I think the old example code in CC.Move did have -0.2f so I don't disagree, I just hate using IsGrounded personally and always recommend the spherecasts/overlap

vast talon
#

ykw im not gonna use the built in charactercontroller.blahblah thingy isCheckedGround ima use my own

thorn crescent
rich adder
#

spherecasts especially if you need slope detections / normal

naive pawn
thorn crescent
naive pawn
#

if it hit the ground during the last move, in the context of CC

#

if you didn't move towards the ground, you don't hit it

rich adder
#

I think it had to also do that velocity is not exactly 0 like if you inspect a rigidbody falling on a floor its never exactly 0 and fluctuates "grounded"

#

- just kinda "sticks" it to the floor

thorn crescent
naive pawn
#

so he stays grounded

#

a new move is made. if you don't hit the ground then it won't be grounded the next frame

thorn crescent
silk night
#

Specific question about VContainer but maybe somebody can help me here as they dont really have a support discord or anything like that

Is it possible to have a "sub installer"? So i can split my LifetimeScope up into features and not have every single class in the main file?

naive pawn
naive pawn
rich adder
#

ya was gonna say, I don't know much about it to comment on it.. I just know the one time i used IsGrounded in the beginning it was too simplistic for me so I stuck with Physics Queries

thorn crescent
#

unless, you did weird things somewhere else, then you need to course correct, because you programmed it wrong

rich adder
#

but its true, even unity has -0.2f in the old example, not sure why it changed .. i think..

#

im sure if waybackmachine it , you will see

naive pawn
#

the example is an example of how to use the apis, it's not necessarily the correct or good way in the context of a system

maiden totem
#

mb

rich adder
#

at the end of the day this is just a C++ controller in PhysX unity is just creating an api for you

thorn crescent
vivid peak
#

how do i like, not get scared of using unity

rapid spruce
#

I'm curious, has anyone dabbled with actual StateMachine implementations for Animations, where you'd do something like manage the states and just use something like StateIds, then in the Animator you'd just do Any State -> States (Cannot transition to self). I started doing states in the Animator but honestly I had 50 arrows going everywhere, how do you manage this if you do it some other way?

naive pawn
rich adder
#

gain experience and thats how you do it

rich adder
thorn crescent
naive pawn
naive pawn
#

what even is the "bad code" here?

#

unity's example?

#

this just feels like willful ignorance at this point

silk night
# thorn crescent if I create bad code, then use a "fix" to make my bad code behave as if it wasn'...

Just one thing about this, in a perfect world we would all create perfect code, but in this world that will get us nowhere, you can now write things you deem perfect and in half a year you will come back and think "who wrote this garbage", trying to iterate over and over to create the "perfect" code will do one thing: stall your progress
I've been there, not wanting to end up with "garbage" code when the project progresses but you have to find a middleground and accept that you can always refactor in the future

thorn crescent
# silk night Just one thing about this, in a perfect world we would all create perfect code, ...

Perfect, and properly used, are two separate things. I can just rotate the camera 180 degrees, then code the whole game using inverse numbers everywhere on vectors, have to change everything 3rd party that I add to it to comply with the fact that I'm for some reason doing things like that because I believe that it's how it works, code runs all fine but I keep having to compensate on things everywhere. would you call that good code? It works doesn't it, that should be enough right?

naive pawn
#

if you have a 3rd party library that does things that way, then sure, doing that would be correct

#

that's the case with CC

#

the isGrounded check expects you to hit the ground

#

that's what the downvelocity is for - supplying that expectation

thorn crescent
naive pawn
#

did you like, read the docs at all

#

im going through the message history regarding isGrounded and it's basically either 2 things

  1. don't use it, it's easily misunderstood (you need a down velocity)
  2. apply a down velocity and it works fine
#

you're stuck in an assumption that the unity example code is perfect, i guess? or that isGrounded must conform to your expectations of it?

supple rune
#

Hello fellas! I am recently self-teaching Unity's latest behavior system via behavior graphs. And I have been struggling to create my own customized flow node to randomly select the next branch to execute with weighted probability.

So basically, I want the customized flow node to read a blackboard variable whenever the node executes (OnStart()) that is controlled and manipulated dynamically outside of the graph. What I did is this:

    [SerializeReference]
    public BlackboardVariable<float> ChanceVariable;

What I expect to see is when I open up the node's inspector panel, I would see an empty bbv called "ChanceVariable", waiting for me to drag a bbv into its empty slot to establish a direct reference.

However what I see is nothing. Like so...

A thousand thanks in advance!

naive pawn
#

i guess it's an issue with CC as a whole, it makes some assumptions that might not be in mind (Move/SimpleMove expecting to be called once per frame is another one, for example)

thorn crescent
# naive pawn did you like, read the docs at all

isGrounded, as per the docs, checks if the character was considered grounded as per the last call of Move on the character controller.
If you use the character controller, you should exclusively move the object using the character controller, and nothing else, no rigid bodies, no transform.position.
If, you're responsible of when and where you moved the character, using it's controller, and the character is not where it should be, and you need to compensate for it's position, you moved the character in a wrong manner, simple as that.
There's no ifs and buts to this, you caused the issue you're trying to correct. Aka, bad code.

naive pawn
#

if the last Move doesn't have any motion towards the ground, then it doesn't hit the ground

thorn crescent
naive pawn
#

you're only thinking about 2 frames

#

i literally gave a frame-by-frame example earlier

#

the previous frame, gravity was applied. now you're on the ground
the current frame, you don't apply gravity because you're on the ground
the next frame, you're no longer "on the ground" because you didn't apply gravity last time

thorn crescent
# naive pawn you're only thinking about 2 frames

I'm not thinking about frames at all, this has nothing to do with frames, I can call move twice, check grounded, call move again, and check grounded again, on a single frame, and it would still work.
isGrounded doesn't check the previous frame, it checks what happened after the previous call to Move, which is what you're not understanding.

naive pawn
#

Move is called once per frame

#

that is the expectation of CC

#

you can call it the previous cycle or previous update or whatever

#

my argument doesn't change

#

the previous call to Move was the one with gravity, and now you don't have gravity. what happens the next cycle?

#

even in the example code, Move is called once per frame

naive pawn
slender nymph
#

oh dang, they finally updated the .Move docs to actually only call Move once per frame. it's been wrong for years

naive pawn
#

so, do consider the "over time" element of this. the code that called move last time was the Update of the previous frame.

the code that will call move next time will be the Update of the next frame. that's where your model will break

naive pawn
thorn crescent
naive pawn
#

oh, i don't need luck

#

hopefully you know how to use CC the correct way now :)

thorn crescent
#

one, can't be a person that says "look at the documentation" and also be "The documentation is wrong" at the same time.

naive pawn
#

the documentation is lacking, not wrong

#

the examples are wrong. examples are commonly wrong.

slender nymph
#

also, despite the change to only calling Move once per frame, the docs are still using a Vector3 for playerVelocity which is only used for its Y axis to apply gravity/jump. it's silly because that could just be a float, they aren't even using any other axis anywhere

abstract copper
#

Could someone help me with optimizing? I have reduced using physics as much as I could but it still lags very badly, I get that the issue is like right in front of me but I still don't know what I should be looking at.

naive pawn
# slender nymph wht downvelocity are you referring to?

was referring to the one in the if (playerGrounded && playerVelocity.y < 0) check, but seems like that's always been 0.
the grounded downforce is supplied by unconditional gravity.

i probably misremembered from someone asking about tutorial code that went like this

if (isGrounded) {
  velocity.y = -0.2f;
} else {
  velocity.y += gravity * deltaTime;
}
naive pawn
#

the grounded downforce is supplied by unconditional gravity.
not sure it's enough though. it still fluctuated a lot, but at least not true -> false -> true -> false like it theoretically wouldve been with no grounded force

naive pawn
slender nymph
naive pawn
# naive pawn so this kind of code would probably still be better

hm, though, yeah, this is framerate dependant.
in a barebones scene, -2f didn't fluctuate, -0.2f did fluctuate until framerate was limited.

so maybe something like velocity.y = gravity * deltaTime * 100; or some factor would be better to keep things grounded

naive pawn
slender nymph
abstract copper
#

I was looking at the wrong thing then

#

Messing and improving the physics did nothing so that explains it

naive pawn
slender nymph
#

this is why i use the KinematicCharacterController and not unity's built in CC lmao

naive pawn
#

how does it handle gravity/how does it handle gravity differently?

#

oh wait, it's just a physics simulation lmao

thorn crescent
thorn crescent
naive pawn
#

that's.. not what you said, but ok

#

just a communication gap i suppose

thorn crescent
naive pawn
#

the phrase "it's almost as if X" means the speaker believes X

slender nymph
naive pawn
#

but sure, i concede that this isn't a particularly good way to go about ground checks.

but that's just not what the convo was about at all lmao

thorn crescent
naive pawn
#

the fixes are for your own code for violating the assumptions set by CC

#

it has nothing to do with CC being designed weirdly

#

if you want to complain about fixing bad code, you would be complaining about CC, not the code using CC

thorn crescent
silk night
thorn crescent
naive pawn
#

do i really have to spell it out for you

abstract copper
thorn crescent
abstract copper
#

It didnt lag like this but I changed some stuff and I dont remember what and now it dies after 6 enemies

naive pawn
#

did you like, figure out my explanation and then you're trying to argue that back at me?

#

what is going on here 😂

thorn crescent
naive pawn
#

"no reason" other than fulfilling the assumptions set by CC, sure...

thorn crescent
naive pawn
#

isgrounded should always be true if you're on the ground, what are you talking about

#

so your Moves should make it so that assumption is fulfilled

#

are you ok

#

you might need to step back for a bit

naive pawn
thorn crescent
naive pawn
#

"am i grounded" should only be true if you just hit the ground?

#

ok, how do you detect if you leave the ground, or if you're currently on the ground

#

the docs just say how isGrounded is computed, nothing about that says it should only be true when you initially touch the ground

#

this is some insane reaching

thorn crescent
naive pawn
#

then you wouldn't be using isGrounded to begin with

#

i'm asking in the context of CC itself

#

what im seeing here is that isGrounded and Move don't fit the assumptions you have, and now you're just reaching for arguments to.. i don't even know what, at this point.

this is just trolling at this point lmao

eternal needle
#

Going as far back as I could, its so entirely unclear what this person is trying to get at here lol

#

The commas make this very unreadable too

frail hawk
#

tbh i still dont know what the conversation is about

thorn crescent
# naive pawn the docs just say how isGrounded is computed, nothing about that says it should ...

because you're interpreting the explanation wrong, it says it's true if last move touched ground, but if it did, it will place the character controller above it, because it's constrained by collisions. Then, if you never move the character down anymore, you don't need to check if he touched the ground, it's simple as that. Because the character would never move down anymore, since you're using a character controller. Then you should apply gravity to it, if the raycast for isgrounded fails. And then, you could check for is grounded again.

naive pawn
#

if you use CC correctly, isGrounded acts basically the same as a raycast, just less configurable

naive pawn
#

that's just using 2 tools for the same task, but using one of them poorly

slender nymph
naive pawn
#

footnote: without raycasts. that defeats the purpose of the question

rich adder
#

damm this is still goin on ..😆

thorn crescent
# naive pawn if you're using a raycast, you wouldn't be using isGrounded

Not true at all. Because the is grounded only return true with the last move, and that's where the bad code is, you don't need to move it down all the time, if the raycast still detects him on the ground. But, when you're moving the character down with the character controller, you might need the point of view of the character controller if it touched down or not, to stop applying downward forces, because the raycast is not aware of the the internals of the character controller, isGrounded is.

naive pawn
slender nymph
glad dagger
#

hey i did the ground checker in unity fo double jump and now its is infinite can smbd help me

naive pawn
#

so.. you just.. don't know what's going on here at all, do you

thorn crescent
rich adder
glad dagger
thorn crescent
glad dagger
#

heres my code

slender nymph
naive pawn
# thorn crescent not at all the same thing

not saying they are. but, if you use both correctly, they do the same thing.

if you're saying isGrounded should only be true only for the moment you start touching the ground, you are just plain wrong. no way about it

polar acorn
glad dagger
#

or i did smthng wrong

slender nymph
#

you gotta give me time to parse this poorly formatted code, mate

glad dagger
glad dagger
slender nymph
#

you should consider using the formatting tools in your IDE to format this so your spacing isn't all over the god damn place, it's nearly impossible to read because of that

polar acorn
naive pawn
naive pawn
#

you never use it in this script

slender nymph
vocal orchid
#

Hi, how can I the small zone where uses "Navmesh Surface", but that zone it's part of main world

frail hawk
# glad dagger oh alr

i cant not see anywhere in your code a jumping command nor where you call the tryjump method

thorn crescent
#

This is what is grounded says on the docs:


Indicates whether the CharacterController was touching the ground during the most recent call to CharacterController.Move or CharacterController.SimpleMove.

This property is updated after each call to Move, based on collision detection with the ground. It returns true if the controller collided with any object below it during the movement — typically used to determine if the character is standing on a surface (e.g., terrain, platform, floor).```

Now, colliders detect collision, when one overlaps the other. If the character controller positions the collider of the object it's attached to, just outside enough of any collider it touches, so as to not keep colliding anymore, should it still collide with the ground, if you don't move it downwards?
rich adder
# glad dagger how to do that

Ive set the VSCode shortcut to be the same as Visual Studio, but you can also right click it and "Format document"
if using vscode *

polar acorn
naive pawn
glad dagger
polar acorn
frail hawk
#

only the code of interest please Jager

naive pawn
rich adder
glad dagger
#

for the movement use

polar acorn
thorn crescent
naive pawn
#

isGrounded fulfills the role of the raycast

slender nymph
rich adder
#

regardless you still need Move every frame, wdym unnecessary

naive pawn
polar acorn
#

You're always moving towards the ground even when you're standing on something

rich adder
#

contrarians man..

thorn crescent
# polar acorn Gravity always exists

not with a character controller, if you need constant gravity, you use a rigid body. That's the whole purpose of character controller, to only apply gravity when it's needed, according to your needs, and not just full time calling Move just because you don't understand the documentation

thorn crescent
naive pawn
#

yes. gravity exists

glad dagger
#

i dont understand anything

rich adder
naive pawn
#

@thorn crescent consider a platform moving downwards.

slender nymph
eternal needle
naive pawn
#

you should be grounded the whole time

polar acorn
naive pawn
frail hawk
timber tide
#

really all that CC gives you is crappy capsule collision detection and the ability to walk up stairs

rich adder
glad dagger
eternal needle
timber tide
#

rb kinematic is superior in many ways

polar acorn
naive pawn
#

@glad dagger it seems the verticalvelocity > 0.01f may be the cause.

keep in mind that && is applied before ||

so if you can double jump, and you've jumped twice already, but your vertical velocity is <= 0.01 (falling), you don't return

thorn crescent
# naive pawn <@176891394575695874> consider a platform moving downwards.

Is all your floors constantly falling for you to apply a downwards force at all times? Is that really your argument? You should always apply a downwards force, because sometimes you might be on a moving platform, instead of checking if you're on one? Do you understand now what I meant by bad code?

naive pawn
polar acorn
thorn crescent
rich adder
thorn crescent
naive pawn
polar acorn
thorn crescent
naive pawn
#

yeah, ok

#

you have no idea what you're talking about

polar acorn
eternal needle
thorn crescent
naive pawn
#

you see 6 people telling you that your assumption is wrong and you conclude that every single one of us is wrong

#

that's wonderful

eternal needle
#

Its clear this is going nowhere. The one who should be learning thinks they're the one teaching

rich adder
timber tide
#

cc slope doesnt even work correctly

polar acorn
frail hawk
#

who uses a cc anyways

rich adder
timber tide
#

Run off a ramp with forward velocity and you will tumble down it

naive pawn
rich adder
thorn crescent
# polar acorn It's not. _You_ are the wrong one here. The system requires you use Move every f...

No, it doesn't after you touched the ground, you're grounded, because the character controller would never move you on it's own, only when you call it to. If you believe that you need to improperly move the character downwards, instead of only doing so when a raycast tells you that you left the ground, you clearly don't understand how the character controller works, and just because you've been using it wrong all this time, but "it works", doesn't mean that's how it should be used.

timber tide
#

Yeah, but then you're modifying it at that point, no?

naive pawn
timber tide
#

You can similarly just do RB with that logic

rich adder
eternal needle
#

In some cases

polar acorn
thorn crescent
glad dagger
polar acorn
rich adder
polar acorn
#

The idea of gravity

#

You can fail to implement gravity

#

But if you want gravity

#

You have to add it even when you're on something

thorn crescent
#

just because, you have the belief that, for some reason, gravity must exist at all times with a character controller, but somehow just at a .2f instead of it's full value, then you like to do things in the wrong way

rich adder
#

this is like a troll post at this point yes?

thorn crescent
naive pawn
polar acorn
polar acorn
eternal needle
thorn crescent
glad dagger
eternal needle
polar acorn
naive pawn
polar acorn
rich adder
glad dagger
naive pawn
thorn crescent
rich adder
#

is true simplemove applies gravity

thorn crescent
naive pawn
#

soooo are we going to see more strawman arguments

naive pawn
#

it's also in speed rather than delta position

silk night
glad dagger
naive pawn
#

have you tried just removing that bit of the condition then

thorn crescent
naive pawn
#

in general you should probably check if you can do something, rather than checking if you can't

rich adder
#

being a contrarian just to stir a reaction

timber tide
#

CC applies some cals when sliding such as going up ramps, but you don't necessarily need the downward force, but that would be included in the consideration.

polar acorn
naive pawn
# glad dagger no i havent

try it

also for stuff like this, you should generally check if you can do it, rather than if you can't

polar acorn
eternal needle
naive pawn
thorn crescent
polar acorn
#

It uses the Rigidbody gravity value

thorn crescent
#

Which means you misunderstand how the character controller works

polar acorn
thorn crescent
#

If it had constant downwards force, why would you need to apply it to?

timber tide
#

Anyway, let's end this discussion and just forget about CC because it's obsolete when you can just go onto the asset store and download the Kinematic Character Controller for free

naive pawn
#

Move gives more control

polar acorn
thorn crescent
naive pawn
#

yes, it's called FixedUpdate

#

it's called by unity

rich adder
polar acorn
#

By your own stupid fucking requirements we found the method. You lost

thorn crescent
thorn crescent
naive pawn
#

if you use SimpleMove, yes

#

you can easily test this

glad dagger
polar acorn
eternal needle
polar acorn
#

Especially considering the adjacency of the subjects

eternal needle
#

I dont even think they're trolling. I really think its just a reading comprehension issue

polar acorn
#

So let's all just let igneom scream it out in the void and focus on the actual problem

naive pawn
polar acorn
eternal needle
glad dagger
naive pawn
#

there's no time limit, you can take your time

#

but ultimately, it is a skill you need to practice

stiff plaza
#

i don't know which channel ist the correct one. but does someone has any idea why my material is shown black?? it's an imported asset and the developer donesn't know either.

glad dagger
naive pawn
#

definitely not a code issue

#

(make sure the asset supports your render pipeline)

timber tide
#

In a sense you do expect CC to have a lot of it fleshed out already, but it provides very little to rb that you couldn't write in few minutes top

manic stratus
#

can someone help me modify a gorilla tag map? i need help changing a few textures and moving/removing objects

naive pawn
timber tide
#

CC should have params for slopes, stairs, moving platforms, force relativity

#

instead you get some half-baked controller

stiff plaza
naive pawn
#

(though, choose one to post it in, don't crosspost)

hot wadi
#

I think CC is the best for prototyping. Nothing is perfect. U get a lot of options to create a controller on ur own. It’s only the matter of skill

stiff plaza
manic stratus
naive pawn
manic stratus
naive pawn
#

you're modifying assets from an existing game that you don't own, right?

manic stratus
#

not the actual game

#

i'm taking a download of the map from online and changing it for a scripted video

naive pawn
#

oh, "gorilla tag map" meant a map for gorilla tag?

manic stratus
#

ye its a download of the gorilla tag map so i can make it look corrupted not the actual game

naive pawn
#

are you modifying it in unity?

#

if you're using an external tool like blender or something, it'd fit better a server for that

#

also, please don't crosspost.

also,

#

!collab

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

manic stratus
#

what is crossposting

naive pawn
#

posting the same issue across multiple channels

manic stratus
#

why when i said "bruh" it got blocked

naive pawn
#

there is a message that says why

manic stratus
#

ik but why

fickle plume
naive pawn
# radiant void

anyways @manic stratus see above, in case you're trying to look for people to work on the project with you

manic stratus
naive pawn
#

you can ask about that stuff upfront, and ask in a single, relevant channel

#

that's also.. quite a generic question, perhaps google that

ivory bobcat
#

Normally you'd provide what you've tried and folks would add in on what you're perhaps mistaken on

manic stratus
#

i have no experience with unity

ivory bobcat
#

Else the way you've got it above feels more like a collaboration request

#

You'll still need to provide information on what you've got in front of you in fine detail and folks would hopefully direct you to some proper tutorial on how to accomplish your task. Else it's more of a service request (collaboration etc)

manic stratus
#

in front of me i have my monitor and i just downloaded a copy of the gorilla tag map

#

i want to edit the texture of the branches to make them look corrupted

rich adder
#

also no modding help

ivory bobcat
naive pawn
rich adder
#

gtag /roblox has top tier slop

manic stratus
#

i'm not changing the actual game

#

its something like this

#

at the 2 minute mark you can see what i'm trying to do

rich adder
#

I'm not watching watever slop that is. Also again wrong channel and is it even unity related 🤔

manic stratus
#

he used unity to change the textures

rich adder
#

to mod.. which again is against server rules

manic stratus
#

you know that right

slender nymph
#

you do know that modding literally means "modifying" and by a synonym for "modifying" a texture is "changing" a texture. this is literally modding. ask in the game's modding community

manic stratus
#

can you not do that in unity

slender nymph
#

this server is not to help you mod a game you are interested in. you can ask for help with that in the game's modding community. this server is to help develop your own games. the way these things work is wildly different

hot wadi
#

“Can” vs “allowed”

#

It’s clear

#

This is not even the channel to ask about texture

tender mirage
#

Is there a way to get the one shot audio gameobject so that it can be configured in the code?

#

i can imagine you would have to add a check to see if it still exists as well

slender nymph
#

use your own AudioSource object instead

tender mirage
#

Yeah, i've been feeling awkward about audioSources. I don't really want distance based sound for the most part.

ivory bobcat
#

Create an instance and you'll be able to continually configure it

tender mirage
#

in my current project atleast

tender mirage
slender nymph
#

(that's the same as my suggestion)

tender mirage
naive pawn
tender mirage
rocky canyon
#

if u walls cut out the navmesh it should walk around them..

naive pawn
rocky canyon
#

ohhh im blind

naive pawn
#

please don't crosspost

rocky canyon
#

is there some terminology to help me find some resources on headbob - weaponbob
ive done 1 dimension but not 2..

and i believe u can do the same sinewave type thing for both vert and lat movement.

#

i worked on it a bit yesterday but no good results.. ive found something about using the same code but having it be out of phase.. but the out of phase part is what i can't get working.. the tests i've tried always result in a perfectly straight diagonal movement

swift crag
abstract copper
glad dagger
#

why is unity easier then unreal

rich adder
glad dagger
rocky canyon
# swift crag e.g.

oh that makes more sense.. let me try to adapt my code real quick.. i shall return if i have issues || i'll probably be back, lol||

frail hawk
# glad dagger why is unity easier then unreal

maybe people compared c++ with c# and came to the conclusion that unity might be easier. however you got blueprint (visual scripting) in unreal which makes things a little bit easier than using c++

rocky canyon
# swift crag e.g.

i was never good at sin + cos stuff.. you're a saint 🧡 exactly what i needed

timber chasm
#

yalll ive some questions. im making a unity 3d story based game and have my models animations ready but how to i incorperate the story tho like ik the script (story line) but how should i code it

timber tide
#

By following tutorials and getting back to us when there's a code problem

timber chasm
timber tide
#

!learn

radiant voidBOT
tired python
#

aight, was able to implement moving them the deployed units.

#

quick question, does OnCollisionEnter2D work if i attach only box colliders onto the two different gameobjects which are colliding or is there something else i need to do

#

or do i have to use rigidbody2d along with it to make it happen, or is there a better way

grand snow
#

if that gameobject has a collider and rigidbody 2d it should fire the event

rocky canyon
tired python
#

would this be the optimal way to design this here? as in, use colliders and rigidbody to check

grand snow
#

that sounds fun to me

#

but the logic of pick up and drop thing here to remove it seems sensible

tired python
grand snow
#

best go read about rigidbody 2d and its settings

tired python
#

why does unity say that it works when objects only have the collider2d in here though

#

should've just gotten rid of /or it seems to me...

verbal dome
tired python
rocky canyon
#

thats not at all how it works..

#

they dont build airplanes that any-ole joe can fly.. u gotta learn first

verbal dome
long gulch
#

How does one configure/modify an existing JavaScript library to be utilized by Unity? I know Unity uses .jslib and .jspre, but I do not understand how I modify an existing JavaScript file to conform to those types.

tired python
#
using UnityEngine;

public class ColliderCollisionCheckScript : MonoBehaviour
{
    void OnCollisionEnter2D(Collision2D col)
    {
        Debug.Log("Collision detected.");
        Animator BlastAwayMUAHAHAHA = gameObject.GetComponent<Animator>();
        BlastAwayMUAHAHAHA.enabled = true;
        Destroy(col.gameObject);
    }
}

this is the script attached to toothless, it ain't detecting any collisions though...

#

said gameobjects which should be colliding

slender nymph
tired python
slender nymph
#

assuming both rd2ds are kinematic, then yes that is the problem

tired python
#

oh aight

tired python
# grand snow best go read about rigidbody 2d and its settings

i tried reading through the rigidbody2d and i don't see any mention of kinematic or static types, so i went to rigidbody documentation and only found this, which basically means that rigidbodies having kinematic type cannot be moved or rotated using unity physics otherwise, they won't be. i don't see any mention of static type though

slender nymph
#

you're looking at the 3d rigidbody documentation

grand snow
#

the functionality and docs differ a bit between the 3d and 2d versions

tired python
#

2d has nothing related to it though...

slender nymph
#

it's the body type

tired python
#

oh nvm

#

got it

slender nymph
#

gee, if only there were clickable links that could tell you more. since they don't exist i guess you're stuck

tired python
#

mb

#

also, it kinda gets stuck O_O

#
using UnityEngine;

public class ColliderCollisionCheckScript : MonoBehaviour
{
    private void Start()
    {
        Rigidbody2D rb = gameObject.GetComponent<Rigidbody2D>();
        rb.useFullKinematicContacts = true;
    }
    void OnCollisionEnter2D(Collision2D col)
    {
        Debug.Log("Collision detected.");
        Animator BlastAwayMUAHAHAHA = gameObject.GetComponent<Animator>();
        BlastAwayMUAHAHAHA.enabled = true;
        Destroy(col.gameObject);
    }
}
```this is toothless's current code
rocky canyon
#

if u destroy the collider gameobject what makes u think it'd happen again?

#

the collider is gone after that eh?

tired python
#

oh wait, toothless loses his collider after one collision or smth?

rocky canyon
#

Destroy(col.gameObject); <-- whatever this is

livid arch
tired python
rocky canyon
#

so.. you could still collider with other copies of the script yae.. b.c they have their own colliders.
but if u meant its not working repetitively its b/c it cant b/c u destroy it..

#

i think i misunderstood ur issue

tired python
#

i thought you thought that it was the prefab itself which was getting destroyed

#

it only plays once and then stops

#

oh wait nvm, i might be able to fix it

rocky canyon
tired python
#

then i misunderstood your statement, what were you asking then?

rocky canyon
#

make sure u deal with that warning u have there

rocky canyon
#

the collision is happening tho..

#

u dragged 3 things and 3 collisions happened

#

so maybe explain the actual problem/issue a bit better.. b/c its not very straightforward

tired python
#

i initially thought it was a problem with collision not being detected but later found out that that was not the case, that is what led to this confusion

rugged beacon
#

did you set the animation exit time to 0, reset the trigger or bool then play that trigger/bool again

tired python
#

just saying, it's read only, so if you think what you are saying is applicable to that, tell me

rugged beacon
#

the state

#

in animator

tired python
rugged beacon
#

the state man

#

not the animator component

tired python
#

i can't read it

#

neither can i set it because of that...i think

rugged beacon
#

the animator window

tired python
rugged beacon
#

no trigger? how did you play the aniamton

tired python
#

BlastAwayMUAHAHAHA.enabled = true;

rugged beacon
#

idk wth thats is but wild guess you jus

#

just reenable the animator component

rugged beacon
#

try use the parameter to play it

tired python
#

should i use trigger or bool

#

i will only call it once, so using bool might not work...

rugged beacon
#

trigger for one time thing

tired python
rugged beacon
#

you are missing alot, you have the paremeter on the transition? i can also see you didnt link it back to a emtpty state for it to exit the state to go back into it later

#

i think you wanna spend like 10min watch a animation tutorial fr

tired python
#

thing is, i do have one set up just like that, i was wondering whether it required a similar implementation or not cus it was read only in this case

tired python
#

another thing, somehow, whenever i ctrl + S, these changes that i made in animator get wiped out

#

toothless doesn't wanna be animated

rugged beacon
#

yea you put stuff in reverse now

rocky canyon
#

you're doing too much too early.. imho

rugged beacon
#

and the entry link to the animation mean it go into it immediate when spawn doesnt make sense here

tired python
rugged beacon
#

like i said you put in reverse rn the arrow going out have the paramter

#

means when trigger on its exit the anim

#

you should rewatch

tired python
#

oh sry, so entry->empty->trigger->loop->empty

#

right?

tired python
rugged beacon
#

when the game play you can see the animator in action

#

try to follow and debug the state flow

tired python
#

alright

rugged beacon
#

whats the warning there

tired python
#

that's weird cus i do have it attached else the objects wouldn't be destroyed on colliding

rugged beacon
#

thats sound very important idk man
also i can see warn about the animtion transtition herer

rocky canyon
#

the error was what i pointed out way up top ^

#

no clue why and what it is.. but def take care of those so u know its not a piece of the puzzle

tired python
tired python
rocky canyon
#

it appears to be an empty reference.. (like when u add a script to a gameobject and delete the script, but forget to remove the script from the object before you delete it)

tired python
rocky canyon
tired python
#

this sign is weird too

rocky canyon
#

scroll the inspector down. ands ee if theres anything beneath that sript

tired python
#

this is weird too

#

i removed the script and bro what

#

does this make sense or am i trippin honestly

rugged beacon
#

is this outside playmode?

tired python
#

yes

rugged beacon
#

why are you disableing the animator idk man

tired python
#

and now when i ctrl + s, guess what happens, the new states vanish bro what

rocky canyon
#

just the version of it in the scene..

#

click the arrow on the right of it to open the prefab and remove the broken script from that

#

i think the missing reference breaks it and doesn't allow you to apply the overrides from the scene..
probs have to do it within the prefab itself to make sure its all good

tired python
#

and guess what, the animation is working finally but there's still a major problem

#

if i ctrl + s while not playing the game, these new states are getting wiped out

tired python
#

ah shiii, it's too late about 5am here. @rocky canyon and @rugged beacon thx for the help.

solar hill
#

without updating the prefabs override

#

🤔

rocky canyon
rocky zephyr
#

Is there something wrong with my code? My player won’t move I’m legit doing the most basic code movement rn so absolutely nothing crazy : )

polar acorn
rocky zephyr
#

What?

slender nymph
#

Oh dear god don't code in notepad, wtf. Get a proper ide

#

!IDE 👇

radiant voidBOT
swift crag
wintry quarry
rocky zephyr
polar acorn
rocky zephyr
slender nymph
#

have you considered following the instructions for one of them in the conveniently linked guide

polar acorn
rocky zephyr
#

Oh okay sorry I’ll click and see how to install

slender nymph
#

also Visual Studio should have already been installed by the hub when you installed the editor unless you specifically went out of your way to prevent it from doing so

rocky zephyr
#

I just opened the program for the first time a week ago so everything should be in its place as a beginner download I hope

slender nymph
#

then just follow the guide for Visual Studio installed via the hub to get it configured

rocky canyon
nova gust
#

guys if anyone has the time and is willing to help me out, I kinda need a sniper elite like enemy script that includes, Post points (places where the enemy walks to to lookout for the player), player detection with suspicion and lowered detection if crouched... and shooting etc. thanks!

rocky zephyr
#

Ok guys I got the script working but now my player is only moving right and never left when I click both a and d

astral void
#

can you share the movement code?

#

I would imagine it's because you're either checking if D is pressed and that means you don't check for A, or you're checking for A, assigning the movement, and then checking for D and reassigning it

wintry quarry
rocky zephyr
#

I copied the code from official sources online so I’m not sure I’ll take a pic tho

wintry quarry
#

Do not take pictures of code

radiant voidBOT
wintry quarry
#

!code

radiant voidBOT
silk night
tulip basin
#

is it normal that when I typed "OnTriggerEnter" it didnt show suggestions?

radiant voidBOT
undone wave
#

I want my player character to take damage, but with a damage immunity period of 1 second.

Code:

    void Update()
    {
        if (invulnerable)
        {
            invulnerableTimer -= Time.deltaTime;
            if (invulnerableTimer <= 0)
            {
                invulnerable = false;
            }
        }
        else
        {
            invulnerableTimer = GlobalData.instance.invulnerableTime;
        }
        gameTime = Time.frameCount;
    }

    private void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Enemy")
        {
            if (invulnerable) return;
            Debug.Log("frame: " + gameTime.ToString() + ", invulnerable: " + invulnerable.ToString()); //debug
            invulnerable = true;
            if (playerHurt != null) playerHurt(this);
        }
    }```
#

Result:

#

Expected behavior: the if(invulnerable) return line and invulnerable = true prevents multiple playerHurt events from happening within a short amount of time

#

Observed behavior: as shown in the part in the red circle, invulnerable still seems to be treated as false 8 frames after a hit occurs

silk night
#

if you are hit right after invuln ends

undone wave
#

Did just that, and then did a few tests, and it seems to work, thanks!

nimble apex
#

anyone here actually using system.text.json libarary in their project instead of newtonsoft, and was building games for smartphones? i want to know if STJ really that unstable and dangerous if i migrate there

visual linden
nimble apex
nimble apex
#

this one , i suppose

visual linden
#

Any specific reason you'd want to use it over Newtonsoft Json?

nimble apex
#

a long time actually, so i think its time for me to do it now

#

if it doesnt really have compatibility issues i dont see the reason not to use it?

grand snow
#

I will say that unless you are dealing with massive json files i doubt there will be much difference perf wise

nimble apex
#

welp lets see

heady gulch
#

guys i have an issue when I hit a wall, my character gets pushed back a little when I turn the camera
is it because of character controller parameters or a controller script
its happnening not always
but sometimes

#

at the fifth second

torn storm
#

can someone help me im trying to use blend tree and its bugging and i cant fix it

torn storm
# heady gulch whats the problem

im trying to use blend tree for walking left anim at -1 speed, idle at 0 speed(i cant put 0 so its 0.01) and walking at 1 speed but the only anim that is using is walking and i alr checked if the speed is -1 and it is

heady gulch
torn storm
heady gulch
#

i mean dimensions

torn storm
#

2d like mario

torn storm
heady gulch
#

as i get u meant walking back

#

so maybe its issue with parametrs

torn storm
#
private void SetAnimation(float Move)
    {
        animator.SetFloat("Speed", Move);
        if (isGrounded){
            if (Move == -1){
                transform.localScale = new Vector3(-1, 1, 1); 
            }
            else if(Move == 1){
                transform.localScale = new Vector3(1, 1, 1);
                    
            }
        }      

        if (!isGrounded)
        {
            if (rb.velocity.y > 0.1f)
            {
                animator.Play("Falling");
            }
            else if (rb.velocity.y < 0.1f)
            {
                animator.Play("Jumping");
            }

            return;
        }

animations coding

heady gulch
#

i dont know much but

#

why u changed

#

the speed of animation

torn storm
#

i did?

heady gulch
#

maybe for 2d is different but as i know all animations should be at 1

torn storm
#

😭

heady gulch
#

speed

torn storm
#

oh

heady gulch
#

this is 3d

#

but anyways all animations

#

is at speed 1

#

maybe that's the solution

torn storm
#

oh

#

i will try that

heady gulch
#

I just dont understand why you changed the speed of animations

torn storm
#

when idk what to do i ask him

heady gulch
#

maybe it cause to reverse your animation and make you running left looks like running

#

right

#

try to put all playback speed(right column)

#

at 1

livid frigate
torn storm
# heady gulch at 1

the anim its working but now i cant rotate the body to left so dash always go to right

mint flicker
#

hey i was wondering how silk song made there players and enemy glow white like was it teh sprite changed or just added glow

sour fulcrum
#

bloom

mint flicker
#

how would i bloom it

#

as an example

sour fulcrum
#

i'd suggest googling bloom in 2d unity

mint flicker
#

will do

undone wave
#

Is there a way to detect if two 2D colliders touch, but not overlap? Using Collider2D.Overlap always returns a collider when the collider is in contact with another

#

i.e. is there a method to detect if two collider2D areas overlap, but not edges?

#

update: setting the collider's size to 0.99 doesn't work, while setting it to 0.98 made it work correctly

#

could this potentially be a problem (for example, miniscule differences in physics calculations making it inconsistent)

grand snow
#

Physics messages will tell you when they collide but perhaps that's not useful to you here?

naive pawn
spiral summit
#

I want them to automatically correct errors for every project I write, what utility do I need?

naive pawn
#

there's not really a tool for that

#

we can't read your mind, a tool even less
a mistake might be incorrectly written from a ton of things

spiral summit
#

I mean it will show a warning as soon as it is written wrong in any way

visual linden
#

Do you not already get red squigglies if you mistype something?

wind apex
#

How do I use visual scripting? I just found about it rn

spiral summit
radiant voidBOT
keen dew
ivory bobcat
charred monolith
#

Q: Is there a way, to get the cursors position any maybe freeze it?

wintry quarry
#

Cursor.lockState

old remnant
#

not sure if this is a correct section, but I am having some issue with NavMesh agent always hugging the edge of the NavMesh Surface and they end up getting stuck. Anyone know if there's a solution so they stay away from the edge and stay more close to the middle?

#

damn that gif export was pretty bad

slender nymph
old remnant
blissful yacht
#

Hi, question. which best: script movement or Root- motion?

blissful yacht
#

and,
what best plan/code to make, Animation doesn't interrupt each other especially you had idle, Walk, run, and attack

jagged hare
#

If you are using mecanim, you can set when and whether aninations will interrupt each other.

blissful yacht
eternal needle
blissful yacht
#

I see, I tried best on script.

#

Thank you

bronze drum
frail hawk
#

is your collider set to "isTrigger"

#

and does your Player have the Player tag

#

and you need two colliders, one for the door and one for the player and a rigidbody involved, other than that it looks ok to me

grand snow
#

It would be better to use an animator bool and 4 animations (opening, open, closing, closed)

frail hawk
#

use Debug.Logs to find out where the problem is.

grand snow
#

Or use just an open and closed state and let the transition do the "opening" and "closing"

frail hawk
#

inside the OnTrigger use Debug.Log("works");

bronze drum
#

here?

frail hawk
#

ye

bronze drum
#

Tthe line after this or where

#

sorry if am dumb cus i started 2 days ago

frail hawk
#

put it at the spot where you expect something to happen

#

oh wait i see the problem, the script is not on the door but on the player?

naive pawn
#

"create empty" is just a gameobject without any existing components. once you add stuff, it's no longer empty

frail hawk
#

put the script on the door

bronze drum
#

tf is this

frail hawk
#

and do not cross post please

bronze drum
#

i think am gonna give up

wooden warren
#

Im really lost on this chat, I use the same animator as the tutorial timmy bot does. I just changed the code. I can freely move (besides jump) at any direction I want. So the movement is fine, its just the animation of it, im guessing its the animator. So I dont know what to do lol, do I need to change the code again so it will suit the animator? or change it animator so it will suit the code? id appreciate all the help. (I can paste the code in dms if anything, its just 70 lines long)

wooden warren
#

bet

frail hawk
# bronze drum ok sorry

you are not following any instructions, please scroll up and read carefully what was suggested.

charred monolith
bronze drum
frail hawk
#

no, i dont wanna repeat it, just scroll up read carefully.

eager temple
#

Would anyone be willing to help me add proper local co op to my game? Im an extremely new dev and I know its a lot to ask but as of right now my game is still very simple and based on a tutorial. I added a few things to it myself and help of other tutorials but it would benifit so much from co op. I attempted to do it myself but came to realize I wont be able to without lots of help.

frail hawk
eager temple
#

Okay, I have a top down 2d waved based shooter I am working on. Currently you can walk around, shoot zombies and die. I would like to add in a drop in system that automaticly adds in another player when a new input device is used (Ex. a controller). I need the new player to have separate stats for everything like health, money, damage, fire rate, etc that I can modify using a shop system I plan to add later. I also need it to add a new UI for the new player that joins in so they can tell how much health and money they have.

#

Currently my code is based off of a tutorial on Youtube that I assume wrote the code I'm using to only work with single player so I probably have to re write or modify a few scripts (Or a lot)

balmy vortex
#

does anyone maybe know why my enemy spins around the player when they're close to them instead of trying to move straight through them like you'd expect?

frosty hound
#

Most likely because they're trying to stand on the same spot as the player, bumping into them, and then "steering" around in your handleRotationto try to face the player while simultaneously moving in their forward direction.

#

You probably want to give your enemies a point they can actually reach (adjacent to the player), and then increase their rotation/steering so that they don't "drift" past it if they're going fast.

wintry quarry
astral cedar
#

oh nevermind you got answered

gray narwhal
#

can somebody help me i cant figured out what to do

#

so i made a folder in my assets named scripts i opened the folder and the tutorial was watching the guy right clicks inside where is it says This folder is empty then he goes to create and makes a thing called a c# but for me when i do that there's ever thing in the create menu expect for c#

sour fulcrum
#

you literally asked this, got it answered and said thanks

gray narwhal
#

it ended up not working

frail hawk
#

which tutorial is that exactly

gray narwhal
#

i find the link rn

slender nymph
gray narwhal
#

i opened it and some of the text on his screen is different like he has 3 lines that say using Unity... but i only have two and when i type exactly what he dose his turns usually green while mine stays white

slender nymph
#

the template probably changed, that's not a big deal. as for the colors, you are probably using an unconfigured IDE

#

!IDE

frail hawk
#

the tutorials is 3 years old

radiant voidBOT
gray narwhal
#

so should i use a different tutorial

frail hawk
#

no

slender nymph
#

no, you should configure your IDE

frail hawk
#

i am watching your tut but nowhere in the video can i find where he adds "new c#" as you said

gray narwhal
#

its at about 7:20

slender nymph
#

it's at 7:24 where they select the "C# Script" option from the create menu which has just been renamed (and they were already informed about)

frail hawk
#

yep read the bot message on how to configure your IDE, this is a really important step, otherise you will miss a few functions such as auto code suggestions (intelisense)

charred monolith
wintry quarry
#

If it's locked you can't click on stuff anyway, right?

#

If you really need something else you can save the position before you lock it, then when you unlock it you can warp it back to that position

charred monolith
#

am using unity6

charred monolith
wintry quarry
charred monolith
livid frigate
#

"You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings" unity keeps telling me this. idk how to get around it should i change it? when i go to change it unity tells me it prefers i leave it alone for newer projects

#

and idk what the pros and cons of changing it are

teal viper
#

For future reference, I recommend checking the documentation and reading about the different input systems.

livid frigate
#

okay thank you

raw hawk
wintry quarry
#

Most likely the demo was made for BiRP and you're using URP, or HDRP. Something like that

#

Either way

#

this is not a code question

solar hill
raw hawk
hot wadi
meager gust
#

How is aim cone / aim spread typically done in a first person shooter?
I see a lot of posts saying to do Random.Insideunitcircle which returns a Vector2, which they add to the 3D forward vector, but that just doesn't sound right at all, given how 3d vectors work... you'll get funky behavior when looking at different axes of the world, no?

wintry quarry
spare saddle
#

How do I get over the boredom of learning how to code?

wintry quarry
#

You switch to a hobby that interests you? 😬

spare saddle
#

Its just watching tutorials that I find boring. I never written any of my own code before.

naive pawn
#

have you tried other tutorials?

#

sometimes some formats just don't work for different people

rocky whale
#

is there a way to make the camera pan to a sprite in game view

#

I was trying smthg and zoomed around to much and now I cant find it

patent vortex
naive pawn
#

would not recommend 2 at all. that just creates more work for you to fix broken shit in the future

#

also for 1, you still need to learn how to code

patent vortex
naive pawn
#

(in general) there's 3 major parts to programming:

  • Language - The syntax, structure, and paradigm of each language
  • Library - The interfaces and utilities that each environment or toolset provides
  • Logic - The algorithms to do work at runtime

Logic is almost completely transferrable between each language and environment, you just have to learn the specific Language and Library that you're using
Language is also shared quite a bit between languages

of course, learning 1 part at a time is easier than learning everything at once, which is why tools like scratch or code.org are popular as coding courses for beginners, especially kids, because it only focuses on the Logic aspect

hot wadi
spare saddle
naive pawn
#

!collab

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

naive pawn
#

there is that

#

otherwise it'd be various freelance sites

patent vortex
spare saddle
hot wadi
naive pawn
#

if you don't apply what you've learned, you'll eventually forget it. generally working/following along with tutorials will be more productive than just binging a playlist

fast fern
#

Hi, my console messages get stacked instead of sending individual messages (see the numbers on the right)
how do I change it back to like before

fast fern
torn storm
#

GUYS i really need help

#

i have a blend tree for walking and idle that is working but for any reason the game only play my falling animation non stop

torn storm
midnight plover
opal gorge
#

can someone help me please , i start unity today and im blocked with something in my scene

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

opal gorge
#

euh i don't understand

naive pawn
#

we can't help without more info about what the issue is

opal gorge
#

Ahhh, well basically I have a problem with my scene in Unity. I followed a tutorial to make a Raycasting system, but now I'm having an issue with the controls.
I made this script (which depends on another one):
using UnityEngine;

public class OpenChest : MonoBehaviour
{
[SerializeField] float internalDistance;
[SerializeField] bool chestOpen = false;
[SerializeField] GameObject chest;

void Update()
{
    internalDistance = Raycasting.distanceFromTarget;
    if (chestOpen == false && internalDistance < 2)
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            chestOpen = true;
            chest.GetComponent<Animator>().Play("DoorOpen");
        }
    }
}

}

But when I run it, I get this error:
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class,
but you have switched active Input handling to Input System package in Player Settings.
UnityEngine.Input.GetKeyDown (UnityEngine.KeyCode key)
OpenChest.Update () (at Assets/Scripts/OpenDoor.cs:14)

lavish maple
#

I am having some trouble with my custom UI , in particular my "UnitCards" are overlapping and not displaying in the correct location , anyone able to take a look at the setup briefly? much appreciated