#💻┃code-beginner

1 messages · Page 777 of 1

tame juniper
#

or like chromatic abberation

frail hawk
#

and don´t forget the post processing effects

astral void
#

!code

radiant voidBOT
astral void
#

testing smn

#
private void InputManager_OnLeftClick(object sender, EventArgs e)
    {
        //check if we hit anything
        if(MatchManager.instance.currentPhase == MatchManager.PhaseType.preparationPhase)
        {
            if (GetObjectHovered(out GameObject objectClicked, MatchManager.instance.ClickableObjectsMask))
            {
                CheckObjectType(objectClicked);
            }
        }
        else if(MatchManager.instance.currentPhase == MatchManager.PhaseType.actPhase)
        {
            if (GetObjectHovered(out GameObject objectClicked, MatchManager.instance.DominoSpacesMask))
            {
                CheckObjectType(objectClicked);
            }
        }
        
    }
#

okayyy icic yes

#

wanted to know how to make it colourful bc I've seen others do that

#

ignore me :3

naive pawn
#

keep in mind that remainder and modulo are not the same operation

#

% in quite a few languages, including c#, is actually remainder, not modulo

#

that Repeat is an actual modulo

rough granite
#

Yeah no looked it up some found that python ( where i first learnd of it) calls it modulo but most call it the remainder operator

naive pawn
tired python
#

do you use the same oncollisionenter2D for different types of collisions? so like, on collision, you check whether the object it collided with has a certain tag or not and then do the needful?

frail hawk
#

yep

naive pawn
upper yoke
#

Hey, when using an audio source and making a webgl build I get Failed to set the 'loopStart' property on 'AudioBufferSourceNode': The provided double value is non-finite. with Unity 6000.4.0a2, would anyone know how to fix that?

vital vault
#

how can i get mouse pos in format from -1 to 1?

solar hill
#

i guess you would use screen.width and screen.height and basically remap them to the "-1 1" range

stone whale
#

how can I get a local directional vector spun in worldspace so it's direction is relative to another directional vector? Like movement direction relative to camera angle?

vital vault
#

like _camera.transform.forward * Time.deltaTime * _speed

stone whale
frail hawk
vital vault
vital vault
#

make sure that transform points to player's body

#

so you cant nullify your forward vec by looking up or down

naive pawn
vital vault
naive pawn
#

you could pull the deltatime and speed out

#

a * c + b * c -> (a + b) * c

vital vault
#

i just provided an example

#

yeah

#

but thats just an example

frail hawk
#

he said aligned with the camera tho, would you not have to consider that

#

i think he just did not explain it correctly, what you provided should be working

vital vault
#

i already use that in my script

#

i made ingame freecam mode

frail hawk
#

i know it works, i wanted to say works for him

vital vault
#

ok

stone whale
#

Thank you~ I made it work with this for now, didn't realize about just adding two vectors together like that

Vector2 vel = new Vector2(cam.transform.forward.x, cam.transform.forward.z).normalized * inputDir.y + new Vector2(cam.transform.right.x, cam.transform.right.z).normalized * inputDir.x;

languid pagoda
#

If the GC is doing a sweep is it automatically slower if there are more objects created? IE I have 1k cached objects and the GC sweeps to destroy a few that are not cached is that sweep automatically slower versus if there was only 100 objects cached?

true crown
#

I used Brackeys tutorial for fps movement so i can get well... movement, however i want to be able to drag items with the mouse and kinda throw them around (that i gotta figure out later lol)
the issue right now is whenever the (locked) mouse goes over the item (in this case a cube) the camera moves much faster than before, im using the legacy input system along with OnMouseEnter and Drag
do i need to use the new input method? Or should i be raycasting from the camera? Right now i simply want to fix the camera movement so any help with that would be greatly appreciated!

#

if needed i can share my scripts, its nothing special anyway

#

also, when playing "maximized" the issue appears to go away, so it might just be the unity window size messing things up, although i still don't like how this issue exists and a fix to prevent possible issues in the future would be nice

timber tide
#

New input should not matter. You'd probably end up doing similar logic anyway with it

#

Anyway, if you've issues with some code feel free to post

tired python
#

the gameObject has a spline animate attached to it, so when it's supposed to end its journey, it's splineanimate is supposed to become false, so when i reenable the object in the pool, although it becomes active, since its spline animate become false, it doesn't move across the spline. that's why i am restarting it...

wintry quarry
#

you have a NullReferenceException happening there

slender nymph
#

also for future reference, a screenshot of the error would have been sufficient rather than a video where 90% of it is just you wiggling your mouse around uselessly

tired python
#

have no idea why it doesn't happen right after i hit play

wintry quarry
tired python
#

is it because of this?

naive pawn
#

we still don't know what line is causing the error

#

!code

radiant voidBOT
naive pawn
#

share your code properly

tired python
#

oh nvm, it worked out

#

that was the problem

naive pawn
#

you should consider rubber duck debugging sometime

tired python
#

@slender nymph it might have been you who sent me smth related to a doc which explains how to debug code and stuff...was it you? or if you do have one, i need it...

slender nymph
#

not entirely sure what you're referring to, but i've probably sent you countless links to unity.huh.how which has debugging steps for many common issues

agile turtle
#

can somebody help me fix this problem

wintry quarry
agile turtle
#

my character i created has no shadow

#

and why i put script into my zombie

wintry quarry
#

why did you share the same image again lol

agile turtle
#

and it not work

#

nah dont care about it bro

#

just my habit copy paste

wintry quarry
agile turtle
#

so we dont have Q&A general channel ?

#

learning how to make 3d game make me depression

tired python
naive pawn
agile turtle
#

ok

wintry quarry
pearl current
#

my b

hard warren
#

does .db file saved on Application.persistentDataPath get shipped too when i build my game?

keen dew
#

no

hard warren
#

Application.dataPath?

keen dew
#

Put it in the assets, when the app starts if there is no db file in the persistentDataPath, save a copy of the asset there

eternal needle
hard warren
hard warren
keen dew
eternal needle
#

🤔 what are you actually trying to do here

hard warren
#

so i can't use that

keen dew
#

jesus christ

eternal needle
#

because if you include it in the assets file, you just directly reference it. theres no need to "find" it. the same way you would do with a prefab

hard warren
keen dew
#

Put the .db file in the assets

eternal needle
#

thats not what you're trying to do. what, in game design terms, are you trying to do?

keen dew
#

then copy it to persistentDataPath

hard warren
grand snow
#

StreamingAssets may be better suited

keen dew
grand snow
#

or use the file as a TextAsset as you can then read the bytes of the asset and use as desired

hard warren
#

wait no, i should not have 2 copy of db

hard warren
keen dew
grand snow
hard warren
eternal needle
grand snow
#

If this DB is for player save data then do not use streaming assets

keen dew
grand snow
#

Use streaming assets to store a default copy that you can copy into persistent data path

eternal needle
#

well realistically you cant ship data then and keep it writable without having 2 copies. Consider the shipped data just a template

#

if the data doesn't exist in persistent data path, use the template

hard warren
#

i see... i guess i will need 2 db then

grand snow
#

