#archived-code-general

1 messages ยท Page 265 of 1

dusk apex
#

You need to actually debug your code

opaque fox
#

wdym

#

i put it in debug mode

#

as u asked

potent jackal
#

Okay, but I don't know where it is trying to access it

dusk apex
#

I told you to debug the value of that variable.

opaque fox
#

oh like in vs

dusk apex
potent jackal
dusk apex
#

We don't know how you're handling null references

opaque fox
#

it showed me this

quartz folio
potent jackal
#

I double-clicked it, and it took me here:

gilded topaz
#

Does anyone else have the problem where you cant drag the stuff in the scene samples? Im new to unity so i dont know if its my fault

dusk apex
potent jackal
quartz folio
# potent jackal

That's not referring to your code, so it's not an issue with your code

potent jackal
quartz folio
#

Clear the error and move on with your life

opaque fox
quartz folio
dusk apex
#

You did not make that script so you aren't able to fix that error. It's a false positive btw. @potent jackal

potent jackal
dusk apex
#

It's a false positive...

potent jackal
ocean river
#

Hello there. I'd like to ask which naming conventions are the best for classes, filenames, variables, you get it.

quartz folio
ocean river
#

I seem to prefer GameMaker naming conventions, but i dont see anyone using them in unity at all

#

For example, should i name my stuff scrPlayerMovement objPlayer mapGround animRun etc?

cold parrot
#

That said, there are conventions in use for specific types of projects, but most are only used by a relatively small subset of developers

#

it very much depends on the projectโ€˜s architecture

quartz folio
#

What on earth is scr

ocean river
#

script

quartz folio
#

Write full words

lean sail
cold parrot
#

Common sense ends when it comes to code conventions

lean sail
#

As long as the individual or team understands that it's all about preference instead of maintainability and whatever other jargon managers use these days.

dusk apex
ocean river
#

both actually

cold parrot
#

Anyway, I believe whatever one uses, it should suit the framework/engine/workflow and architecture, copying a convention targeting a different toolchain is generally not helpful

ocean river
#

but ill just go with the official one i guess

latent latch
#

For interfaces you add an I in front such as: IActivate
Abstract classes people like to use a keyword like Base: BaseAbility
For data classes, I usually like to add Data as a keyword, but since scriptableobjects are a thing I usually tack on SO: ItemSO

quartz folio
#

I use a Behaviour suffix for MonoBehaviours, but that's generally picked up from doing ECS

ocean river
#

out of then millions of channels, where may i ask about rigidbody

quartz folio
knotty sun
#

!code

tawny elkBOT
heady garden
#

posted here to not crowd the beginner chat..

mellow sigil
#

log what it actually collides with

ocean river
#

I've been trying to find a good way to store dialogue text efficiently, without these weird ui extensions. Is it really good practice to have all my dialogue loaded from start, if i had a ton of text(Scriptable Object)?

young sage
#

I wanted to make an inventory that has inventoryslots and which can have different content of different classes. I made a generic approach but find it a bad approach because a InventorySlot depends on other Monobehaviours. I have to create many classes which have to be derived with its type in order to put them in a gameobject. Because of that i end up having multiple empty classes.

Another idea would be to use interfaces instead. Any other idea?