What is this DB for even?

keen dew
#

Having the template doesn't mean you have 2 databases

hard warren
#

database

grand snow
#

what is it for

hard warren
#

game data?

grand snow
#

too vague!

#

Player save data you want to read and write to?

hard warren
#

I'm putting all things in there. my game goal is still vague

grand snow
#

Then why are you using sqlite 😐

hard warren
#

how else do i save offline game data?

grand snow
# hard warren yes

You can surely then just use persistant data path and make a new file if its not present?

#

Beginners often use json, otherwise id recommend binary formats.
Sqlite is good for situations where you actually need the benefits of db querying

#

Seeing as this is code beginner i am confused

hard warren
eternal needle
#

you're kinda just guessing at how things work here

grand snow
hard warren
keen dew
#

The cart is being put firmly before the horse

grand snow
#

If you cannot produce a new file state correctly from code only then that isnt a good sign

#

learn how to fly a plane before you can walk

languid pagoda
# agile turtle

honestly I am more concerned why you think its acceptable to post this screenshot in a safe for work discord channel

#

like take your weird hentai somewhere else no one wants to see softcore porn in a programming server

hard warren
#

Anyway ok thx everyone

eternal needle
# hard warren i am... I'm learning

when we ask questions like what you're trying to do, it's better that you state the feature you're trying to build like "save the amount of coins of my player has" rather than "ship a DB file". this is called an xy problem https://xyproblem.info/
it really just doesn't sound like you need a DB at all

keen dew
#

The usual way to do it is to start with an empty database, so you don't need a pre-made database file

grand snow
keen dew
#

If you need stuff in the database when the game starts then the game puts it there dynamically

languid pagoda
#

or you could just make a post build editor script that copies it to whatever directory you want.

eternal needle
#

beginner channel btw

languid pagoda
#

and? its about 12 lines of code...

#

is File.Copy a complex procdure?

eternal needle
#

ignoring the fact that its not even needed for this problem, low lines of code doesn't mean a beginner will understand it lol

#

no one said anything about File.Copy

languid pagoda
#

Idk i just see people telling him he doesn't need a DB and there isn't enough info about to determine that.

naive pawn
#

isn't that the point of followup questions

hard warren
#

i found better solution someone send me this link
https://www.mongodb.com/developer/code-examples/csharp/saving-data-in-unity3d-using-sqlite/
and tell me to use URI (URI=file:SqliteTest.db) instead

#

they say that way i can ship and edit the db

keen dew
#

I doubt it works but try it out (in a build) and if it works for you then great

junior mountain
#

Hello, I'm a begginer in Unity and C# and i got a problem putting a velocity to a Rigid Body

#

It only says this in the console: NullReferenceException: Object reference not set to an instance of an object

eternal needle
#

you likely just never assigned the RB

junior mountain
#

The object has a rigidbody

#

It starts inactive but it gets activated at some point but without any speed

eternal needle
#

!code for sharing code in the future

radiant voidBOT
eternal needle
#

you dont assign the Rb a value anywhere in this code, and it is not serialized to inspector so it is null

#

id really recommend starting out with c# basics (resources pinned in channel) if you don't know what null means

junior mountain
#

In another object I put the same line and it worked, this one just doesnt

eternal needle
#

it is null, give it a value

faint osprey
#

why am i getting this error

#

using new input system

slender nymph
#

because you cannot have a member with the same name as its enclosing type. change the name of your variable. or change the name of the class.

eternal needle
faint osprey
#

oh why does it default to same name if it gives an error then weird

slender nymph
#

in what way is it "defaulting" to the same name? you typed the name

faint osprey
#

no i just pressed generate c# class

eternal needle
#

The name used is the asset name

slender nymph
#

or the name typed into the convenient box to enter a name

faint osprey
#

so it cant be called player actions

stark vessel
#

why cant i cast (float[])? I made a list of 5 floats but it errors despite all floats being dorrectly written

#
    {
        foreach (var x in [-0.5f, -0.25f, 0, 0.25f, 0.5f])
        {
            if (Physics.Raycast(transform.position + Vector3.right * x, -Vector3.up, 0.5f))
            {
                return true;
            }
        }
        return false;
    }```
slender nymph
#

you can't declare arrays like that in the version of c# that unity uses

stark vessel
#

how do I make an array then??

slender nymph
#

literally first result on google if you search "c# array"

stark vessel
#

oh

cosmic dagger
stark vessel
slender nymph
#

even the official c# docs call out how to initialize an array correctly when using a version of c# before 12 (when collection expressions were introduced)

frail hawk
stark vessel
#

well what do you know, {} is erroring

#
    {
        foreach (var x in {-0.5f, -0.25f, 0.0f, 0.25f, 0.5f})
        {
            if (Physics.Raycast(transform.position + Vector3.right * x, -Vector3.up, 0.5f))
            {
                return true;
            }
        }
        return false;
    }```
slender nymph
#

well yes, you can't just do it in place like that either. you need a variable to assign that to

cosmic dagger
stark vessel
#

and Im doing it exact as its shownn

slender nymph
#

no you aren't

stark vessel
slender nymph
#

wrong variable mate

stark vessel
#

x is the only variable i use here

cosmic dagger
slender nymph
stark vessel
#

it shows braces insyead of brakets

stark vessel
slender nymph
cosmic dagger
stark vessel
#

I didnt know that

slender nymph
cosmic dagger
# stark vessel I didnt know that

because you didn't take the time to read. the page tells you about storing multiples values in a single variable, how to declare an array, and define the variable . . .

stark vessel
#

its saying that the variable I made last line doesnt exist????
const numbers = {-0.5f, -0.25f, 0.0f, 0.25f, 0.5f};
next line has numbers but nope

slender nymph
#

even with collection expressions, you still can't just declare an array in place. the only way you would have ever seen any example doing that is if you were looking at examples from a different language

slender nymph
stark vessel
#

last time I tried doing list of floats it didnt work

#

not Array<float>, not float[], nothingggggg

slender nymph
#

also you can't make an array constant (at least not one you declare as a local variable)

stark vessel
#

whyyyyy

cosmic dagger
frail hawk
slender nymph
# stark vessel whyyyyy

at this point it seems like you need to review the basics of c#. there are beginner courses pinned in this channel, start there.

stark vessel
#

what reasons are there as to why any of this needs to happen?? why cant arrays be constant? why must they be in a variable? why does declaring an array of floats use float[] but arrays use {} (and {} is the same as code blocks)

grand snow
#

arrays are reference types so cannot be constant

slender nymph
#

arrays can be constant, just not like that

grand snow
#

dont think they can work like c/cpp arrays

stark vessel
slender nymph
#

declare it as a field

#

ah wait, they can't be constant but it can be readonly that's my bad.

grand snow
#

IReadOnlyCollection and IReadOnlyList are the best way i know to have a non writeable collection

stark vessel
cosmic dagger
grand snow
stark vessel
stark vessel
slender nymph
grand snow
#

constants arent variables technically

cosmic dagger
stark vessel
grand snow
#

nooooo

#

a const is not a variable

stark vessel
#

so you can change a constant?
whats the point of it being constant

slender nymph
grand snow
#

constants are a way to define some rvalue that can be used in various places

stark vessel
#

so how is it possible to change the value?? if its constantttt

grand snow
#

a static field would be a shared var you can read/write to

stark vessel
grand snow
#

okay you clearly have lots to learn

#

static just means its not a class instance variable

stark vessel
#

ok but what is the difference between can only be set once and can only be set once

slender nymph
grand snow
#
const int DEFAULT_BOXES = 5;
public static int Boxes = DEFAULT_BOXES;
stark vessel
#

arent those the same

#

I cant change the const or static

grand snow
#

Boxes can be written to and read from. DEFAULT_BOXES is not a variable but just a re usable int we can use at compile time.

#

its like doing #define DEFAULT_BOXES 5

stark vessel
#

boxes is static though

slender nymph
#

static can be changed, it just means it isn't owned by any instance of the object. const cannot be changed.

stark vessel
#

static means not changing

grand snow
#

are you trolling us or what

stark vessel
#

static means something that doesnt change

grand snow
#

say potato if you are not a bot

frail hawk
#

in c# it means something else

stark vessel
#

"lacking in movement, action, or change, especially in an undesirable or uninteresting way"

slender nymph
stark vessel
grand snow
stark vessel
#

okkk

grand snow
#

If we explain something then trust us

stark vessel
#

ok

cosmic dagger
stark vessel
#

im still confused about how a readonly is different from a value that cant be changed

polar acorn
slender nymph
#

const must be a compile time constant. you cannot create an object for a constant, but readonly means it can be assigned to either in a field initializer or the object's constructor so it can have things that are not constant assigned, but after that it cannot be assigned to again

slender nymph
#

they do not

polar acorn
#

As such, it can only hold compile time values. A read-only variable can hold a reference, but a const must be a constant value

stark vessel
#

how are they different? can the readyonly be changed

slender nymph
#

i literally just explained

stark vessel
polar acorn
polar acorn
stark vessel
#

oh

cosmic dagger
manic hatch
#

im facing a issue with Road architect where the wizard doesnt show anything innit when i try to use it, i tried re installing didnt workout

solar hill
#

#💻┃unity-talk is more appropriate for asset bugs but i dont think we can help you in general unless its a very common bug on a very common asset.

polar dust
#

Touching on a point from earlier, are you sure you haven't seen some code like this?

var foo = new float[] { 0f, 1f, 2f };```  @stark vessel you said that arrays only use {} which isn't true
#
float[] foo = { 0f, 1f, 2f };``` would also work, but you still need []
warped moss
#

Hello everyone!

#

i'm having a problem with build to a apk

#

I anyone help me to fix this i appreciate

cosmic dagger
#

did you check if target was null?

#

also, don't use Find in OnTriggerStay; it's called every FixedUpdate. Find should not be called every frame as it checks every GameObject in your hierarchy . . .

tired python
tired python
#
using Unity.VisualScripting;
using UnityEditor;
using UnityEngine;

public class ShootBullet : MonoBehaviour
{
    GameObject Target;
    [SerializeField] GameObject bullet;

    void Update()
    {
        if (Target)
        {
            Vector3 direction = (Target.transform.position - bullet.transform.position).normalized;

            int movespd = 30;
            bullet.transform.position += direction * movespd * Time.deltaTime;

            if (Vector3.Distance(gameObject.transform.position, Target.transform.position) <= 1f)
            {
                Destroy(bullet);
                Destroy(Target);
            }
        }
    }

    public void Create(Transform start_transform, GameObject target)
    {
        Target = target;
        Instantiate(bullet, start_transform.position, start_transform.rotation);
    }    
}
cosmic dagger
tired python
#

ahh wait a sec

cosmic dagger
#

you should get the shootFromPosition in Awake or Start. you only need to grab it once . . .

tired python
#

sry i did not check

polar acorn
#

one of them is null

cosmic dagger
#

you check every reference variable on the error line . . .

tired python
#

oh ya bullet is null

cosmic dagger
tired python
solar hill
#

make it a habit

#

to not hard code stuff like that.

#

no point youre just giving yourself more work later on

cosmic dagger
#

the same way you're accessing gameObject.transform.position; it can just be transform.position . . .

tired python
#

wait, does transform.position work instead of gameObject.transform.position

tired python
#

i misunderstood you

#

actually nah, i was focusing on the big green text instead

#

i am stubid

cosmic dagger
#

it's pointless (not entirely) to ever need a GameObject variable . . .

#

every Component has access to its game object, so there's no reason to store a variable for it . . .

tired python
#

another question, i have no idea as to why it's happening. the Bullet gameobject has the Bullet prefab attached to it. on instantiating this gameobject though, the prefab disappears...any reason as to why it's happening?

tired python
tired python
#

i did not know that

cosmic dagger
#

but you don't actually need the .gameObject. it can just be hoo.transform.position . . .

#

because Rigidbody2D inherits the gameObject and the transform property from Component . . .

cosmic dagger
tired python
tired python
# cosmic dagger this seems weird. the Bullet prefab has a component with a variable assigned to ...

so like, the droplet is a unit which the player deploys, and it has a collision script attached to it, which detects collisions with enemies. what i want to do, is to make a bullet gameobject in the hierarchy, and then attach a script to it, which has a Create function in it which instantiates the bullet. and then, i wanna update the position of said gameobject in the update() block of the code. thing is, if i do that, and then i destroy the gameobject, i will end up losing the gameobject....and well, after typing all this down i realise that i am trying to destroy the prefab itself when i call the destroy function

#

ideally, i want droplet to have a script, which spawns a bullet and makes it go towards the desired target. i know how i will update the position, i don't know how to reference stuff, and been trying to think

analog scarab
#

has anyone figured out how to get unity errors in the cursor?

ember tangle
#

How do I get OnTriggerEnter to work with unscaled time instead of scaled time?

flint sorrel
#

I'm having a weird issue with a script where, depending what object in the Hierarchy I have selected, will change how the script seems to behave

It's a generic player controller for a character, and when I have the Player object selected, it behaves as normal. View-sensitivity is normal and I can look around with the expected sensitivity, and my jump height/gravity is as it should be

But if I select any other object in the hierarchy (be it the world, the camera itself, or even nothing in the hierarchy), suddenly the view-sensitivity goes way down and my jump height gets completely slashed.

Any ideas?

grand snow
flint sorrel
#