{
    private SlotUI<T> slotUI;
    private T content;
latent latch
#

I've tried that approach but eventually ran into a lot more issues. If you're only going to have a handful of types (weapons/armor/items/skill) I'd suggest just do comparisons

#

can have a single slot class, and then use managers to decide what can go into them.

#

HotbarManager, InventoryManager, EquipManager

#

oh yeah and you'd want a single type that all of these contents derive from

#

you can also implement behaviours at the base level like Use() where you don't need the know the type

#

unless there's targeting specifics, then you'd have to check for that

lunar python
#

you can use interfaces like public interface Item instead

young sage
#

I already do that. With my question i meant how content from InventorySlot can hold different e.g. Controllers. I have an Inventory for Items and Inventory for collected Mobs. One has a ItemController and the other a MobController. Now with my Generic approach its very annoying that I have to derive from InventorySlot and create one for Item and Mobs which are empty in order to use them in Gameobjects. I think I will use Interfaces instead and Cast them to the needed objects.

lunar python
#

ye interfaces are better

#

you can extend multiple intefaces

latent latch
#

my issue with generic slots is I eventually ran into a case where I needed to use covariance

#

which turned into me having to use interfaces anyway

lunar python
#

i thought we could cast base classes to derived class if we want

latent latch
#

you can, and that's my implementation of it up there

#

pass stuff around as the base type, but check for a more derived version when inserting into other slots

molten isle
latent latch
#

if you're using chatgpt here I'm not going to debug it for ya.

#

otherwise tell me the exact methods that you're having trouble with and what you expect them to do

molten isle
glossy wave
#

why is my navmeshagent not moving smoothly? i'm using the new navmesh
Edit: the problem appears to be in my enemy, i added a navmeshagent on a capsule and it's not laggy
Edit: the problem was caused by a RigidBody component

ruby elk
#

is there any way to know if an object is being destroyed? checking if null still returns the object if done after the destroy call was made but before the end of the update loop

ruby elk
#

(contributor is a reference to a component on the gameobject that just got destroyed)

knotty sun
#

try contributor.gameObject == null. That should work

ruby elk
#

will do, thanks

brittle haven
#

a and b are arrays. When I do 'a = b' and make a change in b with the code, the same change happens in a. When I make a change in b with the code, I do not want the change to be in a as well. How can I fix this?

knotty sun
#

you need to make a copy not a reference

ocean river
#

I've got another one. Can i read only a few lines of a json file, without loading the entire json into memory just to get these few lines?

#

Unity3D

ocean river
#

So im back at the question what the most efficient dialogue system is then

knotty sun
#

database

ocean river
#

ah

mellow sigil
#

Your game won't have that much dialogue that reading it all into memory would be a problem

ruby elk
#

I'm under the impression unity actually delays destroying objects for real when not using destroyimmediate but it's also not recommended

knotty sun
#

that's odd because the equality operator is specifically overriden to include an object pending destruction test

ruby elk
#

I saw a post about that but it's from 2014 so maybe that's not the case anymore?

#

I can always manually set a bool on the object to "pendingDestruction" on disable or something but if there's a cleaner way that'd be nice

knotty sun
#

which is why gameObject? and gameObject == will return different things

ruby elk
#

does gameObject? return the "correct" unmodified result of a null check? as in without unity's additional test

knotty sun
#

? is the pure c# method. So gameobject exists in C# so will return not null

#

even if marked as destroyed in Unity

ruby elk
#

ah

knotty sun
#

if == null is not returning correctly for you then I suspect that your Destroy is incorrect

ruby elk
#

also I just saw onDisable/Destroy are only ever called at the end of the frame so the component can't even manage that itself

knotty sun
#

oviously contributor cannot check itself for null, that would make no sense

ruby elk
knotty sun
#

have you debugged it? is destroy being callled?

ruby elk
ruby elk
#

destroy is called, the null check still passes, then next frame I immediately get an error from another component that previously referenced it, and wouldn't have if the null check worked

#

maybe the check would work if it was from another update call entirely (ie another component's update, still in the same frame but executed after the one that led to RemoveShape) & it's like some uncovered edge case

knotty sun
#

are you sure the onShapeListUpdated is being called because that is a silent fail

ruby elk
#

yes, I modified the null check to print with the object name if not null, hold on

#

& then on the next frame

knotty sun
# ruby elk

that still doesnt prove that onShapeListUpdated is actually called

ruby elk
#

that 2nd function is called by a function subscribed to onShapeListUpdated

#

didn't include it in the screenshot but that "on shape list updated editor" print is right after the other 2

knotty sun
#

so is contributor from the first method the same as _selectedContributor from the last?

ruby elk
#

yup

knotty sun
#

sure?. debug it

ruby elk
#

there's no other gameobject with that name

knotty sun
#

debug.log the GetInstanceID from both objects

ruby elk
#

okay

#

maybe getting the gameobject through the component instead of already holding a direct ref to the gameobject screws with the check?

#

would be nice if there was just a pendingDestruction bool or something else that's more explicit in general

golden trout
#

Does anyone know what the problem here could be?
I have a OnCollisionStay void but it never gets triggered. I tried it with rigidbody hits rigidbody, and also rigidbody hits non rigidbody collider

knotty sun
ruby elk
#

I'm trying to get the gameobject in a variable then check the variable instead rn

knotty sun
ruby elk
#

didn't work either
one last thing is that the function calling removeshape is called from a ContextMenu function
maybe this also screws with the check indirectly because of "out of game loop" jank?

heady iris
#

OnCollisionStay is not "a void"

knotty sun
heady iris
ruby elk
tawdry jasper
#

I want to cleanup my spaghetti code a little: currently on my player class I have a "Throwing" monobehaviour which if the player has a throwable object picked up handles the input and animates the player to throw the object. It also handles the animations and inputs for melee actions AND the animations and actions for when the player is empty handed.
Can anyone suggest how to structure my player code? should the various interactions be separate monobehaviours? should they be enabled / disabled based on what the picked up (in hand) item supports? maybe the item should add a component to the player? or the item itself should get a reference to the input and player animator?
I feel so lost in unity in situations like that and I fear there's some expected layout I should follow to get the most out of unity.

ruby elk
#

and later down the line have a dedicated action for shape removal
still weird

knotty sun
ruby elk
#

all good

knotty sun
ruby elk
#

2023.2.5f1

knotty sun
#

ah, 2023, I might have guessed, not a good choice

ruby elk
#

unstable?

knotty sun
#

very

ruby elk
#

ah shame

#

I upgraded for some new UI toolkit stuff iirc

knotty sun
#

whats new in UIToolkit that is not in 2022 LTS?

ruby elk
#

I don't remember it's been a while

#

actually might've been because the gif recorder package thingy wasn't working
regardless this project's nearly done anyway I'm not gonna bother rolling back versions

knotty sun
#

I dont remember reading anything that made me think, 'Oh, this is worth enduring the pain'

ruby elk
#

I didn't know pain would be involved

knotty sun
#

with Unity, Always!

ruby elk
#

with most game dev software over the past 5 years in general it'd seem

knotty sun
#

even their early LTS releases are crap, none LTS, forget it

heady iris
#

LTS means that they'll support it for a long time

#

it doesn't mean it'll work right (:

knotty sun
#

It means Unity thinks it will work right

#

but wtf do they know?

#

they never test anything anyway

ruby elk
#

adopting the widespread industry practice of pretending QA doesn't exist

knotty sun
#

nah, DevOps and Unit Testing, the bane of my life

gusty vessel
#

Does anyone know a simple Enemy and Damage/health script for a simple horror game really right now i just need a bean to kill my player

#

tried google

#

no help

somber nacelle
#

i doubt that. there are probably hundreds of tutorials for collision detection/damage/whatever

gusty vessel
#

about the 20 ive tried dont work

ruby elk
#

ok the manual pendingDestroy bool is currently good enough

ruby elk
gusty vessel
#

mhm

somber nacelle
#

in what way do they not work

knotty sun
tawny elkBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

somber nacelle
#

and if you truly have done 20 tutorials for it, then surely by now you'd have some inkling of how to actually accomplish what you want

knotty sun
#

nah, copy/paste

gusty vessel
somber nacelle
ruby elk
#

if you have time to copy paste 20 different scripts you probably have time to read through the code of just 1

gusty vessel
#

i have

somber nacelle
#

link me literally any tutorial on the subject that doesn't work

heady iris
#

it sounds like you've just blindly copy-pasted random code and given up the moment it didn't do exactly what you wanted

#

this attitude will not serve you well

ruby elk
#

yeah google code isn't ever going to just work on its own, especially when you don't yet understand what it needs to work

soft shard
# tawdry jasper I want to cleanup my spaghetti code a little: currently on my player class I hav...

You could try looking into state machines, its often used for simple AI but can also be used for managing player logic too, one advice I was given a while back as well is that it can help to pass references to the objects you need, a regular class that doesnt derive from MonoBehaviour or anything, can be serialized and show up in the inspector to set references, that as well, could be a base class for similar "states" or its own independent/unique state - your player controller mono behavior can then manage all those states and add/remove them as needed, if those states are things that exist in the world (such as shooting weapons only if you have a weapon "in hand"), that weapon itself can be a mono and referenced in your player controller, or you can make a "input manager" you attach to your player object that can sub/unsub the weapon - this way if you have 2 weapons in your scene for example, the weapon itself just handles "shooting" but no input, since both weapons would always shoot otherwise

knotty sun
ruby elk
#

you can only brute force your way out of having to learn programming for so long

heady iris
#

I was working on a system yesterday that batches up raycast requests and runs a big raycast command as a job, then distributes the results on the next frame

What a fool I was for not simply clicking the "Make game faster" button

knotty sun
heady iris
#

i did that by turning off the camera

ruby elk
#

just have chat gpt optimize the code lmao

#

what could go wrong

knotty sun
heady iris
knotty sun
fallow obsidian
#

what's the proper way to add nuget packages to my unity project? Hmm
I've tried dotnet add MyProject.csproj package PackageName but it seems like every time I restart unity, the manifest.json file no longer holds a reference to the package or maybe it happens when i restart my pc; I haven't tested the exact cause.

somber nacelle
#

unity projects do not officially support nuget yet.
you'd typically use something like NuGetForUnity or UnityNuGet
i personally use the latter since it's just right in the package manager rather than a separate window

fallow obsidian
#

thank you comfy

#

hmm UnityNuGet doesnt seem to have the package i wanted wah

heady iris
#

i will check that out

ruby elk
#

is there some kind of existing system for pausing the game in unity now or do you still have to have some bool/callback somewhere that all your game systems check/react to for pausing/unpausing & that you have to manage yourself

#

reducing time scale won't be enough for my needs

somber nacelle
#

nothing built in, but it's fairly trivial to create your own PauseManager class with an event that is invoked when you pause/unpause so other objects can react to it

ruby elk
#

thank you

swift falcon
#

Say I want to make a card deck which has 2 features:
Shuffling all the cards in it
Taking a card out

What's the best data structure for this? Is it just a list?

shut kestrel
#

How do i make any gameobject instantiated from default tiles to save changes made to them during edit mode? I am able to instantiate gameobject using tiles in the tilemap and rotate them using "GetInstantiatedObject(position)" but when i go into play mode those changes are neglected, i think it is because it re-instatiates the gameobject and thus removes any changes made to it. I though of instantiating them using the prefab itself but i heard that it would be less performant, especially when dealing with a large amount of gameobjects which is the case.

leaden ice
#

the most efficient way is to treat the last element as the "top" of the deck

gusty vessel
#

anyone know why my Enemy AI floats when chasing my Player ๐Ÿ’€

spring creek
#

How do you move the enemy?

gusty vessel
#

just a simple chase and kill script and when im in the distance to start the chase he floats and chases me

spring creek
#

Just show the !code

tawny elkBOT
gusty vessel
gusty vessel
spring creek
#

That is not how to share code

tawny elkBOT
gusty vessel
#

im confused on how to do that i have it in a hastebin thing

#

need nitro to post the actual code

#
https://hastebin.com/share/uruvoticap.csharp
leaden ice
#

You just have to post the link lol

leaden ice
# gusty vessel ```cs https://hastebin.com/share/uruvoticap.csharp ```

Your enemy is probably floating because it has a different y position than your player does. So when you do this:

            Vector3 direction = (player.position - transform.position).normalized;

            // move the enemy towards the player
            transform.position += direction * moveSpeed * Time.deltaTime;```
it's moving up towards your player's y position
#

what you want to do is project your direction on the x/z plane so there's no vertical motion:

Vector3 direction = player.position - transform.position;
direction = Vector3.ProjectOnPlane(direction, Vector3.up).normalized;

// move the enemy towards the player
transform.position += direction * moveSpeed * Time.deltaTime;```
gusty vessel
leaden ice
#

Use your brain

spring creek
gusty vessel
#

soooooo am i slow orrrr

#

cause he aint movin and im getting thousands of errors

spring creek
#

Your !ide is not configured

tawny elkBOT
gusty vessel
#

k i did all that jittery joo jah

leaden ice
gusty vessel
#

might be blind

leaden ice
#

if your previous code worked, this code should work too

#

I don't see any errors there

gusty vessel
leaden ice
#

and has nothing to do with the code I shared with you

#

do what it says

gusty vessel
#

ah wrong one lmao

#

yea that one

leaden ice
#

yes, it says exactly what's wrong and how to fix it

#

read it, do what it says

gusty vessel
leaden ice
#

You have another copy of this script in your scene somewhere

#

on that other copy, the variable is not assigned

gusty vessel
#

yup im official slow in the head

#

now he just goes inside my player and does nothing besides follow

leaden ice
#

What do you expect him to do and why?

gusty vessel
#

kill my player

leaden ice
#

And do you have any code that should make that happen?

gusty vessel
#

yea its in the same code

leaden ice
#

So start debugging

#
        if (distance < deathRange)
        {
            // loads the active scene
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }```
#

Add logs here

#

make sure this is actually running and it's actually going inside the if statement

#

And that deathRange and distance are what you expect

gusty vessel
#

thank you alot sorry for my low capability in the brain its all working now lmao thanks alot

ruby elk
#

you should probably go over some programming fundamentals

#

unity has some official tutorials on that iirc

zenith estuary
#

made a big mesh, gives me very low fps, is there a better way to do this

leaden ice
#

make a gravity well thing?

zenith estuary
leaden ice
#

Is it the rendering that is giving you low FPS, or are you running code that's modifying the mesh that's giving you bad FPS?

#

If it's the latter, just use a vertex shader instead of modifying the mesh in CPU land

zenith estuary
#

its fine until the objects go onto the mesh

leaden ice
#

yep, you need shaders my friend

#

this is a perfect job for a vertex shader

zenith estuary
#

idk how to do it ๐Ÿง

leaden ice
#

possibly a compute shader too. Not sure how i'd do it exactly

leaden ice
zenith estuary
#

is there a tutorial somewhere on vertex shaders cause I couldn't find one that was similar to what i was doing

vagrant blade
#

Any tutorial on how to make water would be a good start.

zenith estuary
#

ok

knotty sun
#

why are you cross-posting?

daring orbit
#

Sorry

daring orbit
#

can u help me ?

simple egret
#

Don't ping specific people for help

daring orbit
#

Oh ok

#

can u help me?

simple egret
daring orbit
#

Can u help me though?

simple egret
#

No, I never used DOTS

daring orbit
#

Oh...

simple egret
#

Hence why you got redirected elsewhere in the first place...

daring orbit
#

Ok

#

Do u know someone who might know more about it ?

simple egret
#

No

#

Wait for an answer in the dots channel

wintry bridge
#

print("๐ŸŽ ");

daring orbit
#

Ok no problem
Still thanks though ๐Ÿ™‚

bleak palm
#

How would I go about extracting the text from a TextMeshPro text object?

vagrant blade
#

You use the .text property

latent latch
#

Buncha method calls in the docs here

earnest peak
#

What channel is the best to ask about Unity.Spline Package ?

rigid island
earnest peak
bleak palm
fair blaze
#

Hey, idk if this is the right place to ask but I accidentally renamed one of my scripts to "Random" and one of my other scripts was using UnityEngine's Random.Range so it was trying to get the Range from my own Random script and throwing an error. After renaming it to RandomText the error still persists, is there a fix to this?

#

Damn i should probably try restarting before asking here

#

Nope that didn't fix it, any suggestions?

knotty sun
#

did you rename the script and the class name?

lean sail
fair blaze
#

that fixed it

#

That's enough brain usage for today

rigid island
foggy dust
#

If I have a script to place an object to my cursor and a script when I click on an object to open a panel.

How can I get rid of the situation to open the panel when I place the object?

latent latch
foggy dust
#

that just creates more issues actually, i solved it in the meantime by placing the object with mousebuttonup and open it with down

knotty sun
molten isle
#

i didnt know where to post this, is there any way to get rid of this error without messing up my colors?

somber nacelle
#

also not a code question

molten isle
# rigid island did you read the message

yeah, I just switched to gamma and everything looks fine anyways, i was just getting scared cuz once i did this and messed up all of my mats and i have to give this project in 30 mins

molten isle
rigid island
#

if you want Linear as it says you have to remove the WEBAPI 1.0

empty moss
#

how do i reduce gc spikes

#

i already have incremental gc on

leaden ice
empty moss
#

how do i see where msot memory is being alloctaed in profielr

leaden ice
#

The profiler has a whole column for GC allocation

knotty sun
empty moss
#

ok

idle flax
#

Hey everyone, I'm currently implementing an inventory system which will house a lot of different item types.
Right now I have all the different item types defined with bools on a single ScriptableObject class, however I don't think this is sustainable as the class will get bloated very fast. I don't think it's sustainable to create a ScriptableObject class for each Item Type either, as that will get bloated quickly as well. So my question is, is there a better way to do this? Thanks in advance.

public class ItemSO : ScriptableObject
{
    [Dropdown("typeValues")]
    public string type;
    private List<string> typeValues { get { return new List<string>() { "Default", "Head", "Chest", "Hand", "Foot", "Pants" }; } }
    public Color color = Color.white;
    public Vector2 size;
    public Sprite image;
    public string displayname;
    [Space(10)]
    public float durability = -1;
    [Space(30)]
    public bool isEquipment;
    [EnableIf("isEquipment")] public float defencePoints;
    [EnableIf("isEquipment")] public float speedPoints;
    
    [Space(10)]
    [EnableIf("isEquipment")] public bool isBackpack;
    [EnableIf("isBackpack")] public Vector2 backpackSize = new Vector2(0, 0);

    [Space(10)]
    public bool isGun;
    [EnableIf("isGun")] public bool needsClip;
    [EnableIf("isGun")] public int maxAmmo;
    [EnableIf("isGun")] public float damage;
    [EnableIf("isGun")] public float range;
    [EnableIf("isGun")] public float spread;
    [EnableIf("isGun")] public int bulletsPerShot;

}
latent latch
#

extending from ItemSO

#

Even gun here can extend from it

idle flax
#

Yeah that was what I was thinking, but I'm afraid I'll end up with a lot of different so classes

latent latch
#

well, the enums will cut down a lot of classes if they are of same behavior and data

leaden ice
#

^ quick and dirty example - though I usually go with an enum for the attribute name instead of a string, but this is a quick and dirty way to start.

#

With a small custom PropertyDrawer for the value type selector it's quite easy to make things in the inspector with this

idle flax
leaden ice
#

for fast lookups

idle flax
#

Ah all right. Thanks man

pulsar plaza
#

anyone know how to go from an index (ex: table item 9) to a point on an array? (ex, 9th item on array is 3,3)

#

but you can just subtract then add 1 to a c# method

#

also this is given we know the max x and y size of the array

somber nacelle
#

note that in c#, which this question better be about considering this is a unity server, lists and arrays start at index 0

pulsar plaza
#

yeah I can translate it

somber nacelle
#

wdym you can translate it? if your question is about lua, go ask in a lua server

pulsar plaza
#

I think I got the x bit

somber nacelle
#

there is no offtopic here and this is a unity server which uses c#

pulsar plaza
#

alr ill go to a lua server

#

nvm i got it alone

wicked moth
#

Hello,

I'm having trouble with storing a reference to my instantiated player, I'm trying to avoid using a singleton. I think it would be cool to store the playerInstance in a scriptable object, but I'm having trouble getting it working. I'm not sure if it's even possible.

I have a scriptable object that has this:

public class PlayerData : ScriptableObject
{
    public GameObject playerInstance;
}

Then in my GameManager I have this method that is actually a message from the "PlayerInputManager" that comes with the new input system.
This spawns the player and attempts to assign it, but I get "Type Mismatch".

Alternatively, if this is just a bad approach and I should look into another solution, any suggestions would be appreciated.

    public PlayerData playerData;

    void OnPlayerJoined(PlayerInput playerInput)
    {
        if (playerInstance == null)
        {
            // This is what I had previously
            //playerInstance = playerInput.gameObject;

            // Trying to assign the instantiated player to the scriptable object
            playerData.playerInstance = playerInput.gameObject;

            playerData.playerInstance.GetComponent<Player>().PlayerIndex = 1;

            OnPlayerJoin.Invoke();
        }
    }
rigid island
#

now every script you want ref to player needs an extra field with SO

wicked moth
#

@rigid island I'm hoping to reduce the amount of dependencies I have for this game

cold parrot
wicked moth
#

I'm cool with having a singleton if it provides a solution, I'm more curious to know if this is the best way to approach this

#

@Anikki Oh, I didn't think that was the case, but thank you for the feedback, would you suggest just using a singleton in this case?

Or is there another solution?

cold parrot
distant rune
#

Hi, I'm having issues with a bobbing animation looping correctly. I have a script that makes the object follow the curve as shown here. Both endpoints of the curve are set to Free Smooth, Flat, and they are set to Loop. The SFlag object here moves up and down, but once it comes back up another time, it rebounds too early. Anyone know how to fix this? (The assets here are for a sample project)

wicked moth
cold parrot
# wicked moth I will look into this, thank you

Mind that service locators are still an anti-pattern (in large projects), but its a necessary evil if you want to avoid the boilerplate diarrhea of all-out dependency injection (which is very tedious/hard to teach to a team).

distant rune
merry stream
#

how can I give every scriptable object of a type that I make have a unique guid?

cold parrot
#

Parse it from that string field in a get-property

merry stream
#

can u elaborate

cold parrot
#

make a field public string guid;, write a guid into that with a custom inspector or context menu action that has a button to generate a new one.

merry stream
#

and it wont get randomly reset?

cold parrot
#

Thatโ€™s what the button is for

quaint rock
#

if they are assets i would just tie the logic that generates the guid into the creation logic

#

if its runtime instances would make to make sure you generate a new guid as you instance it

merry stream
#

im using it to give each of my scriptable object items a unique ID

cold parrot
merry stream
#

could u assign it in a constructor or do scriptable objects not work like that

quaint rock
#

no constructor

#

if you needed something like one would just call a method after creating one manually

#

they do get stuff like OnEnable but chances are it does not invoke wehn you want it too

merry stream
#

so when you make a scriptable object it doesnt call the constructor?

#

i feel like constructors are rarely used in unity

quaint rock
#

its because most UnityEngine.Object derived thigns are not made in the C# side of the engine

#

its constructed by the engine for you, then you are given the instance wrapped the C# UnityEngine.Object derived thing

merry stream
#

makes sense

quaint rock
#

also gets weird when you think about it like say for a compoennt when would you expect the constructor to execute

#

since you add it via the editor ui, its not like you can call it yourself with correct args

#

also not everything needs to be a SO or MB, you can have just regular C# classes for what ever uses

merry stream
#

yeah of course, but most things are either SO's or MBs

#

i guess your mindset just has to change a bit with unity c# vs normal c#

quaint rock
#

really depends on what you are making

#

at work the projects i am on have a hell of a lot of non SO or MB type structs and classes

merry stream
#

i guess it just depends on the complexity

quaint rock
#

lot of them are just containers for data, but some of them are just other systems that i create on awake on mb's

gusty vessel
#

anyone have a HeadBob script none of mine seem to work

spring creek
merry stream
#

Is it better to use static functions to make a globally accessable script or make a "new" instance of it in a script to use

spring creek
rigid moon
#

hi i wonder if the UNITY_STANDALONE symbol complies for webgl also

ruby nacelle
#

Ability Instantiation Bug: Returning Null

cosmic rain
rigid moon
#

yea idk either because i can't find the UNITY_WEBGL symbol

rigid moon
#

i tried to find the symbol on my ide

#

it only showing one for standalone

cosmic rain
#

I don't think it's defined anywhere accessible from your project, so ofc you wouldn't find it.

cosmic rain
nova shale
#

I've looked around the docs and aroung the internet but i'm mostly finding outdate or not relevant advice.

I have a ui for selecting towers to place and i use a raycast to find the position in the world to place them, i don't want this place logic to fire when the mouse is over the ui because you can't tell where you're placing an object, but i have not found a good solution to know globally if the mouse is over a piece of ui

ashen jasper
#

I do wanna ask here but does unity not use visibility changes during runtime. Iโ€™m seeing not that many documents on it and seems I need to call the mesh I need to disable. If anyone can check or know about how visibility works in unity

nova shale
#

It is

cosmic rain
cosmic rain
nova shale
#

Itโ€™s missing documentation which is weird

cosmic rain
#

It is in the ugui package documentation

blazing smelt
#

alright so I have a system that generates a NavMesh path using NavMesh.CalculatePath(), as a way to cheat sound reverberating around corners (for my FPS enemies to respond to sounds). Problem is, the paths always return invalid, even though (a) I have the check set to all areas, and (b) the regular enemy AI pathfinding (which also uses Unity's NavMesh system) works fine.
Any idea what else I should be checking for when troubleshooting this?

ashen jasper
#

This is what is supposed to look like

#

This is when its being run in the game

cosmic rain
ashen jasper
#

I already tried all animation visibility types

ashen jasper
rigid island
# nova shale I read thatโ€™s deprecated

works perfectly fine no its not , even with new input system

 void Update()
 {
     if (inputz.actions["Fire"].WasReleasedThisFrame())
     {
         Debug.Log("Fire pressed");
         if (EventSystem.current.IsPointerOverGameObject())
         {
             Debug.Log("Clicked on the UI");
         }
     }
 }```
hexed pecan
blazing smelt
#

thanks though

rocky lodge
#
    private float thicknessOffset = 2f; // Offset between layers

    void Start()
    {
        // Get the original sprite's position and z value
        Vector3 originalPosition = transform.position;
        float originalZ = originalPosition.z;

        // Create thickness layers
        for (int i = 1; i <= thicknessLayers; i++)
        {
            // Calculate the new position with the offset
            Vector3 newPosition = originalPosition;
            newPosition.z = originalZ - (thicknessOffset * -i);

            // Instantiate a copy of the sprite at the new position
            GameObject newSprite = Instantiate(gameObject, newPosition, Quaternion.identity);
            newSprite.transform.SetParent(transform.parent); // Set parent to maintain hierarchy

            // Remove the AddSpriteThickness script from the new GameObject
            Destroy(newSprite.GetComponent<AddSpriteThickness>());
        }
    }```
#

why does doing
newSprite.transform.SetParent(this.transform) or
GameObject newSprite = Instantiate(gameObject, newPosition, transform.rotation, transform);
freeze editor?

#

๐Ÿฅฒ

cosmic rain
#

Probably recursive instantiation?

fervent furnace
#
GameObject newSprite = Instantiate(gameObject, newPosition, transform.rotation, transform);
```what this gameobject do after instantiated
rocky lodge
#

nothing because I destroy the script

#

the script is assigned to a sprite, start, makes copies of itself while destroying the script so it doesn't loop

fervent furnace
#

but your editor freezes

rocky lodge
#

yes

#

only when

fervent furnace
#

that means your code is doing thing

west lotus
#

Insatiate gameObject will also copy the script

#

You are looping

fervent furnace
#

so your destroy is useless

rocky lodge
#

the code works, but I'm trying to change parent to actual parent not parent of parent

#

as in, have the copies be child of the original sprite

#

it loops 100% because memory goes brrr but I don't understand how that happens only when trying to assign the original sprite as parent of all its copies, better said have the copies be child of the original sprite

west lotus
#

Instantiate(gameObject) will make a copy with the script that calls Instantiate in its Start

#

Destroy runs with a frame delay so its start is also being called

rocky lodge
#

idk if intended but it does destroy it before start

fervent furnace
#

i am not sure whether start will run immediately right after instantiate
but i know destroy() are queried

cosmic rain
#

Anyways, trying to fix a recursive bug like that by destroying the script is a terrible idea.

rocky lodge
#

right

#

I will try a workaround but I just don't understand how the code just works until I simply change the parent thing

cosmic rain
#

It's probably just a timing coincidence.

rocky lodge
#

thank you

cosmic rain
#

You could probably figure it out if you debug it properly.

rocky lodge
#

super beginner sorry, I know the destroy thing is terrible, just wanted to know why would it work in one scenario but not the other

cosmic rain
rocky lodge
# cosmic rain Well, it's not entirely clear what you're doing to reproduce the issue to be hon...

unsure if it is a timing thing, tried this workaround now and it loops

{
    private int thicknessLayers = 50; // Number of layers to create for thickness
    private float thicknessOffset = 2f; // Offset between layers

    public GameObject parentObject;

    void Start()
    {
        // Get the original sprite's position and z value
        Vector3 originalPosition = parentObject.transform.position;
        float originalZ = originalPosition.z;

        // Create thickness layers
        for (int i = 1; i <= thicknessLayers; i++)
        {
            // Calculate the new position with the offset
            Vector3 newPosition = originalPosition;
            newPosition.z = originalZ - (thicknessOffset * -i);
            // Instantiate a copy of the sprite at the new position
            GameObject newSprite = Instantiate(parentObject, newPosition, parentObject.transform.rotation, parentObject.transform);
        }
    }
}
#

I assign it to an empty GameObject

#

parentObject being the GameObject I want to copy paste to make the illusion of volume. It is a 2d sprite.

cosmic rain
rocky lodge
#

but this is not the case? this script is assigned to a different GameObject

#

empty one

#

it instantiates parentObject which is a GameObject assigned via editor

cosmic rain
#

Is it a child of the parentObject that you reference?

rocky lodge
#

nope

echo saddle
#

Hello everyone, I'm having an issue with a script I wrote to change the skins of my characters in Netcode. Where can I ask my question?

cosmic rain
#

Take a screenshot of the whole editor with the current script inspector visible and the whole hierarchy.

echo saddle
cosmic rain
# rocky lodge

Okay. If that's the case, then the issue is probably somewhere else.

rocky lodge
cosmic rain
rocky lodge
#

how now? the last code I sent? but that one doesn't work

cosmic rain
rocky lodge
#

idk ๐Ÿ˜ญ

cosmic rain
#

I mean, how do you determine that it doesn't work..?

rocky lodge
#

editor freezes

#

ikr it doesn't make sense but I can't explain myself better

cosmic rain
#

Try breaking with the debugger when the editor freezes.

#

If that code causes the freeze, it must be in combination with something else, which is not visible in that code.

rocky lodge
#

why ๐Ÿ˜ญ

cosmic rain
#

Again, it's probably in combination with some other code. It's really hard to say without knowing the whole project.

#

The fastest way to debug the issue would be to use a debugger and or some logs.

rocky lodge
#

ikr just venting until I debug

#

even if I duplicate the parentObject and assign the duplicate it will still freeze, just in case

outer otter
#

i love when i try to debug my code and changing things i thought were crucial never even mattered in the first place

round violet
#

i have a Vector3 position,

i would like a child to be at this position, but I would like to affect all childs and parent.

how can I move the parent so the child is at the position

cosmic rain
round violet
#

I cant reparent

cosmic rain
#

Or calculate their offset beforehand

round violet
outer otter
#

playerRotation is just a vector3(0f, yRotation, 0f)

cosmic rain
outer otter
#

how would i keep track of its rotation?

#

like rotation - old.rotation kinda thing?

knotty sun
#

how are you filling playerRotation?

#

or rather yRotation

outer otter
#

an overly complicated inverted camera x axis in a vector3 from the input * sensitivity

cosmic rain
mellow sigil
#

If you don't want any lag then just use the rotation you want directly without multiplying by deltatime

rocky lodge
outer otter
cosmic rain
knotty sun
#

and, indeed, scrap the deltaTime

desert plaza
#

Less of a "need help" question and more of a how do I do this question, but how would I go about doing a battle system like this in the engine? From about 1:22 to 1:50. I'm using the Panoply unity tool for cutscenes involving motion comics and considering using the Dialogue System addon for the visual novel elements. But I wanted to get this aspect of it in as well.

https://youtu.be/jg5pBxEyp-k?si=BsNM03fG49oNkzcG

Invincible Presents: Atom Eve Full Game Gameplay Walkthrough No Commentary PC

Become Atom Eve and take control of your own path as one of the most powerful superheroes in the Invincible universe! Unravel a mystery and balance the dangers and responsibilities of being a superhero with the relatable challenges of everyday life.

Follow me on Stea...

โ–ถ Play video
cosmic rain
# outer otter not sure if i follow
float yRotation;
//Update
yRotation += input * delta time;

//Fixed update
Quaternion actual rotation = //construct from yRotation and other relevant values
rb.MoveRotation(actual rotation);

Something like this.

cosmic rain
valid moss
#

Hi, I am developing a playing card game like poker. For the cards, I used a SpriteRenderer and changing the sprite of the renderer with

_openSprite = CardManager.Instance.GetSpriteWithId(Data.Id);      // Preloaded Sprite Dictionary <Integere, Sprite> with Resources.Load<Sprite>...
baseRenderer.sprite = _openSprite;

Is this a good way? I'm asking this because I am having many ANRS and high crash rates.

knotty sun
#

ANRS?

cosmic rain
#

Angry null reference scripts?๐Ÿค”

mellow sigil
#

Application Not Responding (in Android)

#

I doubt that code could cause those, have you narrowed down the problem to those lines specifically?

lyric moon
#

im using Unity 2018.4.27f1 and im trying to get a package from a github, but it says i need to add a Scoped Registry in Project Settings -> Package Manager
that doesnt exist - or at least i don't have it. wtf do i do thats the only install method

valid moss
#

App Not Responding errors. I tried narrowing down but I couldn't get a specific error case? A friends' phone stucks in the middle of the game but I cannot see the logs from adb logcat, there is nothing sent.

#

I've read that Resources.Load<> causes some ANRs, but Sprites are loaded at runtime for once, then I use them from the dictionary. I don't load them in real time

#

Is there a better approach to show cards with different sprites?

cosmic rain
fiery path
#

general question ab coding,
should ANY private variable, with no serializefield, be named with an '_'
eg:
private float _timerTest

valid moss
#

I have connected to a local environment but it's not crashing, it's freezing the app (ANR). Probably main thread gets locked and nothing is reported on logcat.

cosmic rain
white crater
#

Hey ๐Ÿ‘‹
this might be a strange ask but does anyone have any suggestions for resources or anything that utilises quake style air control as well as quake style movement direction calculation (wishdir, vel and accel) using rigid body movement instead of character controller?

fiery path
cosmic rain
chilly surge
# fiery path is it typically widely used to showcase this or is it generally a split conventi...

The _privateField convention exists for the reason that if you have a local variable of the same name, you would have to use this.foo and foo to disambiguate them, and it also makes autocomplete worse. When you are reading code and you see foo = bar; you won't know if you are mutating a local variable or a private field, that means when reading code you have to commit mental energy to remember "the current class has these private fields and the current scope has these local variables."
It's a widely adopted convention in wider .NET world, but in Unity... people don't always follow conventions (and I personally think it's a bad thing that people don't follow, but oh well there's enough inertia of people going against the convention that it's not worth arguing against them)

fiery path
chilly surge
#

As a general advice, it's more important to be consistent, so choose whatever convention works for you and stick with it for the entire codebase.
But if you have the freedom to explore different conventions, I would really suggest following the C# conventions in the wider .NET world, or at least understand the reasons behind them and decide for yourself.

ruby elk
somber nacelle
#

add it by name

round violet
#

is OnDisable called when leaving a scene or the app?

somber nacelle
#

yes

round violet
#

ok ty

somber nacelle
#

OnDisable is called any time the object is either disabled or destroyed, unloading a scene destroys the object

round violet
#

also random question :
can i "merge" multiple function so they do the same stuff

example :

// current
    private void OnApplicationPause(bool pause)
    {
        SaveHightScore();

    }

    private void OnApplicationQuit()
    {
        SaveHightScore();
    }

//idea :
    private void OnApplicationPause(bool pause) OnApplicationQuit()
    {
        SaveHightScore();

    }

i dont think its possible since the functions can have differents params, but i just wondered

also does OnApplicationQuit += SaveHightScore work ?

round violet
somber nacelle
#

there is no such thing as "merging" methods. you can store methods in a delegate, but that isn't what you've described nor does it solve whatever it is you are trying to solve

round violet
#

okay

#

ig ill have 3 functions calling the same sub function xD

soft shard
ruby elk
#

thank you

#

is there any specific reason it's not searchable? is it unsupported or something

somber nacelle
#

it's just not shown in the unity registry. this is true for many packages

rustic ember
#

I am using perlin noise to create deserts, and for some reason the corners are sharp instead of smooth. This is only a problem when I use values that are close together, and as I scale the noise down there is no problem. How can I get smooth edges around my desert?

#

The lakes are fine as the noise is scaled differently

mellow sigil
#

show code

finite patrol
#

Hi everyone, I need help with a scene in unity development if anyone know hows to fix it.
I am trying to create a VR scene in unity, where the user needs to place some rings on hooks, however the rings do not go through the hook

rustic ember
# mellow sigil show code
    private float TileTemperature(int _x, int _y, WorldGenerationData_SO _generationData)
    {
        float noiseMultiplier = 1f / _generationData.temperatureNoiseLayers.Length;
        float totalNoise = 0;
        int actualSeed = (int)_generationData.seed * 100000;

        for (int i = 0; i < _generationData.lakeNoiseLayers.Length; i++)
        {
            totalNoise += Mathf.PerlinNoise(
            _x * _generationData.temperatureNoiseLayers[i].noiseScale.x + actualSeed * (i + 1),
            _y * _generationData.temperatureNoiseLayers[i].noiseScale.y + actualSeed * (i + 1));
        }

        return totalNoise * noiseMultiplier;
    }```
#
                float temperature = TileTemperature(x, y, _generationData);

                Tile.TileType tileType;

                if (temperature > _generationData.desertTempMinValue)
                {
                    tileType = Tile.TileType.Sand;
                }```
knotty sun
rustic ember
stiff compass
#

I have an open question about general way of doing something. I have a 2D Canvas game, the level is read from a 120x68 image and represented ontop of a 960x540 image. (its one of those find the items game)
I got it working.. but i dont really like my code, its a bit off (expected due to loss of precission).
I have no idea on how to look for info regarding this beyond minimap questions that work similarly.. any help on this would be great. Does this have a name i can google?

#

im sure there has been a lot of work done in mapping from a low res image to higher res display, but im at a loss for the technical names to look it up xD

heady iris
#

actualSeed looks like a catastrophically big number

#

_generationData.seed * 100000

#

What's the range for the seed variable?

#

if noiseScale is a very small number and actualSeed is a very large number, then it's likely that several tiles will produce the same floating values that get fed into the perlin noise function

#

What you really need here is a 3D noise function.

#

X and Y will be world position; Z will be the seed

rustic ember
heady iris
#

snoise(float3 v) being relevant here

#

that's 3D simplex noise (like perlin noise, but better in a way I can't articulate)

heady iris
# rustic ember It's set to 1

okay, so the closest floating point value to 100,000 is 100,000.0078125

If your scale is small enough that the difference betwen two tiles is less than 0.0078125, then two adjacent tiles will produce the same value.

#

and this will get more and more dramatic as you add more noise layers

#

since you multiply by i + 1

#

I would do something more like this:

float noise = noise.snoise(new float3(
  _x * _generationData.temperatureNoiseLayers[i].noiseScale.x,
  _y * _generationData.temperatureNoiseLayers[i].noiseScale.y,
  _generationData.seed * 1000 + i * 100
));
#

bit of a handwave on the seed value there

rustic ember
#

Thank you for taking time to answer my question

heady iris
#

if you don't have the Mathematics package already, you can install it from the package manager

rustic ember
#

I am working with 2D noise though

heady iris
#

The point is to avoid mixing the seed with your tile position

rustic ember
#

Okay

heady iris
#

so you don't have to start creating gigantic X and Y coordinate values

#

X and Y are tile position. Z is the seed.

#

The result is still a float, just like Mathf.PerlinNoise

rustic ember
#

I get it. Thank you ๐Ÿ™

heady iris
#

You similarly can use 4D noise in a 3D game

rustic ember
#

I can construct a 3D version of the 2D perlin noise function relatively easily

warm night
#

Hey, I got a little problem using Coroutines. I'm currently doing a build system, and my build has animation and I have to wait until the build is completely done to do the next part. So here's the code i made for the first coroutine

    public IEnumerator BuildEnded(Structure structure)
    {
        if(structure != null)
        {
            allStructuresList.Add(structure);

            Structure builtStructure = currentTile.Build(structure);
            yield return StartCoroutine(builtStructure.GetStructureAnimation().PlayAnimation());
            Debug.Log("we finished building");
            OnBuildDone?.Invoke(this, new BuildArgs
            {
                tileToBuild = currentTile,
                structureToBuild = structure
            });
            currentTile = null;
        } else
        {
            OnBuildDone?.Invoke(this, new BuildArgs
            {
                tileToBuild = null,
                structureToBuild = null
            });
        }
    }

And the second coroutine (which is "PlayAnimation()")

    public IEnumerator PlayAnimation()
    {
        float currentTime = 0f;
        isCurrentlyAnimating = true;
        meshRenderer.material = animatedMaterial;
        animatedMaterial.SetFloat("_FillRate", 0f);
        effect.Play();

        while(currentTime < animationDuration)
        {
            float animationTimer = currentTime / animationDuration;
            float fillRate = Mathf.Lerp(-0.3f, 1f, animationTimer);
            animatedMaterial.SetFloat("_FillRate", fillRate);

            currentTime += Time.deltaTime;
            yield return null;
        }
        effect.Stop();
        isCurrentlyAnimating = false;
        Debug.Log("isCurrentlyAnimating = " + isCurrentlyAnimating);
        meshRenderer.material = endedMaterial;
    }

I don't really know why, but the debug "finished building" is not written in console, but my 2nd coroutine is correclty ending up :/, does anyone know a solution?

heady iris
#

so "isCurrenlyAnimating = false" is getting logged?

warm night
#

yeah

#

But not the "we finished building", so idk why x)

knotty sun
#

nothing else in console?

warm night
#

nope, nothing else

#

no errors, nothing

#

just the "isCurrentlyAnimating = false"

heady iris
#

Is any game object being deactivated?

warm night
#

nope, i didn't deactivate any object

#

my game is a turn based game, so i have a main coroutine for the current player's turn, maybe is the problem ? (but the coroutine of "buildended" is not called in the main turn coroutine

heady iris
#

sanity-check this by not doing a yield return when you start the coroutine

#

just blow straight past and see if you get "we finished building" in the log

#

if not, someone else is starting PlayAnimation

#

(you could also just log right before you yield return the coroutine object, I guess)

warm night
#

So you mean i just do StartCoroutine() without yield return?

heady iris
#

Correct.

warm night
#

okay so without the yield return, the code after the start coroutine is correctly executed. However, the animation is not ended before it's executed

#

that's logic, but that's weird that with the yield return, the code is not executed just after the coroutine is ended up

#

According to the documentation, that should work :/

fervent furnace
#

try return the ienumerator directly without startcoroutine

warm night
#

I don't really understand

#

U mean just "yield return FunctionName();

fervent furnace
#

yes

warm night
#

okay let me try

#

With that :

        yield return builtStructure.GetStructureAnimation().PlayAnimation();

My coroutine "PlayAnimation" is just doing the first frame, but it freezes, and never ends

heady iris
#

I was under the impression that it would exhaust the enumerator before resuming the original coroutine

warm night
#

same

fervent furnace
#

is there anything changing the animationDuration? you have logged it?

warm night
#

tbh, i used that example class from the unity docs

#

so i hoped it would work

warm night
heady iris
#

okay, and that is indeed how it works. I just checked.

#
    IEnumerator Foo()
    {
        Debug.Log("Calling Bar");
        yield return Bar();
        Debug.Log("Done with Bar");
    }

    IEnumerator Bar()
    {
        Debug.Log("Bar started");
        int x = 0;
        while (x < 30)
        {
            x += 1;
            yield return null;
        }
        Debug.Log("Bar ended");
    }
warm night
#

because when i just use StartCoroutine(Method()), the animatino is correctly ending

heady iris
#

this project is full of random test code. i need to clean that up

warm night
#

so why it's not working with me ๐Ÿ˜ฆ

heady iris
#

Coroutines run on the MonoBehaviour that you called StartCoroutine on

#

I'm wondering if you have something like this going on

hexed pecan
#

Could be some ownership thing

heady iris
#
public class Foo : MonoBehaviour {
  public Bar bar;
  public void StartWorking() {
    StartCoroutine(bar.BarCoroutine());
    Destroy(gameObject);
  }
}

public class Bar : MonoBehaviour {
  public Baz baz;
  public IEnumerator BarCoroutine() {
    yield return StartCoroutine(baz.BazCoroutine());
  }
}

public class Baz : MonoBehaviour {
  public IEnumerator BazCoroutine() {
    yield return null;
  }
}
#

BarCoroutine is being handled by a Foo instance

#

when the Foo instance dies, the coroutine stops

#

BazCoroutine is being handled by a Bar instance, so it doesn't care, and continues executing

#

But when we tweak it so that we just yield return baz.BazCoroutine();, there's not a second coroutine. The Foo instance is responsible for exhausting the BazCoroutine() enumerator.

#

So when it dies, BazCoroutine "freezes"

warm night
#

okay i understand, but my build system (which is the class : MonoBehaviour) is a singleton, and never dies, so it's impossible, right ?

heady iris
#

I'll need to see the code.

#

Show me the entire script that starts the BuildEnded coroutine

warm night
#

okay

#
    public void ValidateStructure()
    {
        if(structureDisplayed.CanBeBuildWith(inventory))
        {
            StartCoroutine(BuildSystem.Instance.BuildEnded(structureDisplayed));
            BuildSystemUI.Instance.DestroyAndHide();
        } else
        {
            Debug.Log("you cannot build that structure");
        }
    }

As you can see, there's a method "destroyAndHide()", but that destroys some stuff in my UI system, (which shows the builds available which the current ressources in inventory)

    public void DestroyAndHide()
    {
        foreach(BuildPossibilityUI buildPossibilityUI in buildPossibilities)
        {
            Destroy(buildPossibilityUI.gameObject);
        }
        Hide();
        buildPossibilities.Clear();
    }
#

the BuildSystem and BuildSystemUI singletons are never destroyed

heady iris
#

It doesn't matter that the method is on BuildSystem.Instance

heady iris
#

Bar is your BuildSystem

heady iris
#

What matters is who you call StartCoroutine on

warm night
#

U mean the class of my animation ?

#

where the second coroutine is

heady iris
#

I'm not talking about that at all.

fervent furnace
#

no, it just contains the definition of ienumerator

heady iris
#
    public void ValidateStructure()
    {
        if(structureDisplayed.CanBeBuildWith(inventory))
        {
            StartCoroutine(BuildSystem.Instance.BuildEnded(structureDisplayed));
            BuildSystemUI.Instance.DestroyAndHide();
        } else
        {
            Debug.Log("you cannot build that structure");
        }
    }
#

Which class does this exist in?

#

I asked to see the entire script for a reason (:

#

StartCoroutine is an instance method of MonoBehaviour-derived classes

#

It's not some kind of magic static method

warm night
#

Oh shit u are right

heady iris
#

It tells a MonoBehaviour that it's responsible for exhausting the enumerator you give it

warm night
#

It's in my buildPossibilityUI, which i destroy

heady iris
#

by calling MoveNext() on it once per frame, by default

fervent furnace
#

eg if you

public class A{
  here start the coroutine
  class AManager clear
}
public class AManager{
  clear(){
    destroy all As
  }
}
warm night
#

The validate Structure is in a class that is destroyed just a few lines after

heady iris
#

It would be safe to do BuildSystem.Instance.StartCoroutine(...)

#

assuming that's also a MonoBehaviour

warm night
#

I'm trying something wait

heady iris
#

A further point to know -- it's fine if the object the IEnumerator came from gets destroyed

#

All that destroying a Unity object does is mark it as "destroyed"

#

It doesn't magically prevent you from calling methods on the object

#

It does make Unity throw exceptions if you try to access Unity-specific properties

#
whatever.transform // error!
whatever.myCoolInt // fine
#

so you could absolutely destroy the MonoBehaviour that you got the IEnumerator from. As long as you passed it to StartCoroutine on an object that hasn't been destroyed, it'll keep chugging along as usual

cobalt gyro
#
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

namespace Tomartyr
{
    public class ControlHandler : MonoBehaviour
    {
        [SerializeField] GameObject detectingKeyText;
        KeyCode[] controls = new KeyCode[(int)MInput.EndOfEnum];
        MInput currentDetector = MInput.Forward;
        public void Start()
        {
            detectingKeyText.SetActive(false);
        }
        public void PollInput(int input)
        {
            StartCoroutine(PollInputCoroutine((MInput)input));
        }
        private IEnumerator PollInputCoroutine(MInput input)
        {
            yield return null;
            detectingKeyText.SetActive(true);
            for (bool polled = false; polled == false;) 
            {
                if (Event.current.isKey == true)            
                {
                    if (Event.current.type == EventType.KeyDown)
                    {
                        if (Event.current.keyCode == KeyCode.Escape)
                        {
                            controls[(int)input] = KeyCode.None;
                            polled = true;
                        }
                        else
                        {
                            controls[(int)input] = Event.current.keyCode;
                            Debug.Log("The inputs name is: " + Event.current.keyCode.ToString());
                            polled = true;
                        }
                    }
                }
            }
            detectingKeyText.SetActive(false);
        }
    }
    public enum MInput
    {
        Forward,
        Backward,
        Left, 
        Right,
        EndOfEnum,
    }
}``` 
Does anyone know what could be causing this error message
heady iris
#

...unless the method tries to access transform/gameObject/layer/etc.

heady iris
#

you tried to access a member from something that is null

cobalt gyro
fervent furnace
#

btw, to prevent future questions

for (bool polled = false; polled == false;){
  if (Event.current.isKey == true){
    some codes, no yield return inside
  }
}
#

dead loop

heady iris
#

oh yeah, that's weird

hexed pecan
hexed pecan
#

Try using normal Input instead

#

Old or new input system, whichever you use

cobalt gyro
white crater
#

Hey Guys ๐Ÿ‘‹

I am working on a Rigidbody Player Movement system and am struggling to switch things up. Basically the current method of applying forces is like this

        rb.AddForce(orientation.transform.forward * y * acceleration * Time.deltaTime * multiplier * multiplierV);
        rb.AddForce(orientation.transform.right * x * acceleration * Time.deltaTime * multiplier);

ultimately the first line accounts for forward and backward movement whilst the bottom line accounts for side to side movement.

#

What i am trying to do instead is apply the forces similar to quake 3 movement

hexed pecan
#

AddForce already multiplies it by fixedDeltaTime by default so dont use deltaTime with forces

#

As a side note

white crater
#

what should be used instead?

hexed pecan
#

Just remove the deltatime multiplication

warm night
hexed pecan
#

And then adjust your multiplier values again - they need to be way smaller

leaden ice
white crater
#

yeah holy i be zipping around now

#

whats the theory behind that?

#

so i can understand

leaden ice
#

FixedUpdate is the only place AddForce should be called
FixedUpdate is already framerate adjusted automatically

#

It also is the intended usage for AddForce and is the only way the units make sense.

white crater
#

got it

#

thank you

leaden ice
#

So multiplying by deltaTime is just a pointless division of the force by 50

white crater
#

that made the acceleration value make sense

leaden ice
#

exactly

#

now the numbers make sense

white crater
#

cause before i had it at like 5000 lmao

#

okay that made it make a lot more sense

#

that was a very good tip

#

thank you very much man

white crater
#

i am struggly to apply the logic to rigid body

#

this makes for more smooth movement while also making air control feel much better

#

any tips?

frosty snow
#

whats the difference between

(ns_in_second / (world_current_scale / GameSettings.timer_fps)) / GameSettings.timer_fps)
```and
```cs
(ns_in_second / world_current_scale)

as both yield the same result with

(ns_in_second / (world_current_scale / GameSettings.timer_fps)) / GameSettings.timer_fps)
```and
```cs
(ns_in_second / world_current_scale)

but both yield the different results with

(ns_in_second * (world_current_scale / GameSettings.timer_fps)) / GameSettings.timer_fps)
```and
```cs
(ns_in_second * world_current_scale)
swift falcon
# white crater

if you are basing ur movement off of quake you should directly modify velocity directly instead of going through addforce bc that's how quake does it

#

most rigidbody stuff is for realistic physics simulation, which quake physics is not

white crater
#

is there no way to emulate similarities?

#

cause like i chose rigid body so that things like explosions, springjoint grapple and all that can still effect the player

#

the way quake calculates its force direction doesnt seem to be tied intrinsicly into their physics movement

#

unless im interpreting it wrong

swift falcon
#

i was able to get pretty close but something i could not reconcile is that when rbs collide they push eachother, which does not happen in quake

frosty snow
#

atm i have the following

#

which is ok

#

tho i have

+ "percieved time: " + ns_to_string((long)(ns_in_second * world_current_scale)) + "\n"
+ "remaining time: " + ns_to_string((long)(ns_in_second / (world_current_scale / GameSettings.timer_fps)) / GameSettings.timer_fps) + "\n"
swift falcon
white crater
#

how does rigidbody.velocity interact with things that effect the rb?

#

just out of curiosity

frosty snow
#

so why tf am i dividing by my fps which is 60 ?

swift falcon
white crater
#

or atleast it sends the reverse to cancel it out so it doesnt matter where the collision occured?

#

so it sends an equal reverse force to the player forcing them to stop

heady iris
#

I do not understand your problem.

fervent furnace
#
(ns_in_second / (world_current_scale / GameSettings.timer_fps)) / GameSettings.timer_fps)
(ns_in_second / world_current_scale)

a / (b / c) / c
= a / b * c / c, unfortunately this is true only if b and c are not int (or short or byte that something with no decimal part)
= a / floor(b / c) / c

heady iris
swift falcon
#

instead of using rigidbody and trying to remove most of its functionality

swift falcon
# deft timber good luck

most of the difficult math is in collision-checking and unity's raycasting system basically does that for you, so it was p trivial. just dealing with edgecases rn

winged tiger
#

guys

void Start()
    {
        micSource = gameObject.AddComponent<AudioSource>();
        micSource.clip = Microphone.Start(null, true, 1, 48000);
        micSource.loop = true;
        micSource.Play();


        playSource = Instantiate(new GameObject(),gameObject.transform).AddComponent<AudioSource>();
        playSource.clip = AudioClip.Create("test", 48000 * 2, 1, 48000, true,OnAudioPlaybackRead);
        playSource.loop = true;
        playSource.Play();

    }

    private void OnAudioPlaybackRead(float[] data)
    {

        if (micBuf.Count >= data.Length)
        {
            micBuf.GetRange(0, data.Length).ToArray().CopyTo(data, 0);
            micBuf.RemoveRange(0, data.Length);
        }
    }

    private void OnAudioFilterRead(float[] data, int channels)
    {
        micBuf.AddRange(data);
        Array.Clear(data,0, data.Length);
    }

why does the audio sound like 2 times slower where do I messed up

heady iris
#

You've decoded it with the wrong sample rate.

#

It's probably sampling at 96000hz

#

oh, I see what you did

white crater
#

so that when the player collides with the โ€œouter boxโ€ itโ€™s like a wall removing player rigid bodies from interacting with eachother?

winged tiger
heady iris
#

well, hmm, no, I thought you set the sample rate of the audio clip to 96000hz

#

but that's the lengthSamples parameter

winged tiger
#

yeah

heady iris
#

that just controls how long the clip is, not how quickly it plays back the samples

winged tiger
#

oh i didn't know what that did to be honest

heady iris
#

Do you have a stereo microphone?

winged tiger
#

nope

heady iris
#

That would produce twice as many samples as a mono microphone, which, if naively copied over, would play back at half speed when interpreted as mono data

winged tiger
#

ohh

white crater
winged tiger
#

every person has a different mic

heady iris
#

it looks like Microphone only ever does one channel

winged tiger
#

wierd tho

heady iris
#

hm, definitely unexpected

#

but yes -- you'll get slow/fast audio if the sample rate is wrong

winged tiger
#

yeah that makes sense now

heady iris
#

It could be that your microphone can't provide the sample rate you asked for, but if it was too low, that'd give you audio that plays too fast

#

24000hz -> 48000hz is double playback speed

#

96000hz -> 48000hz would be too slow, and intepreting it as stereo data would "fix" it

#

but I doubt your microphone can only do that really high frequency

ocean blade
#

hi im trying to make a rigidbody player controller for my fps game. problem is that unlike the normal character controller, it does not take steps, like climbing stairs. how do i fix this? ive tried using raycasts to change its y position as it approaches a step

winged tiger
#

you could just replace the steps with a invisible ramp

ocean blade
#

i know, but id rather have it with no ramps

#

dont wanna go and add ramps everywhere

winged tiger
#

ah

ocean blade
#

thanks for the suggestion though

winged tiger
latent latch
#

yeah do it ye old fashion way and just add a ramp

ocean blade
winged tiger
#

jk

heady iris
#

you'll need to do step detection yourself, then

latent latch
#

doing it with rigidbodies seems hard

#

something I'd tackle more with a custom character controller

heady iris
#

this looks a lot like how I implemented vault detection in a parkour-game prototype

#

fire a bunch of raycasts to scan for a ledge, then fire rays down to figure out where on the ledge you can stand

ocean blade
heady iris
#

You maybe able to take advantage of Physics.ComputePenetration

#

Although it'll probably just suggest kicking your collider out horizontally

winged tiger
opaque fox
#

Hello so I am still having problems I asked yesterday about my enemy character not stopping moving on collision with the specific object i want it to. https://hatebin.com/ijqyhceaau

knotty sun
tawny elkBOT
opaque fox
latent latch
#

I find it funny how a lot of older nintendo games actually did stairs correctly, yet the invisible ramp way is still quite apparent in a lot of newer titles

rigid island
#

are the logs showing

ocean blade
#

problem is, if i like back up from the stairs, it detects it and still pushes the player up like it was approaching the stairs

opaque fox
#

u mean this

rigid island
opaque fox
#

yea but i cant see wat

rigid island
#

Debug.Log the if statement

rigid island
spring creek
ocean blade
#

ooooh

#

aight thanks a lots

opaque fox
#

which is fine because it is in update.

opaque fox
#

? what.

winged tiger
#

i like the "like ur mum" addition to the debugging

opaque fox
#

oh yea

winged tiger
#

always helps (fr)

opaque fox
#

๐Ÿ™‚

ashen jasper
#

I got a issue with my scirpt. I'm trying to find the animation current state based on its name but for some reason it seems no not find it. Is there a issue with my code or is a issue with the actor

#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class animatorScriptControl : MonoBehaviour
{
    Animator anim;
    // Start is called before the first frame update
    void Start()
    {
        anim = GetComponent<Animator>();
        this.transform.localRotation = Quaternion.Euler(0, 135, 0);
    }

    // Update is called once per frame
    void Update()
    {
        if (this.anim.GetCurrentAnimatorStateInfo(0).IsName("walk"))
        {
            print("HIIII");
        }
    }
}```
leaden ice
ashen jasper
#

Rotate the model in a angle

#

this is going for left and right movement

leaden ice
#

What does that have to do with animator State?

ashen jasper
#

that why i need it

leaden ice
#

I don't get it still, that's a very unclear explanation. It also still sounds like something you should do with an animation event or StateMachineBehaviour

ocean blade
#

alright i somehow fixed my issue
its kinda buggy but at least it works perfectly on some circumstances

ashen jasper
leaden ice
#

Yes, make an animation event in your animation clip that does what you want

ashen jasper
#

public void FaceSceneRight() => transform.localRotation = Quaternion.Euler(0, 135, 0);

#

And mide it clean too

kindred plume
#

Why "press e to interact" isn't popping out when the blue line touch the lightswitcher on interactlayermask? Did i do something wrong?

hexed pecan
#

If you want a ray from the center of the camera, give it a coordinate that is half the screen size

#

Or use Camera.ViewportPointToRay which takes normalized coordinates so you can just give it (0.5f, 0.5f) for center

kindred plume
#

ok thank you

#

wait, im confused it's not working

#

i want a ray that comes out from the center of camera and it has the camera forward direction. I want to do that when the ray touches the lightswitcher that is on interact layer the "press e to interact" pops out.

hexed pecan
#

The ray should be fine if you did what I said. There could be other issues

#

Put some logs so you know which if-statements pass and which do not

#

Log the object that you hit

kindred plume
#

ok

hexed pecan
#

Make sure you aren't trying to get the component from a child, while the parent has the component

#

If it has children with colliders, that is

warm kraken
#

when i pick up the object, i update its position to lerp towards the transform i placed in front of the camera (desiredTrans). i tried using both transform.position and rb.move version to do this. they both failed at fixing the jitter. i tried all the rigidbody objects' interpolation settings, setting it to kinematic, freezing rotation and position etc... nothing fixes the jitter. this is my code for lerping rigidbody object's position towards the "desiredTrans" position btw: private void FixedUpdate()
{
if (picked)
{
rb.Move(Vector3.Lerp(transform.position, desiredTrans.position + offsetPos, rbLerpSpeed),
Quaternion.Lerp(transform.rotation, desiredTrans.rotation, rbLerpSpeed));
}
} help would really be appreciated been struggling with this for days..

hexed pecan
#

@kindred plume Post your updated code too, just to be sure

hexed pecan
#

You must make sure that it runs after your camera and the target transform has rotated/moved each frame. Not before

warm kraken
#

ah, so i change code execution order?

warm kraken
hexed pecan
#

Jitter is very often an execution order thing, yes

warm kraken
#

ill try it now

hexed pecan
#

Also make desiredTrans visible so you see if that is jittering or just the rigidbody

kindred plume
#

!code

tawny elkBOT
hexed pecan
#

Also is rbLerpSpeed a constant value?

warm kraken
#

yes

kindred plume
#
private void HandleInteraction()
    {
        Vector3 interactDir = cam.transform.forward;
        Ray ray = new Ray(cam.transform.position,interactDir);
        if (Physics.Raycast(ray,out RaycastHit raycastHit, interactDistance,interactLayerMask))
        {
            if (raycastHit.transform.TryGetComponent(out Interactable interactable))
            {
                if (interactable != selectedInteractable)
                {
                    Debug.Log("Interactable detected");
                    selectedInteractable = interactable;
                    SetSelectedInteractable(selectedInteractable);
                }
            } else
            {
                Debug.Log("Interactable not detected");
                SetSelectedInteractable(null);
            }
        } else
        {
            Debug.Log("Ray is casting nothing");
            SetSelectedInteractable(null);
        }
    }

@hexed pecan

kindred plume
hexed pecan
#

Put some more info in your logs, log the object that was hit

kindred plume
#

ur right i forgot

#

what do i log about the object that was hit?

#

ok i log the name about the object and it logs the name of the lightswitcher like its components "cube" or "cube (1)"

#

@hexed pecan

hexed pecan
#

A quick fix is to use GetComponentInParent instead of GetComponent

kindred plume
#

no no, the lightswitch parent has the script

hexed pecan
hexed pecan
#

Or if those cubes don't need colliders then just remove them

kindred plume
hexed pecan
#

Yeah

#

So either:
Only the lightswitch has a collider and you use GetComponent
Or the children have colliders too but use GetComponentInParent

#

Latter option might be easier to work with later, if your interactable objects will have child colliders

kindred plume
#

omg it works

#

i can shut off the light

#

Thank you @hexed pecan

warm kraken
#

this is my code. i switch to rb.move when the picked up object collides with other objects. with a proper script execution order(MouseLook first and this one second), while using transform to lerp object's position, it has significantly less jitter (still little is left tho). but when it collides with something and switches to rb.move in fixedUpdate, it starts jittering crazy.

harsh lotus
#

Hey, can someone help me with my endless problem, I can't get my 2D game endless platform to generate

tawny elkBOT
harsh lotus
harsh lotus
#

My whole game has become a debug since I started playing again

rigid island
harsh lotus
#

I no longer have the idea of โ€‹โ€‹how to deal with unity like I did back then

#

It would be very helpful if someone could look at my project to see what is useful and what could be deleted

rigid island
#

first debugging steps, check the functions are even running

#

what are the values of each, etc

#

if you understand these basics you don't need someone else to look over anything

hard viper
#

damn, if you have no documentation, of course you will struggle returning to code after months

rugged storm
#
        List<Block> matches = new() { startBlock.block };
        BlockSO type = startBlock.block.blockType;
        List<int> offsetMuls = new() { 1, -1 };
        foreach (int offsetMultiplyer in offsetMuls)
        {
            int loopCount = 1;
            bool failed = false;
            do
            {
                Vector2Int nextBlockPos = startBlock.startpos + (offset*offsetMultiplyer*loopCount);
                if (!grid.TryGetValue(nextBlockPos,out Block nextBlock))
                {
                    failed = true;
                    continue;
                }
                //stuff that relies on tryGetValueWorking


                loopCount += 1;
            }
            while (!failed && loopCount > 20);

        }```
this while-do loop properly skips the rest of the code via that continue if the try get fails right?
leaden ice
#

Continue goes to the next iteration of the loop

#

In this case since you're checking that bool in the while condition why not just break though?

rugged storm
#

Oh right break that makes far more sense

#

i just forgot that existed for a moment

opaque fox
rustic ember
#

How do I avoid mirroring ?

heady iris
#

What does your code look like?

rustic ember
#
    private bool TileIsLake(int _x, int _y, WorldGenerationData_SO _generationData)
    {
        float noiseMultiplier = 1f / _generationData.lakeNoiseLayers.Length;
        float totalNoise = 0;
        int actualSeed = (int)_generationData.seed * 2000;

        for (int i = 0; i < _generationData.lakeNoiseLayers.Length; i++)
        {
            totalNoise += Perlin3D(
            _x * _generationData.lakeNoiseLayers[i].noiseScale.x + 10000,
            _y * _generationData.lakeNoiseLayers[i].noiseScale.y + 10000,
            actualSeed + 200 * (i + 1));
        }

        return totalNoise * noiseMultiplier < _generationData.lakeMaxValue;
    }```
heady iris
#

i'm guessing Perlin3D is adding x and y together and computing noise based on that

#

let's see that method

rustic ember
#
    private float Perlin3D (float _x, float _y, float _z)
    {
        // Source: https://www.youtube.com/watch?v=Aga0TBJkchM
        // Get all three permutations of noise for x, y, and z
        float AB = Mathf.PerlinNoise(_x, _y);
        float BC = Mathf.PerlinNoise(_y, _z);
        float AC = Mathf.PerlinNoise(_x, _z);

        // And their reverses
        float BA = Mathf.PerlinNoise(_y, _x);
        float CB = Mathf.PerlinNoise(_z, _y);
        float CA = Mathf.PerlinNoise(_z, _x);

        float ABC = AB + BC + AC + BA + CB + CA;

        return ABC / 6f;
    }```
heady iris
#

yeah, so this is just a way to kludge together 3D perlin noise from 2D perlin noise. it's not going to behave correctly

#

This is going to be symmetric around the Y=X line

#

why not just use the Mathematics package?

#

it provides a correct implementation of 3D simplex noise (it has classical perlin noise too, if you want)

rustic ember
#

Because I'm unsure of how to download it

#

and install it

#

and use it

heady iris
#

install it from the unity package manager

#

it's in the Unity Registry, like a bunch of other common packages

#

using Unity.Mathematics; will allow you to use noise.snoise

#
float3 vec = new float3(x * xScale, y * yScale, seed);
float result = noise.snoise(vec);

roughly like this

rustic ember
#

It looks weird now

#
    private bool TileIsLake(int _x, int _y, WorldGenerationData_SO _generationData)
    {
        float noiseMultiplier = 1f / _generationData.lakeNoiseLayers.Length;
        float totalNoise = 0;
        int actualSeed = (int)_generationData.seed * 2000;

        for (int i = 0; i < _generationData.lakeNoiseLayers.Length; i++)
        {
            totalNoise += noise.snoise(new float3(
            _x * _generationData.lakeNoiseLayers[i].noiseScale.x,
            _y * _generationData.lakeNoiseLayers[i].noiseScale.y,
            actualSeed + 200 * i));
        }

        return totalNoise * noiseMultiplier < _generationData.lakeMaxValue;
    }```
#

what is snoise? is it simplex noise

heady iris
#

This noise may have a different frequency than the perlin noise you were originally using.

#

Yes, simplex noise

#

You can use noise.cnoise instead to get classic perlin noise. I dunno if that will look different or not.

#

It'll probably be closer in character to Mathf.PerlinNoise

opaque fox
winged tiger
#

uuhh why does the sound has "gaps" or "crackling" , when encoding and decoding audio fom microphone using opus, if anyone can help?

https://pastebin.com/08VPwycG

rustic ember
heady iris
#

Ah, of course!

#

simplex noise is -1..1

#

You just need to remap it

#
float remapped = math.remap(-1, 1, 0, 1, result);
#

another Mathematics function (:

#

you could also use Mathf

#
float t = Mathf.InverseLerp(-1, 1, result);
float remapped = Mathf.Lerp(0, 1, result);
#

note that, in this case, the lerp isn't really needed

#

since the value is already in the 0..1 range

#

but if you want any other range (say, 0 to 3), you'd need the Lerp as well

#

You can mix-and-match the Mathf (built-in) and math (Mathematics package) functions

#

One thing you may be interested in later, though...

#

Computing perlin and simplex noise is relatively slow.

rigid island
#

explain it a little more

heady iris
#

One cool thing Unity can do is called Burst compilation. It converts C# code into native code ahead of time.

#

Burst can only work with certain kinds of primitive data and certain methods.

#

Everything in math and noise is compatible.

opaque fox
#

wdym

heady iris
#
[BurstCompile]
static class NoiseMethods
{
    [BurstCompile]
    public static float Noise(float t, in float2 vec, in float2 offset)
    {
        return noise.snoise(vec * t + offset);
    }
}
#

I just realized I should be using 3D simplex noise here instead of an offset lol

#

do as I say, not as I do...

opaque fox
#

what dont u understa nd

heady iris
#

NoiseMethods.Noise runs a lot faster than just calling noise.snoise directly, because Unity can Burst-compile this into native code.

#

This isn't something you need to do right now, but it's part of the reason I really like the Mathematics package!

rigid island
opaque fox
opaque fox
#

wait nvm

#

that not it

rigid island
#

this can just be an If else btw

#

if(walkCurrently == false) {

opaque fox
#

yea but that is not going to really effect the code

rigid island
#

i guess..

#

so what isn't working on this?

opaque fox
#

Well it is not stopping walking when the walkCurrently variable is false

rigid island
#

for false

opaque fox
#

1 sec my unity is loading up

rigid island
#

how do you expect it to stop walking

opaque fox
#

fair point