I'd be... Surprised if that's it, the project is exceptionally barebones right now (it's essentially just a big cube to walk on and a capsule character) so I'd be startled if the act of not looking at a object in the Hierarchy is making such a major impact

Regardless, if it is that, what would be the method to fix it?

#

I figured the whole "multiply stuff by Time.deltaTime" would be the general method, but perhaps I'm looking at it backwards and shouldn't multiply it by that?

#

As an example, this is what I'm doing the view stuff with;

private void CalculateView() 
{

    newCharacterRotation.y += playerSettings.ViewXSensitivity * (playerSettings.ViewXInverted ? -input_View.x : input_View.x) * Time.deltaTime;
    transform.localRotation = Quaternion.Euler(newCharacterRotation);

    newCameraRotation.x += playerSettings.ViewYSensitivity * (playerSettings.ViewYInverted ? input_View.y : -input_View.y) * Time.deltaTime;
    newCameraRotation.x = Mathf.Clamp(newCameraRotation.x, viewClampYMin, viewClampYMax);


    
    cameraHolder.localRotation = Quaternion.Euler(newCameraRotation);

}```
true crown
true crown
#

which pun

tired python
#

my enemy is a duck O_O

#

these ducks UnityChanLOL

hallow adder
true crown
# tired python my enemy is a duck O_O

no, rubber duck method existed before your game, the pun was that after you program a lot you will be crazy and lonely, therfore already talking to inanimate objects

#

but it does help, speaking out logic helps you realize where the error in logic comes from

tired python
#

what the, i am not the only one in here who speaks to themselves

flint sorrel
# hallow adder drawing the inspector can be very expensive. Show how input_View is retrieved. I...

It would indeed appear to be something like that

From what I see having fiddled a bit, some of the floats used in my script, which I had set as public so I could see them, update so aggressively that having them visible was making quite an impact on FPS (Things like the current gravity value on the player, as an example)
Setting these all to private to stop them showing, now results in the behaviour being the same regardless of object

So while I have indeed fixed this part of the issue, it does concern me for future things as evidently my movement code (looking around/jumping) is very dependant on the FPS of the client, which is clearly not desirable

#

The part that does leave me confused is the fact that I thought Time.deltaTime was meant to sort of address this? By having things like camera-movement multiplied by said deltaTime to stop it being entirely FPS dependant?

hallow adder
#

no, you misunderstood the issue and applied an incorrect band-aid

flint sorrel
#

Then I am still lost kekw

stark vessel
#

any way to apply force with a rigidbody without the force carrying over to the next frame

hallow adder
#

you are using an API that is already frame-rate independent, and breaking the frame-rate independence by including delta time again. Where is input_View received? Find the docs for the API you're using (I'm guessing Input.GetAxis) and read them

true crown
#

where can i display something fun i did, sorta like a personal acomplishment while learnin

flint sorrel
true crown
true crown
stark vessel
#

oh

hallow adder
stark vessel
#

can i add force to a rigidbody in a way that only affects that frame?

hallow adder
stark vessel
hallow adder
#

they're both impulses. One considers mass and the other doesn't. Both will affect velocity, assuming it's valid to apply force to the body

stark vessel
#

I dont want to affect velocity that would affect next frame, going against my entire message

hallow adder
#

your message makes no sense, then. You want to apply a force that has no effect?

versed stump
#

Adding a non zero force is going to affect velocity 🙂

flint sorrel
stark vessel
#

I want it to just move that one frame and no tohers

#

so I dont want a force

true crown
stark vessel
hallow adder
languid pagoda
#

I wrote a custom network library using enet. I am not a fan of how I designed replication, anyone know some decent articles on this subject? What I mean by replication is the management of network aware objects ie creation, deletion, updates etc

true crown
flint sorrel
stark vessel
hallow adder
true crown
true crown
#

im full of dumb ideas so my reccomendations probably aren't the best, so if someone else says something id reccomend following them lol

flint sorrel
hallow adder
# stark vessel so I dont want a force

You can apply a one-time instantaneous velocity change with a force on one frame. What are you trying to do, exactly? Hopefully you're not trying to work around a misunderstanding

stark vessel
#

I dont want turning around to be difficult

#

or like I want it to only move left or right when you hold the buttons, like hollow knight

hallow adder
flint sorrel
hallow adder
flint sorrel
#

The issue I have is that, being entirely new to it all, I’m mostly following guides and tutorials and going from there, so if the guide leaves something as a pass through for example, I just don’t know enough about anything to question if it should be a pass through or not

cosmic dagger
cosmic dagger
# tired python ideally, i want droplet to have a script, which spawns a bullet and makes it go ...

You pretty much said it. Place the script on the object, call a method from the script that creates a bullet. You just have a few minor missteps

When the bullet is created, set its orientation (rotation) so the bullet only needs to move forward. The bullet should move forward in its own script (or the script that created it can set its speed, but this option depends on how the bullet moves)

The bullet component (script) should be on the bullet GameObject, not the droplet, because the droplet is not a bullet

The droplet needs its own component with a method that shoots a bullet. It needs to have the bullet prefab to create the bullet that shoots . . .

cosmic dagger
real thunder
#

was about to ask a question but figured out that AnimatorStateInfo.GetHashCode and AnimatorStateInfo.fullPathHash are different things, god I hate names

sweet meadow
#

hello, i am following this tut but I have deleted the default Player input scheme and created my own that is a recreation of it for practice, same names etc. But when i get to callback context near the end of the tut, Move dosen't show up, is there a fix for this?
https://youtu.be/DQY62meLVCk?si=jqG80y8idiOE1QiW

Beginner friendly and full tutorial on Player Movement using Unity's Input System! We'll also set up a default sprite for our player using the asset pack below. And look into serialized fields!

Sprite sheet: https://pixel-boy.itch.io/ninja-adventure-asset-pack

Full Package: https://www.patreon.com/posts/movement-with-2d-104791237
Free Script: ...

▶ Play video
#

or maybe an alternative way to do it

twin pivot
radiant voidBOT
sweet meadow
#

oh ok sorry

#

using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
public float moveSpeed = 5f;
private Rigidbody2D rb;
private Vector2 moveInput;

// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
    rb = GetComponent<Rigidbody2D>();

}

// Update is called once per frame
void Update()
{
    rb.linearVelocity = moveInput * moveSpeed;
}

public void Move(InputAction.CallbackContext context)
{
    moveInput = context.ReadValue<Vector2>();
}

}

#

ok ive changed back to using the default but it still dosent show up

#

there should be a CallbackContext: Move

hallow adder
radiant voidBOT
sweet meadow
twin pivot
sweet meadow
twin pivot
# sweet meadow

Could u scroll down on the inspector and extend the events tabb

sweet meadow
twin pivot
sweet meadow
twin pivot
sweet meadow
#

Yes?

twin pivot
#

Assign it

sweet meadow
#

tysm

sinful zinc
#

How do i get a 3d object to be rendered behind my UI, not in front

#

Canvas is set to Screen Space - Camera, main camera is assigned

#

my scene has only 1 camera

#

The 3d object is on layer Water

#

Cameras culling mask is set to Water, UI

#

I am using Unity 6. The 3d model's material is URP lit

wintry quarry
wintry quarry
sinful zinc
#

What is a UI plane, and a canvas cant be moved

#

maybe u are confused with world space

wintry quarry
#

You're looking at the RectTransform

sinful zinc
wintry quarry
#

You said it was in Screen Space Camera mode

sinful zinc
#

Wait i just changed that my accident

wintry quarry
#

It needs to be in screen space camera

sinful zinc
#

ohhh

wintry quarry
#

Yes now you can see plane distance

sinful zinc
#

the distance from my camera to my player is ~3,

#

when plane distance is 2.9 it doesnt show

#

2.95 and it only renders a bit of the players front

wintry quarry
sinful zinc
#

regular

wintry quarry
#

Looks like we succeeded at putting the 3d object in front of the UI no?

sinful zinc
wintry quarry
#

Well you can just use overlay then. Overlay will always be drawn on top

#

Otherwise, make the plane distance smaller than the distance to the player

#

Note that if your player here is 3 units away from the camera he still has some thickness

#

So the closest part of him might be 2 units away, for example

sinful zinc
#

For this I need a second camera and add it to stack?

wintry quarry
#

What do you have in your canvas?

#

By default it will just work, no need for second cameras. Overlay doesn't even use a camera

#

But if you made a giant image covering the whole screen of course it will cover everything

sinful zinc
#

what the hell

#

im so stupid

#

I do have a bg which covers the whole screen though

#

so i dont know how to work around that

wintry quarry
#

Put the overlay UI on an overlay canvas

sinful zinc
#

Worked perfect

#

thank you

#

Just wondering where should I hide the big background

#

is this fine

deep canopy
#

I don't know where to ask anymore. Who knows how to fix this? Texture in paint texture that im trying to paint appears far and randomly from my brush

sweet meadow
#

anyone know why my character only displays walk down? the idles work but not the walk.

crisp quest
#

can somebody explain me the difference between sqrmagnitude and magnitude ?

wintry quarry
naive pawn
wintry quarry
#

Jinx

naive pawn
#

lmao

#

it's faster to compute because computationally, division and square root are hard operations

#

(division isn't used here, just thought i'd mention)

#

magnitude is comouted from the pythagorean formula, consider a Vector2

magnitude^2 = x^2 + y^2
magnitude = sqrt(x^2 + y^2)

crisp quest
wintry quarry
naive pawn
wintry quarry
naive pawn
naive pawn
#

it's good for comparing magnitudes, and that's about it

wintry quarry
#

The square one is "good enough" for a lot of things and much faster to compute

sweet meadow
crisp quest
#

To get the actual magnitude

radiant voidBOT
sweet meadow
#

what?

naive pawn
#

it is currently not configured

#

this is a prerequisite to getting help here

naive pawn
# sweet meadow

wait, did you configure it (or more likely, it loaded) between these 2 screenshots lol

#

this one seems to show it's configured?

sweet meadow
#

uh no i didn't do anything

naive pawn
#

can you show a screenshot of your ide as it is currently

sweet meadow
#

I think its configured

#

at least i've done everything on the prerequisite i think

wintry quarry
#

It is configured

sweet meadow
#

ok

#

so does anyone know what the problem is?

wintry quarry
sweet meadow
#

what should i

#

what information do you need

wintry quarry
#

How you fed your animator params into the blend

sweet meadow
#

it just checks your x and y inputs and works out your direction

#

im not 100% sure, its a tutorial

naive pawn
#

show your blend tree configuration

wintry quarry
#

I'm asking you to show me how you set it up

naive pawn
#

less cropped

#

what parameters is it taking

snow warren
#

alright gng i am facing a problem

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

snow warren
#

I wrote my own binary reader that uses bit converter and block copy to read binary data

naive pawn
snow warren
#

the problem is that I am facing an error OutOfMemory

naive pawn
#

potentially could be a long running or infinite loop that keeps allocating memory

snow warren
#

not really

#

the reader works fine as intended

#

but after doing all of that

naive pawn
#

yeah, that was a vague guess based on the little info you gave

snow warren
#

it fails at reading the next file

sweet meadow
snow warren
naive pawn
# sweet meadow

you need to scroll up in the inspector to show what params it's using

sweet meadow
#

ok

naive pawn
#

we can't read your mind

sweet meadow
#

sorry

#

i didnt know what you mean

#

but that you for pointing that out

naive pawn
#

have you tried debugging to see what codepath is triggering the error?

naive pawn
sweet meadow
#

oh god im so dumb that fixed it

#

there was no peramiters

snow warren
sweet meadow
#

tysm

lofty anvil
#

has anyone else ran into an issue where 3d objects refuse to render if 2d objects are around? it doesn't matter on positioning, if the 3d object is overlapped, in front of, or behind the 2d object. I'm trying to make a shimmering force field and figured a 3d object might add a little extra pizzazz but I've been banging my head against a wall for the last 4 hours trying to get it to work. the only time it does anything close to working is when I change the surface type to opaque but that defeats the point of having it there

Sorry if this is long, trying to provide info that might be valuable. Tried many troubleshooting steps prior to this

lofty anvil
naive pawn
#

...why would that be a code issue

naive pawn
#

anyways, the issue could be in that call

#

!code

radiant voidBOT
snow warren
naive pawn
#

so why store them at all

#

so what's in the LoadAnimation

snow warren
#

this.frames = new AnimationFrame[br.ReadInt32()];

#

this is the load animation

    private void LoadAnimation(BinaryReaderNekki br)
    {
        this.frames = new AnimationFrame[br.ReadInt32()];
        this.bonesIDs = new int[br.ReadInt32()];
        for (int i = 0; i < this.bonesIDs.Length; i++)
        {
            this.bonesIDs[i] = (int)br.ReadInt16();
        }
        BinaryHelper Helper = new BinaryHelper(br, this.frames.Length * this.bonesIDs.Length * 6, 216);

        for(int j = 0; j < this.frames.Length; j++)
        {
            this.frames[j] = new AnimationFrame();
            this.frames[j].bonesAnimationC = new AnimatedTransformCompressed[this.bonesIDs.Length];
            for(int k = 0; k < this.bonesIDs.Length; k++)
            {
                Half px = Half.ToHalf(Helper.ReturnShort());
                Half py = Half.ToHalf(Helper.ReturnShort());
                Half pz = Half.ToHalf(Helper.ReturnShort());

                ushort ux = Helper.ReturnShort();
                ushort uy = Helper.ReturnShort();
                ushort uz = Helper.ReturnShort();

                this.frames[j].bonesAnimationC[k] = new AnimatedTransformCompressed(px, py, pz, ux, uy, uz);
            }
        }
    }```
naive pawn
#

well, sounds like you're allocating a lot there then

snow warren
naive pawn
#

have you tried debugging to make sure it's the value you expect, for a start

snow warren
#

i am trying to fix it now

sweet meadow
#

is there a simple line of code to get an input from actions and execute a line of code if it is pressed

snow warren
#

Fixed it

#

thanks for the help

tame juniper
#

hello, im trying to make UI have different cost amounts and show its respecting attribute that it upgardes and text and stuff, and ive got one of them, but want to add more, but the script is on tje canvas that has a variable that goes into the UI upgrade ( if this makes any sense ) so if i wanted to make more, would i have to put the script on the indivaidual ui Upgrades instead?

#

its only the text that changes

#

but now my problem is i cant take a script from my player that has the attributes.. very stumped

frail hawk
#

Ui is only there to show you values andinformations, they cant have different cost amounts as you said

frail hawk
#

you still struggeling with the concept of oop it seems

tame juniper
#

but cant they have the same script but different variables in the inspector?

tame juniper
#

i think i am

frail hawk
#

you can fetch data from somwhere to show on your ui yes, you just need to create references to the data you want to receive.

#

so on the same ui element you can have references to different objects/data

tame juniper
#

ok i think i get it

#

ill try do that

frail hawk
#

did you understand the idea behind SerializeField we were talking about a few days ago?

tame juniper
#

no i forgot to find that out actually

frail hawk
#

how you can have one single class(script) but have as many objects as you want from that class. see them as copies of your class. so if you create a script with a [SerializeField] that means you can change this field individually for any of your objects

tame juniper
#

so for any childs of it?

frail hawk
#

put them same script on different gameobjects and have different values in the [SerializeField]

tame juniper
#

so would i make the variables i have on cost and amout i would do a serilizedFeild?

frail hawk
#

it depends, if you want different objects yes, it is still unclear to me what you want to do

tame juniper
#

fair enough haha im not good at explaining but i will try that

#

im so confused nevermind

#

hang on

#

im getting a thing saying object refrence not set to an instance of an object, its about the attribute Manager, but ive put the atytribute manager in the refrence slot? like the variable thingy

#

ive gone back to putting on the canvas for now

#

nvm ive got it i accidently put serialized feild on the attribute manager

vale blade
#

trying to dabble with a custom editor for a script i'm writing.

I want - purely for editor niceties - to be able to check a toggle and consequently set the Condition foldout to be (in)visible.

I can't seem to figure out how to make the Toggle value persist at an Editor level, without abusing something like EditorPrefs or SessionState, both of which would be pretty terrible solutions anyway.

tiny island
#

why do i have this error?

naive pawn
#

there's probably a stacktrace

tiny island
#

what is a NRE?

rich adder
tiny island
#

i don't understand anything on unity , actually infuriating

naive pawn
#

did you try checking the stacktrace?

#

if you click the error log in the console window, there's a trace at the bottom that should point to the line the NRE came from

tiny island
#

apparently it's this line

rich adder
#

did you actually put DialogueTag on a gameobject?

naive pawn
#

so there's no GameObject with that tag.

consider using serializedreferences instead of this

tiny island
#

yeah i put the tag on a gameobjet

rich adder
rich adder
tiny island
rich adder
#

put Log and verify

#

or is the actual gameobject enabled when doing FindByTag

tiny island
#

yes but it say " objet reference not set to an instance of a objet"

frail hawk
#

why not just create a direct reference to the Dialogue object and assign per inspector instead?
[SerializeField] Dialogue dialogue;

tiny island
rich adder
rich adder
frail hawk
#

true

tiny island
rich adder
#

dont crosspost

tiny island
#

yes , it's grayed

rich adder
#

FindByTag doesn't work on disabled
but anyway now you know this, just serialize the reference and link it in the inspector as suggested

subtle sage
rich adder
#

!code

radiant voidBOT
frail hawk
#

yeah your code is too long, rest is not visible and people won´t bother to dl it

empty cairn
#

How do I use a camera in a public field?

rich adder
empty cairn
rich adder
empty cairn
#

Well the options isnt there because idk how to add jt

rich adder
empty cairn
#

Yeah

rich adder
frail hawk
#

2 birds with one stone heh

empty cairn
#

What's the difference between a public field and a serialized private field?

rich adder
#

private fields cannot be accessed from other scripts

#

SerializeField just exposes it in the inspector

subtle sage
#

guys i working on 2d professional game

i got mad because from 1 week i trying to apply this script which working in the first map to another maps

and its never working fine

just it work fine on the first map

i tried to solve from every where and i can't

any help ?

this the script

and these 2 photos 1 from the first map and one from second map

and here the question by the right way ☑️

these photos for the 2 maps

and this the Script what i using

https://paste.mod.gg/lmnsxzeosrzv/0

rich adder
#

generally the latter is better

#

lilbro really double spaced it like a school essay jeez

rich adder
#

and its never working fine

#

you need to explain what not working fine means , we we dont know whats supposed/expected to happen vs whats happening

subtle sage
rich adder
#

the star colors look the same to me on the two photos

frail hawk
#

do you get any console errors, especially when changing the maps?

rich adder
#

you should probably keep that console window docked visible

subtle sage
rich adder
#

there is a lot to debug here

#

and lots of sketchy string work

#

have you been inspecting the debugs logs?

#

also keep that console panel visible, as mentioned do you have errors ?

#

you know you can make things like difficulty enums, which is a lot safer than string

subtle sage
rich adder
#

but really one thing that sounds out is you're doing alot of sketchy work with strings such as string prefabName = prefab.name + "(Clone)";

#

Finding objects by name is hella sketch

#

Do you have DDOL object somewhere ?

#

monliths suck man, try to split your scripts into smaller scripts focused on specific tasks it will be easier to debug

frail hawk
#

so many things in your code that need to be changed
put the Levelpanel class in a seperate script,
variables of same type can be declared on the same line,
don´t use the same if statement twice:

 if (levelSystem == null)
            levelSystem = FindObjectOfType<PlayerLevelSystem>();
 if (levelSystem == null)
            Debug.LogError("⚠️ PlayerLevelSystem غير موجود في المشهد!");

#

just to name a few and this is only the upper poertion of the script

rich adder
#

that one seems fine because it tries serializefield first public and if its null tries to find runtime

#

and if its none found its logs error but still messy as hell

#

I feel like either some data isn't loading with json, or something sketchy happens but we cannot debug from here

subtle sage
#

I suspect one thing, which is the difference in scene names or keys in the two interfaces, or the names saved in JSON files.

rich adder
#

you have to try to print out as many strings are you're trying to manipulate / use cause they're unreliable
like lol avoid doing shit like this..too much potential for something to go wrong..
if (!currentData.unlockedLevels.Contains("Easy Level " + (finishedLevel + 1) + " ~ " + (finishedLevel + 1))) currentData.unlockedLevels.Add("Easy Level " + (finishedLevel + 1) + " ~ " + (finishedLevel + 1));

#

thats why we use Type-Safe language to avoid crap like that

#

this isn't javascript

tiny island
#

i think ima just give up for now and try to get into a call with someone later

rich adder
#

no one is gonna get on call with you realistically

tiny island
#

fair enough

rich adder
#

the link i sent literally has a video on what to do

#

if you're being lazy /no reading it and want everything spoon-fed to you this isn't the place tbh..

frail hawk
#

nav provided everything you need and i even gave you copy ready code mate

#

why do you need a call for?

#

game dev is not easy and if you are not able to solve such small things you might run into bigger troubles later. take your time and read everything again

rich adder
#

I'll get on call with you, I charge 25/hr a session. thats a bargain

frail hawk
#

25 is really cheap tbh put a 1 before

tiny island
#

i think i'm going to pass on this bargain.

i'll re-read what you guys sent me again and try to understand , sorry for taking your time and tkx for the help

rich adder
#

could be one of this in the same function if (levelSystem == null || levelSystem.data.sceneStars == null) return;
or
UpdatePanelStars not being called at all somehow

tiny island
#

@rich adder @frail hawk it's a bit buggy but it works as intended now , tkx again

orchid trout
#

I was told that if you have for example 10,000 of the same monobehaviour game objects all calling Update, that a single manager class calling update once and iterating over a list of all 10,000 is more performant in Unity
Is there any truth to that?

rich adder
sour fulcrum
#

not to side-step the question but generally the energy behind that question ends up down a path where you need to consider if 10,000 objects need to have update called on them (at least that frame)

rich adder
#

there is some truth to it but really depends a lot what you're doing

orchid trout
#

Yeah fair points, the use case I was discussing at the time was units doing navigation on update moving their transforms in xyz space

rich adder
#

why not test and profile both, you can have your answer

#

even empty calls of Update still have to callback to the C++ code so there that

orchid trout
#

True good point I could just profile the idea

sour fulcrum
rich adder
#

if you need 10,000 items you might consider going full DOTS / ECS

orchid trout
#

I have started looking into moving code over into jobs. 10,000 was an exaggeration, I was looking to have unit counts at the scale of like Total War style combat

rich adder
#

have you seen Diplomacy is not an Option ? I believe its full dots they have thousands of units

sour fulcrum
#

I haven't made a made like that so you might already be on this but i'd assume it might be worth having the targets be the initial update source rather than the units? so if you have like 600 units going towards 1 target some targetinfo thing could have a reference to all those units and then tell those to update from there. or some other similar kinda methodology

orchid trout
orchid trout
rich adder
#

pretty insane what you can achieve in DOTS

orchid trout
#

Oh wow, yeah holy hell. Reminds me of They Are Billions, but 3D
Added it to my steam wishlist now

rich adder
#

yeah almost looks like fluids lol
they are even features on unity page . Worth considering, but you can probably start with delegating some work with Jobs and go from there

orchid trout
#

Found this from the devs explaining how they use DOTS for it, useful

rich adder
#

gotta love devs who are actually open to showcasing their workflow in development

nimble apex
# rich adder

i can say 99% of games wouldnt even dare to replicate "large army" that they showed in trailer

#

like the crowds in the picture

#

they eventually will try to fool u with 10-20 soidlers with a health bar to signify how many troops are there

#

this is really good

wicked cairn
nimble apex
wicked cairn
#

Pretty decent crew

rich adder
nimble apex
#

but DOT is very different than normal workflow tho

rich adder
#

that is true, that is another hurdle

nimble apex
#

it really needs u to spend some times on it before u can even gets ur hand dirty and type some basic things

rich adder
#

not exactly something you can easily get good results without knowing how to use it proper

sour fulcrum
#

Jobs is a nice compromise

rich adder
#

ECS can break the mind a bit

nimble apex
#

i studied it for like 1-2 hrs only , it seemed under DOTS workflow playmode recovery is disabled?

rich adder
#

I want to start it soon , i tried it with bullet hell and got decent results so I'm sure if you really have the time / mind to do it

nimble apex
#

after this project i suppose

rich adder
grand snow
#

Jobs are nice but sometimes i just use threads because jobs have dumb limitations that i dont always want

uncut wave
#

thank you

#

your helping me out a lott with that (:

#

yeah i got 6.2 instald

frail hawk
#

maybe use another path not sure if you can use the OneDrive folder

rich adder
#

dont use OneDrive at all

#

it will fuck everything up esp permission issues

blissful stratus
#

how can i make a game object restart in unity not the whole scene?

wintry quarry
#

what would a "restart" look like for this particular GameObject?

ivory bobcat
rich adder
#

save your values on awake then reset them with a method?

blissful stratus
wintry quarry
#

If you mean "return it to its starting position" for example, then you would just save the starting position in a variable and make a function you can call to restore it to that position

naive pawn
naive pawn
blissful stratus
naive pawn
#

and what should be reset? the position, health, etc?

rich adder
#

the easiest is storing the values and reset with method, instantiate works but then you break references

naive pawn
#

should enemies or level state not be reset?

rich adder
#

i assume the player dies, and needs to "respawn"

blissful stratus
frail hawk
#

jusr restart the scene

ivory bobcat
#

Reload the scene perhaps?

nimble apex
ivory bobcat
#

Should there be any persistent scene objects?

blissful stratus
#

its a big scene so i want this gameobj only to restart not the whole scene

nimble apex
ivory bobcat
#

Normally in a flappy bird game, the pipes are procedurally generated

wintry quarry
nimble apex
#

which is what dalphat asked

blissful stratus
nimble apex
#

because the better way to reset the whole game state , if its simple singleplayer game , is to reload scene again

ivory bobcat
nimble apex
ivory bobcat
#

Level designers need money too. Just kidding.

nimble apex
#

because flappy bird is a kind of infinite game , it will go on forever

#

ofc players might not have the skills to keep it up to 1000 2000 or 5000

blissful stratus
nimble apex
#

so flappy bird is a small game in ur whole escape room riddle

#

i see

blissful stratus
#

and winning is by passing 5 pipes

nimble apex
#

but even so, you can do procedual generations for pipes , u just need to tune the logic

ivory bobcat
#

I thought it was a big scene? Five pipes do not seem like many

blissful stratus
#

if you die i wont make the player return bacl an play the whole level bec a simple mistake

crisp quest
#

somebody help me , i want my player moves in the direction of my camera , like if i move my camera to the left then my character's local forward moves to the left side too

naive pawn
ivory bobcat
#

I'm assuming you aren't wanting to reload the scene because the player is using some sort of arcade machine in the scene. If so, just reposition objects

naive pawn
#

yeah just store whatever state you need to restore

rich adder
frail hawk
#

i think a simply LookAt would be enough in this case

blazing hornet
#

Hey guys

rich adder
blazing hornet
#

how to code

#

😄

rich adder
blazing hornet
#

omg

rich adder
#

fingers or maybe you can speech to text

blazing hornet
#

hmm not bad

frail hawk
#

haha

blazing hornet
#

funny?

frail hawk
#

indeed funny

blazing hornet
#

ok

frail hawk
#

check the pinned messages in this chanel

blazing hornet
#

Thats the total basic, I knew the basic

rich adder
#

am i supposed to be psychic

blazing hornet
#

kinda

rich adder
#

also most people who say "i knew the basic" doesnt probably know much sorry

cosmic quail
radiant voidBOT
rich adder
#

esp with "how to code"

blazing hornet
#

😄

#

im jk

rich adder
#

funny?

frail hawk
#

what is a float?

blazing hornet
#

indeed funny

#

float is variable

#

ig

rich adder
#

wrong

#

is a data type thinksmart

#

variables store types (actually more like a label to where it is in memory)

blazing hornet
#

ah fck that

frail hawk
#

close

blazing hornet
#

its like (public float variable = 5.3f;) ig

wintry quarry
#

When I first learned programming I thought float was a verb. I was very confused until I corrected that misconception

naive pawn
rich adder
#

hmm ya I could be wrong, I always thought of them a human readable way to find it where is stored in memory

naive pawn
#

oh im not disputing that part, just saying variables don't store types

rich adder
#

instead of address x02h73h this one i s called "pies" lol

naive pawn
#

doing asm/c gives a lot of insights as to how memory works actually

#

godbolt is truly god's work

#

insane to see how variable length arrays are implemented in C (it dynamically expands the stack frame, and the variable is the address of the array instead of the array directly)

rich adder
#

the scary part of a high-low level lang like that (mid level?)

#

assembly with a human touch lol

rich adder
frail hawk
#

mean one

naive pawn
rich adder
#

would still be the same thing lol

#

kinda sad that now days though you can just paste that into google or gpt and get the answer..

naive pawn
#

i mean like, just straight 5

rich adder
#

oh yeah that broke my brain a bit

nimble apex
#

struct is quite hard to change by nature

#

i learnt that before lol

naive pawn
#

not really?

nimble apex
#

welp u need extra step to change it , it is harder than classesnotlikethis

naive pawn
#

do you mean value-typed properties

#

the issue there is a reference, or lack thereof, not the actual modification

nimble apex
#

now i use struct to act as model classes to contain/deserialize data from server , something that never needed to be changed once they retrieved from server

naive pawn
#

you do realize that structs aren't semantically for immutable data though, right

nimble apex
#

but damn, i do think i violates the "16 bytes" rule

nimble apex
naive pawn
#

being immutable doesn't have anything to do with being a struct

visual roost
#

I want to code with my friend. Is there an easier way or a tutorial for using Plastic SCM? My friend doesn't know how to join my project.

naive pawn
rich adder
#

Git > PlasticGarbage

visual roost
#

its easy to use ?

rich adder
#

yea.especially with a GUI

nimble apex
#

i have never ever uses plastic scm

#

i start from github desktop

rich adder
#

unitys implementation always has weird ass bugs

nimble apex
#

and then gitkraken , i cant stand pure git command code lol

#

must have GUI

rich adder
#

some operations handle better on CLI

naive pawn
#

stashes my beloved

#

-# rebasing and force push my beloved

rich adder
#

once I merged through Github Desktop and it fucked my whole repo up

nimble apex
white matrix
wintry quarry
white matrix
#

there is non i did

wintry quarry
#

Second, you'd have to show us what this "CharacterController2D" script is, because that's not built in to Unity.
Third, make sure you actually attached your script to your character

white matrix
#

ok one sec ill send

solar hill
#

whatever CharacterController2d is, you can find it on github with 1 google search

#

and there is an example controller script there

nimble apex
#

yep i think i might need to do classes instead of structs

#

4 dictionary + 6 string + 2 int might be big for a struct

white matrix
#

i dont know what structs is

wintry quarry
#

What layers did you set as the "m_WhatIsGround" field in the inspector?

white matrix
wintry quarry
#

Also where is your ground check Transform located?

wintry quarry
solar hill
#

use an empty for the ground check thats a child of the character

wintry quarry
solar hill
#

not the character itself

white matrix
wintry quarry
white matrix
#

groundcheck

wintry quarry
#

If you set nothing, it will find nothing

solar hill
#

yeah you need to decide what is considered "ground"

#

otherwise nothing is the ground and you are never grounded

white matrix
#

how do i do that?

solar hill
#

well im assuming you have a layer made for the ground, so simply assign everything you consider the ground to be on that layer in the inspector

wintry quarry
wintry quarry
#

so:

  • set your ground layer as WhatIsGround
  • Put your ground objects in that layer
solar hill
#

yeah m_ground or whatever has to include the ground

white matrix
#

og never mine i got it

#

oh

naive pawn
white matrix
#

it worked thanks yall

#

oh but now i jump forever

rich adder
#

you probably have the player layer in the what is ground

white matrix
#

no i dont have it

#

it hit the ground and bounce off

solar hill
#

and youre positive you assigned the ground layer to all of the ground?

nimble apex
blissful stratus
nimble apex
#

but either way, i dont think i can use structs to contain my server data anymore, its too heavy to be a struct

radiant voidBOT
#

success @nelsonsucray muted

Reason: Too many messages in multiple channels
Duration: 29 minutes and 51 seconds

naive pawn
#

the main deciding factor should be what makes sense

white matrix
nimble apex
naive pawn
#

the efficiency thing will usually follow

naive pawn
nimble apex
#

lol

rich adder
#

jobs - struct, netcode - structs

balmy tendon
#

hey, so just looking for a spot to ask an odd question. working on a game for a school project (2d), and for some reason when i put the inspector in debug mode, everything behaves as it should, but swapping to normal works in a completely different way

#

if allowed, i can post a video, but its literally exactly as described

#

hold on,

#

will fix that

polar pike
#

im looking for a door code that when i press [E] it would open and if i press e again it would close ive been trying to find this for ages like 6 days every code that i tried it didnt work so can some oene help me

solar hill
#

seems like you are going to have a much easier time writing something as simple as that yourself than finding existing snippets online

balmy tendon
solar hill
eternal needle
#

figure out which line specifically doesnt work as you expect

raven smelt
#

Hi, I have a question. I'm new to this and I'd like to know if anyone knows how to use Visual Studio, or what some call Bolt. I need help moving 3D characters, as I can't find any guides.

balmy tendon
eternal needle
#

the debugger would refer to something like the visual studio debugger where you can step through code line by line

balmy tendon
#

ok, I'll take a look, however im still confused why switching the debug mode on in the inspector would cause a different execution of the code

eternal needle
#

thats why you'll figure it out through debugging. figure out what line is actually behaving differently

#

you staring at it in the inspector wont do anything if you dont know what the code is doing

balmy tendon
#

I understand that, im not worried about finding out the solution to the issue, I think I can handle that with the debugger you mentioned in VS code, just curious if you had ever seen the inspector debug mode lead to a separate outcome

eternal needle
balmy tendon
#

sorry meant visual studio

rich adder
#

thats like saying How to use Notepad to make unity player character jump

rich adder
#

wat?

balmy tendon
#

ok so I made a breakpoint for the line in question, and it triggered when it shouldn't have. image may be hard to see, but airTime at the breakpoint is -153, which is less than airTimeMax which is 300. so I don't know why this line is running?

raven smelt
rich adder
rich adder
#

-153 is not larger than 300 lol

balmy tendon
#

exactly

#

stunned=true IS running

raven smelt
balmy tendon
#

i realize my breakpoint was in the wrong spot

rich adder
balmy tendon
#

so i moved it to the next line

solar hill
#

it doesnt impact it

rich adder
#

and running.. Unity runs the code not VS

solar hill
#

writing your code in visual studio is no different than writing your code in notepad

balmy tendon
#

ok so after moving the breakpoint, everything seems to be working great, no issues whatsoever. leaving debug mode however, with no changes to script, results in the original issue. this is like some quantum issue. observing the values results in perfect execution, but when they're hidden, its broken

solar hill
rich adder
solar hill
balmy tendon
#

i dont know how to debug debug mode

rich adder
#

its probably pausing

#

and you may mistaken for working

balmy tendon
#

what do you mean by pausing? the game runs with no pauses

#

regardless of debug mode or not

#

assuming no breakpoints

rich adder
#

what debug mode ? the inspector ?

balmy tendon
#

visual studio debug mode attached to unity

rich adder
#

whats the issue happening

raven smelt
balmy tendon