#archived-code-general

1 messages · Page 35 of 1

charred geyser
#

Ok, it seems like I found a bug. Here is my problem: the EnemyTypeAndCount ain't being serialized. I'm going to test if it is because it is a record

thick socket
#

is there an easy way to make an animation run twice back to back?

charred geyser
#

Yeah, it was

rigid island
charred geyser
#

The EnemyType and Count

rigid island
#

they don't show up in inspector

charred geyser
#

Ah

#

Thank you

rigid island
#

yes, you can use [field: SerializeField] but I don't think it makes it modifiable , just show up in inspector

rain minnow
#

wait, i see what you mean . . .

leaden solstice
charred geyser
#

Makes sense

rain minnow
charred geyser
#

I see

rain minnow
#

but if you want to display a property from the inspector, use the [field: SerializeField] attribute . . .

leaden solstice
#

Disclaimer: serializing backing field could be pain in the ass if you need [FormerlySerializedAs] or something later in development

#

Just create a field and be comfortable 😄

rain minnow
#

i always wondered if that was used often or at all . . .

leaden solstice
#

Do you mean FormerlySerializedAs?

rain minnow
#

yeah . . .

#

never really seen it used . . .

thick socket
#

@leaden solstice you seem to know how to fix every problem I have...why isn't this working? 😄

leaden solstice
rain minnow
leaden solstice
#

For just simple project I'd use it and re-serialize my prefabs and remove it

leaden solstice
wispy cliff
#

Hello, does anyone know why my webgl game doesn't take keyboard input just mouse, it works fine in unity editor, but when i build and test in web it doesn't register any keyboard press, just mouse inputs, im using unity 2019.4

thick socket
# rain minnow put it in a loop . . .

if I do this but loop twice it will just make sure its set to cast 2x and not wait for the first to stop before trying to do the 2nd

character.Animator.SetBool("Cast", true);
thick socket
#

so my fireball comes out of staff when its at the "top" position

#

at 0.15f

leaden solstice
thick socket
#

at 0.3f/0f

leaden solstice
#

Then what'd be animation event doing there 😄

#

Anyways I think you want to restart your animation?

#

Wouldn't trigger parameter more appropriate than bool parameter?

thick socket
#

how it should work atm...is do cast animation, wait 0.15f(halfway through animation) spawn fireball, wait 0.15f (animation ends) then loop that for as many fireballs as I need

#

issue is the 2nd fireball spawns at time 0.3f instead of 0.45f like expected

leaden solstice
#

Is your animation looping?

thick socket
leaden solstice
#

Well bool parameter is always true because you don't set it false

thick socket
#

when its true...that entire animation plays all the way through

#

I have another character setup who just loops through the animation...the timing of the animation is correct and has no "time" inbetween

#

issue is the fireball just spawns at the wrong time

vital flax
#

So im experimenting with compute shaders and im running into this really odd problem. Here are the snippets of code: the first is one in C# and the second is one in HLSL. I think you can agree that they're pretty much equivalent. Except that I get 2 different results from each, even though they're calculating from the same data. In C#, i get 1.768514E-08 (expected) and in HLSL i get 0 for some reason and its killing me

fiery saddle
#

I dont see any git channels so iam gona ask here.
I create branch and when iam done with it i merge it to main branch, all normal. Problem is when i push changes to gitlab, old branch stays in gitlab and in vs2022.
I tried googling but either not using right keyword or not asking properly but you would usually flag that branch for deletion cause youre done with it. I dont see any of those options in vs2022. I have to manually go to gitlab and delete branch which asks me "DO YOU REALLY WANT TO DO THAT" and i second question my self a lot cause of that. Anyone knows what to do or just do it manually?

dusky lake
#

and then push

fiery saddle
hidden kindle
#

I have a issue with my bullet script

dusky lake
hidden kindle
#

Apparently if I set the speed too high, it will move too fast for it to detect collisions properly

dusky lake
dusky lake
#

what are the other modes called?

hidden kindle
dusky lake
#

If its still too fast for continous, you can cast a ray each frame from the last position to the current position and check if it hits anything

#

that takes a slightly bigger toll on performance though

vague slate
#

I really need a way too see hidden game objects in hierarchy window. Is there any way to do so?

rain minnow
hidden kindle
#

@dusky lake @rain minnow Something like this?

private void FixedUpdate()
    {
        positions[i] = transform.position;
        if (i > 0)
        {
            RaycastHit2D hit = Physics2D.Raycast(positions[i - 1], transform.position);
            if (hit.collider.gameObject.CompareTag("Enemy"))
            {
                HandleEnemyCollision(hit.collider);
            }
        }
        i++;
    }
dusky lake
#

dont save all positions into an array, just the last position into a vector

#

otherwise, yes thats what i meant

hidden kindle
fiery saddle
#

thanks

hidden kindle
dusky lake
#

each frame just put your transform.position in a private Vector3 _lastPosition;

#

next frame check for collision and then put the current transform.position in there again

hidden kindle
#

I don't get how that isn't just storing the current position

pine spire
#

You store the position after raycast

hidden kindle
pine spire
#

You don’t it hasnt moved yet. Don’t do raycast if it’s null

rain minnow
#

since you only want to check against an enemy, use a Layermask to filter the results of the raycast . . .

hidden kindle
hidden kindle
#

Alright, this is what I have

private void FixedUpdate()
    {
        RaycastHit2D hit = Physics2D.Raycast(transform.position, _lastPosition, rb.velocity.magnitude, LayerMask.GetMask("Enemy"));
        if (hit)
        {
            HandleEnemyCollision(hit.collider);
        }
        transform.position = _lastPosition;
    }
#

Let's see if it works

#

It didn't

#

The bullet now behaves strangely

#

Wait, I know what I did wrong

#

It now kinda works

#

If it lands in front of the enemy it will send the enemy flying

#

that's probably cause I have this

private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!collision.gameObject.CompareTag("Gun") && !collision.gameObject.CompareTag("Door"))
        {
            ApplyExplosionForce();
        }
        Destroy(gameObject);
    }
#

Actually, sometimes it'll apply the explosion mid-air

#

Not sure what's up with that

rain minnow
zinc parrot
#

Is there any reason that ScreenCapture.CaptureScreenshot could produce a low quality image when in editor/play mode?

thick socket
#
int firedShots=0;
    protected virtual IEnumerator ShootCoroutine()
    {
        // cooldown between multishots
        while (true)
        {
            if(pauseShooting==false)
            {
                //multishots
                while(firedShots < attackStats.multiShot-1)
                {
                    character.Animator.SetBool("Cast", true);
                    yield return new WaitForSeconds(0.05f);
                }
                firedShots = 0;
            }
            yield return new WaitForSeconds(attackStats.attackSpeed);
        }
    }
public virtual void Fire()
    {
        Bullet fireball = BulletPooling.instance.bulletPools[BulletTypes.FireBall].Get();
        fireball.transform.position = firePoint.position;
        fireball.transform.rotation = firePoint.rotation;
        fireball.Fire(attackStats.attackDmg, gameObject.tag);
        firedShots++;
    }
public class AnimationForwarder : MonoBehaviour
{
    Fighter fighter;

    // Start is called before the first frame update
    void Start()
    {
        fighter = GetComponentInParent<Fighter>();
    }
    public void Fire()
    {
        fighter.Fire();
    }
}```
AnimationForwarder Fire() is spent halfway through the Cast animation
The issue Im having is that it fires off 3 projectiles to start, then 2 over and over after...(multishot = 2) it should only shoot 2 to start with then 2 after
rain minnow
hidden kindle
rain minnow
hidden kindle
rain minnow
reef crater
#

which data path should i use in builds

#

because Application.datapath doesn't work

#

System.IO.Directory.GetCurrentDirectory() this one neither

thick socket
hidden kindle
thick socket
#

for some reason its shooting an extra time the first time it "shoots" however and Im not sure why that is

rain minnow
thick socket
#

I can't figure out why the first time it shoots it shoots 3x instead of 2 tho 😄

hidden kindle
#

I think I'll just erase everything we did and increase the fixed timestep

rain minnow
rain minnow
hidden kindle
thick socket
#

guys please, help me out of my desperation here... these white squares shouldn't be spawning over the blue tiles because they have colliders and are set not to spawn if they collide, but when I generate a new map, it takes in the tilemap collider from the previous map for some reason

#

so you see there's white squares over the previous spawnable area

#

I'm actually going insane over this

thick socket
thick socket
#

you are spawning the white squares before you are spawning(or resetting or setting the colliders) in the black ones

#

meaning the black squares the white are spawning on top of are from the previous map still

#

the white squares are the last thing being spawned

#

I have checked the order countless times, even debugged it out of desperation

#

try splitting the code

#

make it so everything not white spawns, then click like a button on scene and it spawns in the white ones

#

the white squares are objects, whereas the rest are tiles. The blue tiles have a tilemap collider 2D and are the first thing being generated

hidden kindle
thick socket
#

when I generate a new map, I clear absolutely everything. All the tiles in the map and all the objects, in this case, all the white squares are destroyed

#

so supposedly I am left with nothing

#

but when I generate the second map, what happens is, for some weird reason, it takes in the colliders from the previous supposedly cleared map

#

and generated the new objects over those

simple egret
#

If you use Destroy, then destruction doesn't happen until the end of the frame. You should therefore split the task in two frames

thick socket
thick socket
#

😄

#

that means my "click button to spawn" would have shown it working that way lol

#

glad that SPR2 actually knew tho lol

thick socket
thick socket
#

that should fix i

#

because the fact is, on my first generation before it destroys anything, it still isn't taking into account any grid, which is supposedly there

#

probably need to pastebin all your code at some point then

#

I suppose so...

#

I've been looking at this for hours though

#

it actually makes no sense at all

#

yeah but I mean, there are a lot of people here much smarter and better at coding than me

polar marten
thick socket
#

so odds are its the same for you 😄

polar marten
#

this doesn't need to be so decoupled

vagrant notch
#

This script slides down slopes, but it doesn't work on slopes of all directions. If the slope is facing the wrong way, then the object slides up the slope. What do I need to fix here?


public class slope_slide : MonoBehaviour
{
    private CharacterController characterController;

    private void Start()
    {
        characterController = GetComponent<CharacterController>();
    }

    private void Update()
    {
        // Cast a ray downwards to check for the slope
        RaycastHit hit;
        if (Physics.Raycast(transform.position, -Vector3.up, out hit))
        {
            // Check if the slope is steeper than 25 degrees
            float angle = Vector3.Angle(hit.normal, Vector3.up);
            if (angle > 10)
            {
                // Move downwards in the direction of the slope
                Vector3 slopeDirection = Vector3.Cross(hit.normal, Vector3.right);
                characterController.Move(slopeDirection.normalized * Time.deltaTime);
            }
        }
    }
}

https://i.gyazo.com/b86da98ca7edf452464e7fb62dea570c.png

polar marten
#

you know an object with center x,y and radius r will not overlap with a tile with gridpoint col, row and side length gridSize if

leaden ice
polar marten
#

(in pseudocode)

vagrant notch
polar marten
#
check each corner of the grid square
if it is less than radius distance
 from the center of the object you are placing
 the grid square and object (simplified as a circle) overlap

if you got this far, the grid square and object do not overlap.
#

@thick socket does that make sense?

#

so you don't need to use physics at all

#

you only need to check a few grid squares

#

whenever you spawn

thick socket
# polar marten hmm, it might be better to query where the blue tiles are directly

I'm not sure that's exactly what I'm trying to do though. What I'm doing here is spawning an object through the location of each tile with a small offset for the x/y so it looks more random. The objects themselves aren't overlapping so that much is working well. But for some odd reason, they are only looking at the previous collidable grid for collisions so it always looks like the white squares formed a border over the previous map, instead of the new one

polar marten
polar marten
#

there ar elots of reasons why the time you are using those physics queries is wrong

#

it's not super interesting to deal with

thick socket
#

yeah, I'm doing it because of the objects themselves, since they're spawning at random positions and might overlap themselves

polar marten
#

anyway i think you'll figure out on this journey what's going on

#

someone said that there's a difference between when Destroy is called and when its side effects propagate

thick socket
#

but the problem occurs before Destroy is even called

polar marten
#

sorry i can't be more helpful

#

you have a lot going on

thick socket
#

no it's okay. Thank you

polar marten
#

when you use the physics system for non-physics things, like spatial queries, there are nuances

thick socket
#

it's just what's occurring here makes no sense. Like, for the spawning, it is doing it in the correct positions, perfectly, but only after I create a new map

#

and since it's a new map, the positions won't be making sense for it, just for the previous map which was just cleared

#

I don't understand why

polar marten
#

the state of the physics data you are querying using Physics.OverlapX hasn't changed between the old map and the new map, but you think that it has

#

that's it

#

if you are using Physics.OverlapX to place objects on your map

#

which i think you are... you haven't shown enough code to know, but that's my guess

leaden ice
#

I mean I mentioned that a while ago - that the colliders won't update until the next physics simulation

thick socket
#

do you see this? It's the first map that's created when I initially run the program. It has no previous reference border

polar marten
#

yeah

#

listen

polar marten
#

are you placing the objects using physics.overlapX?

leaden ice
thick socket
polar marten
thick socket
# leaden ice and what did you find

I found the Physics.autoSimulate and uhh Physics.Simulation or something like that. I called that and it said in the console there was no need because Physics.autoSimulate was enabled

polar marten
#

anyway you can try doing this

IEnumerator ReplaceAndGenerateNewMap() {
 RemoveOldMap();
 GenerateNewMap();
 yield return null;
 PlaceDecorations();
}
#

do you know how to use coroutines?

thick socket
#

so I imagine it might be that

polar marten
#

anyway i think there's a lot going on in your code

#

so i think you'll figure it out

leaden ice
#

or waiting for the next FixedUpdate

thick socket
#

where would I put that?

leaden ice
#

whenever you want to force collider updates

thick socket
#

so before I spawn the objects would be a good idea right?

#

I put it all over the place just to test it out

#

before spawning the objects, after creating the grid, before spawning every object... still the same result

thick socket
polar marten
#

my guess is the solution is the one i wrote earlier, which is to not use physics.overlapbox to make these queries*

#

you could also be using the wrong grid or be misusing it somehow

#

it's okay to kind of muddle through procedural generation - every procedural map generator has a crazy ants architecture

#

maybe you can attach the debugger and step through some of your generation steps

#

and see if what actually happens matches your expectations

polar marten
#

it's just so hard to know what's going on without seeing all the code

floral coral
#

How can I have an array of something (float2 in this case) with a variable length (determined in the C# script) in a compute buffer/compute buffer struct?

thick socket
#

this might be asking too much but I can stream it. Though there don't seem to be any voice chats in the server

leaden ice
#

kinda depends what you mean by "variable" though

#

like actually changing over time?

floral coral
#

At the start of the game (in the inspector)

#

I want to have positions for a line, and the length to be set before I start simulating

leaden ice
#

you just allocate the buffer at the size you've set in the inspector

#

(or the size of the positions array)

#

and use it

swift falcon
#

Why not just use a List<>?

#

Ik u want a array but that might me be over engineering

simple egret
#

As far as I know compute buffers don't allow reference types, they might be referring to a NativeArray<T>?

rain minnow
simple egret
#

Or I'm mixing it up with Burst stuff

leaden ice
#

I don't really know what Lists or NativeArrays or refrence types have to do with ComputeBuffers - which was the original question

polar marten
#

each element in your computer buffer would be the point of the line

swift falcon
#

Oooh sorry

polar marten
#

seems pretty cut and dried

floral coral
#

And I have another question about compute shaders:
If the number of threads is set to [numthreads(64,1,1)], and I dispatch it shader.dipatch(kernelNumber, Array.Length/64, 1, 1);
And the length of the array is 246, the shader gets "dispatched" 4 times.
In the first "dispatch" the id of n cell is n, the second time it's n + 64 (the number of threads), the third time it's n + 64 *2 (the number of threads, times two because it's the third "dispatch")
Am I understanding it right?

polar marten
#

you do not do

[VFXType(VFXTypeAttribute.Usage.GraphicsBuffer)]
struct Line {
 Vector2[] points;
}

var buffer = new GraphicsBuffer(..., 1, sizeof(Line));

you do

[VFXType(VFXTypeAttribute.Usage.GraphicsBuffer)]
struct LinePoint {
 Vector2 position;
}
var buffer = new GraphicsBuffer(..., numPoints, sizeof(LinePoint));
#

does that make sesne @floral coral ?

#

it sounds like you already know this

sick compass
#

does anyone have any tips for someone starting out making their own 3d assets?

polar marten
#

after reading your second question

floral coral
polar marten
#

are you asking is there a technique for variable length arrays inside graphics buffer elements?

simple egret
floral coral
#

I want to make a trajectory line to know where n number of rigid bodies will go in a gravity simulation

#

Something like the trajectory line in KSP

peak night
#

Hi could someone help me with my WheelCollider code?

rigid island
swift falcon
#

why thoughn

#

for basic code?

rigid island
swift falcon
#

okay

rigid island
#

also the channel is more active

swift falcon
#

good to know

peak night
#

I added wheelcolliders, and used GetWorldPose, but when i press play, the wheels go above the car and i don't know how to fix it.

foggy pasture
#

yo, i have a pretty simple question about sprite sorting- is it possible to change a sprite's pivot for the sake of sorting without also changing its position in the game?

polar marten
#

do you have a working C# implementation?

floral coral
#

No, I thought it would be too slow to try it in c# since it gets called called in fixed update to simulate the gravity a few hundred times at least, but (I think) I know how to calculate it

polar marten
#

hmm

#

well you know a lot about this but generally, to get people to collaborate on this kind of problem you need
1 a working C# implementation
2 then you can try making an "HPC#" implementation (i.e. burst-compilable jobs)
3 then you can see if any of this would be sped up by gpu

#

there are dedicated libraries for gpu accelerated rigidbody physics but they do not necessarily solve your problem

#

also i'm sure there is a specific implementation in computer buffers for the "n body problem"

#

@floral coral is this helpful?

#

it's kind of an exercise for you

#

if you want this to learn compute shaders you will have to strugglebus through this yourself

floral coral
#

Well it is something, but I want something to simulate a few bodies (15 max) for planets, and more for how many rockets/vehicles there are in a scene. I can simply not make lines for un-controlled vehicles, so this line needs to be generated a few times per fixed update. Then there is the real-time simulation, which is a few hundred times less to simulate. And this is just for a project (of a beginner frankly) and optimization isn't my main concern (that being for the project to work)

polar marten
#

really depends what your learning goals are

floral coral
#

To learn how to:
Use compute shaders
Use compute shaders to make a trajectory line

polar marten
#

15 bodies is fine (n body problem is O(n^2))

#

okay

simple mountain
polar marten
#

meaning 15 is too few

#

for this to matter

floral coral
#

I want to have some planets and moons. The main point of the project is programming the vehicle.

polar marten
#

it is definitely realistic to do this in a compute buffer from scratch (euler method for n body is very simple)

#

but 15 is so few, that you will spend more time reading back and forth from gpu memory

#

due to how that works in reality, in a pipelined graphics engine like unity

#

than you will computing this in c#

#

hpc# (i.e. burst compilable C# for unity jobs) is prob the best fit

#

if you want to learn something

floral coral
#

If I write and read from GPU memory on fixed update?

polar marten
#

in short, while a gpu is like a 1,000 core cpu, the API to get and send data from it is like a single core computer without pre-emption - it's a queue

#

for this express purpose, an nvidia graphics card usually has 4 distinct queues (drawing, copying memory, async compute programs, and encoding/decoding video). and async compute isn't supported in editor earlier than 2022.2, and you will need to run the editor in dx12 on windows

#

so it interacts a lot with your specific hardware

#

if you do not Do These Really Nuanced Things Right

#

you will wind up waiting 1-5ms for a result from an async compute shader

#

almost always (99.9999%) tutorials you read online retrieve the results that were computed from the previous frame

#

which is to say, if you're willing to wait a whole frame (16ms), use hpc#

#

do you see what i mean?

floral coral
#

WELL

#

That is >60 fps!

#

I guess

polar marten
#

SystemInfo.supportsAsyncCompute probably shows false for you in editor right now

floral coral
#

I'll make it in C#

polar marten
#

lol

#

okay

#

i don't want to take you away from your learning goals

#

it's always a balance

#

the article i linked is sort of a tutorial but it's bogged down by specifically translating n body to compute shaders

#

so you'll need to have a correct C# implementation anyway, to understand the problem better

floral coral
#

Maybe I'll make some boid or agent simulation, the one's Sebastian Lague made we're pretty cool

polar marten
#

you will always want a working C# implementation

#

if you stick to Dr P's Strategy you're way more likely to get something that works

simple mountain
polar marten
simple mountain
#

oh xdd

polar marten
#

because 99.99999999999% it's the wrong choice for your problem

simple mountain
#

it s basically hlsl I think

polar marten
#

like why are you doing this in a compute shader?

simple mountain
#

Idk because I thought it would be faster

polar marten
#

okay well, the fact that you can't find a way to calculate a square root without loss of precision should be a big signal that it's not for general purpose computing

simple mountain
#

yes, the only way I could think of was writing my own squareroot function, but that was really slow

polar marten
#

you should stick to the same strategy. have something that works in C# first, then use HPC# (jobs), then see what makes sense to turn into gpu acceleration

simple mountain
#

I already have both of that

polar marten
#

okay

#

is it slow?

#

did you profile it?

#

most of the time, stuff that people do is slow because it's written poorly

simple mountain
#

yeah it s just really cpu intensive

polar marten
#

not because it's inherently slow

simple mountain
#

it s about the procedual generation algorithm, I tested both and indeed the one on the gpu was faster for a mesh of 240*240 vertices

polar marten
#

like what is the time complexity of plant generation? probably O(n * r) where N is the length of your starting string, R is the number of rules you have for an L-system

#

which is nothing

simple mountain
#

O(n * r)*240 x 240

polar marten
#

i don't know what you are trying to do

#

you're trying to make 240 * 240 plants?

simple mountain
#

planes

#

the planet uses an lod system

#

and in total I'm rendering 4-8m vertices at all times

#

which means that yes there are a lot of calculations

#

I'll show you some of my code if that helps

#

#myCode

polar marten
#

okay

#

it really depends what your goals are

#

there is a ton of tradition around making huge amounts of foliage

#

do you care about any of that pre-existing stuff? @simple mountain

simple mountain
#

how do you mean?

polar marten
#

hmm

#

okay based on the code snippet you shared you are on the start of a very, very long journey

simple mountain
#

I used a preexisting library to calculate the noise, but in general I like to do my own stuff

polar marten
#

do you know what an L-system is?

simple mountain
#

don't think so, unless you mean a tree structure

polar marten
#

is it plants? is it planets? is it planes? what are you trying to do

simple mountain
#

noo

polar marten
#

and you typoed it

#

those three things are very different and it looks like you typoed a few times

simple mountain
#

okay so
Planet referes to a spherical mesh and
Plane referes to a Flat mesh

polar marten
#

what are you trying to do

#

you don't have any plants?

#

anyway

#

i think you will be fine on this journey

#

good luck out there

simple mountain
#

xdd

#

you can look at my code if it instrests you and I'm always open for improvements

polar marten
#

it still has typos in it

simple mountain
#

what s a typo?

elfin vessel
#

can someone remind me: if I do a physics raycast with a LayerMask.NameToLayer("Foo") Does it only collide with the layer Foo or does it collide with everything Except the layer Foo

polar marten
simple mountain
#

my problem is: I don t know calculate SquareRoot of a double in a computeshader

polar marten
#

when you have defeated Mr. Typo, you can come back to me

leaden ice
#

You need to use LayerMask.GetMask("Foo")

#

then it will collide only with Foo

elfin vessel
#

and I could use a ~ to invert that, right

leaden ice
#

yes

elfin vessel
#

ok cool thanks

static oracle
#

Hello, question for anyone out there that might know.. We're using the Input Manager & Input.GetButtonDown(...) in an update loop to trigger certain events. However, we also have a text input field that the user must type in that also triggers the GetButtonDown while typing. Is there a way to disable the Input button events when typing besides creating various bool checks in the update function?

leaden ice
crimson moth
#

I'm using A* Pathfinding (https://arongranberg.com/astar/) and it seems that the way the path finding works is by manually adjusting the game objects position. Is anyone familiar with A* and how I could modify it to use forces?

static oracle
rigid island
leaden ice
crimson moth
rigid island
#

without A* you need distance checks , directions + raycasts

#

lots of raycasts

#

;p

static oracle
#

at least not any time soon

leaden ice
crimson moth
leaden ice
#

You could make yourself some kind of central input handler script that implements its own enable/disable functionality

leaden ice
#

both in general A* algorithm, and with the Aron Granberg asset

static oracle
#

ya there are a few work arounds which are possible, I was just checking here to see if there was any quick solutions to my issue. Thanks for your responses.

rigid island
crimson moth
rigid island
#

something like this for example, no reason you can't use that info your custom move

polar marten
#

that said, you probably should be using EventSystem

#

if you're listening for mouse clicks

#

really depends what your goals are. to have a less buggy game?

#

if you're only encountering this now i have a feeling this isn't a shipping game right @static oracle ?

#

it might take you a few hours to port to input system

#

and a few more hours to use EventSystem

#

and a ton of bugs will go away

frigid viper
#

Hi does anyone know the best way to handle transitions between areas in isometric games when they are enclosed (like underground areas)

#

One of tunics development updates shows what I mean

frigid viper
#

I believe so at least with how I’m doing it right now

#

It seems most related to code

#

At least that’s how I’m currently handling it

rigid island
#

wdym by transition ?

frigid viper
#

This is the inspiration I’m going for

#

It darkens rooms as the character enters a new one

#

Right now I’m handling it by looping through the objects if a room and changing the layer for each one

#

But I feel like there is a better way

rigid island
#

Oh I see, so they are using like a visual mask

#

yea Layers is something I would think to do as well

frigid viper
rigid island
#

yes I assume Masking is how they hiding the parts they don't want?

frigid viper
#

I’ve never done that with meshes

#

Unless you’re just talking abt the layer stuff

rigid island
#

It can be anything, it can literally be the shader or something when it steps out of the camera frustum it changes or something

#

I'm no expert in VFX tho lol don't quote me on this

frigid viper
#

oh Alr

#

Yeah same

#

I really liked the effect it had around edges as well like the little blur

static oracle
polar marten
#

you will either reinvent input system to fix this bug

#

or you will use event system

#

or you will use Input System

#

it's not really "workarounds"

#

i mean maybe "workaround" is the right word when you have to do this psychological warfare on your bosses who "just" "want" "it to work"

#

but dude i am in the no bugs in games writing business*

static oracle
#

I totally understand and if it were up to me I would redo these things properly.. but I've just just jumped into this and it's already almost out the door. I think it will have to be bandaids until I can convince them to spend time on it

polar marten
#

the plugin i author for publishing unity games doesn't even allow Input. to be used because 100% of the time it is a source of a bug later down the line

polar marten
static oracle
#

😛

polar marten
#

you're already a critical "Just" patient

static oracle
#

just just just get me outta here!

polar marten
#

lol

#

the bandaids are recreating Input System

#

it truly is

#

you will be creating a new class that wraps Input. calls

#

and presenting a new abstraction layer

#

i've seen this in every codebase that uses Input.

static oracle
#

I'm literally half way done doing just that heh

polar marten
stable rivet
polar marten
#

there's no "just" here! this is not an easy thing to do

static oracle
#

🙃

polar marten
#

your people are not this stupid

#

you can copy and paste this conversation directly into their slack or discord or god help you microsoft teams

#

you will still spend the same amount of time

#

you will spend less time in total using input system

static oracle
#

I mean, the entire app doesn't heavily relay on keyboard inputs anyway so a few bugs/missed key presses is not a big issue anyway

thick socket
polar marten
thick socket
#

I tried putting the UI.text instead but no dice

polar marten
#

you don't need QA to know that

somber nacelle
# thick socket

UI.Text is legacy anyway, you should really be using TextMeshPro at this point

polar marten
#

then you can get rid of all this code simulating mouse versus touch inputs or whatever

#

all this stuff

stark swift
#

Anyone know how I can serialize a Script graph in c# ie [SerializeField] private ScriptGraph _scriptGraph ?

thick socket
polar marten
#

migrating to Input System, there's a whole page on it

dusk apex
polar marten
#

then i guess, you know, it doesn't matter

#

does this use AR?

somber nacelle
thick socket
#

didn't work

#

thus

#

I came here lol

stark swift
#

ahh never mind i got it 😄 [SerializeField] private ScriptGraphAsset scriptGraph;

stable rivet
static oracle
polar marten
#

okay okay good luck out there

somber nacelle
# thick socket yeah I tried that

you'd have to do more than just change the type of the variable if you plan to get this working because obviously the code will likely be relying on the specific type of object to interact with it

thick socket
#

at least the only thing I needed were the effects 😄

hard sparrow
#

The only reason you would use an interface over an abstract class is if you need multiple inheritance, yes?

rain minnow
#

if all classes can inherit from the same base, an abstract class is fine . . .

hard sparrow
#

Can you provide an example of when you used an interface rather than an abstract class?

rain minnow
simple mountain
#

is there a way I can make some kind of property that iterates trough multiple value types?

rain minnow
#

@hard sparrow instead, you can implement an IDamageable interface that both, the barrel and Enemy class can implement with a ApplyDamage(float value) method . . .

somber nacelle
thick socket
#

@polar marten dude uhh... I don't even know if I can call this a fix but I found the dumbest patch ever to my problem

#

it's actually ridiculous

leaden ice
#

as has been said

#

this isn't robust though

rain minnow
leaden ice
#

because that might not be enough to cause a physics simulation to happen

simple mountain
# somber nacelle you should explain what you are trying to achieve and why <https://xyproblem.inf...
public struct Layout
{
    #region public fields

    private Unit x, y, width, height;
    

    

    public override string ToString()
    {
    }
    #endregion
    public Layout(string input, Align align)
    {
        
    }
    
    public Align Alignment
    {
    }
    
    #region properties
    public string position
    {
        set
        {
            Unit[] xywh = new Unit[4];
            List<string> splitStrings = StringMath.SplitString(value, ",");
            for(int i = 0; i < splitStrings.Count; i++)
            {
                (double, string) valueUnitPair = StringMath.InvalidStringToDouble(splitStrings[i]);
                xywh[i].Value = (float)valueUnitPair.Item1;
                xywh[i].Key = valueUnitPair.Item2;
            }
                
            
        }
        get
        {
            return x.Value+x.Key+","+ y.Value+y.Key;
        }
    }

Yes so in the public string position field I'm to set the variables x,y,width,height the array represents x,y,width,height variables and I would like to itterate over those 4 while still keeping their naming for convenience

rain minnow
#

@thick socket didn't someone mention using a coroutine for this (to spread across multiple frames)?

thick socket
#

though dude

#

don't get me wrong

#

I listened to your advice, I just can't apply it

thick socket
#

so what I need to do is wait a frame, but how do I do that robustly, as you guys say?

#

I am sorry, I am just terrible at programming

#

coroutines is it?

polar marten
#

it's okay

#

you'll figure it out

thick socket
#

nono, as I have it right now, it is working

#

it's just not the right way and apparently it might not work every time

#

let me check if I can get the coroutines going

simple egret
thick socket
#

though I had no idea that was a coroutine or what it was

#

I tried using it but it didn't do anything

somber nacelle
thick socket
#

I didn't know I needed a StartCoroutine(X()) to make it work

simple mountain
#

idk I just wrote it my own because I don t know json

thick socket
#

yep, that works now...

rain minnow
somber nacelle
thick socket
simple mountain
#

for convenience mainly

somber nacelle
#

that doesn't answer the question at all

simple mountain
#

for this

somber nacelle
#

let me introduce you to my friend the Vector2

simple mountain
#

I might add that later

thick socket
#

well, I still think it is an odd fix but it is working. Thank you guys. And sorry that I had to come back so many times for this, it is finally over

somber nacelle
# simple mountain I might add that later

okay well i'm not even going to try to help you with your harebrained scheme of whatever the fuck it is you're doing because it makes absolutely no sense to do that instead of use the already existing types and tools to do it much easier and in a much more performant way

simple mountain
#

I think what I was asking for is a refference array, which doesn t exist

shadow sonnet
#

I don't know if this is the right place to ask, But right now I am a bit of a conundrum.
I have a custom tilemap system which generates tiles itself that doesnt use unitys built-in tilemap system, however I'd like to have a compound tile that can collapse into different tiles, similar to rule tiles with built-in tilemaps. Can anyone point me into the right direction of how I can code this myself, since I have no idea where to begin with this, or if possible how I could use unitys tile rules without using unitys tilemap.

solemn raven
#

hey why is this wrong ?

int A = 24;
int B = 10;
float results = A / B;
// results = 2; .... not 2.4
shadow sonnet
somber nacelle
rain minnow
solemn raven
#

@shadow sonnet @somber nacelle @rain minnow Thank you ❤️

vagrant notch
#

How much overhead is there when you parent 3-4 objects together per "character"? Is it advisable to do things that would save trouble in terms of programming via extra objects, or does it have a heavy performance cost?

calm wadi
vagrant notch
calm wadi
#

is this a bad way of doing 2d movement? It feels like there's an input delay on my key presses

void FixedUpdate() {
       // handle movement
        float horizontal = Input.GetAxis("Horizontal");
        float vertical = Input.GetAxis("Vertical");
        Vector2 movementVector = new Vector2(horizontal, vertical).normalized;
        if (movementVector.magnitude == 0f) movementVector = Vector2.zero;
        rb.AddForce(movementVector * rb.mass * acceleration);
}
vagrant notch
calm wadi
#

yes it is, it goes from zero to top speed near-instantly

vagrant notch
#

I don't see why there would be any delay unless it's affected by mass or acc. I'm using the same input system more or less for 3d, and it works without delay as far as I can tell.

rain minnow
worldly hull
#

get input in update, do movement calculation on fixedupdate

crimson moth
#

I'm trying to use A* pathfinding and when hitting "Scan" to create grid graph, nothing happens but the console logs that it was complete.

#

Anyone familiar able to lend a hand?

arctic lintel
polar marten
prime sinew
# calm wadi thanks

Jason weimann has a video on update vs FixedUpdate that'll explain how to do this properly

arctic lintel
#

that is not my problem... my problem is when i click to move or anything else and i move my head, it doesnt turn like what i want

polar marten
#

for example, in your OnPointerEnter handler for your virtual joystick, cast PointerEventData to ExtendedPointerEventData and add the pointer to a set. you can dynamically enable/disable a input system action for each pointer that isn't that pointer; or, you can listen to your UI/Delta (or similar) action and ignore, in code, events from pointers currently being used by UGUI.

polar marten
arctic lintel
#

yep

#

exacly

polar marten
#

this would be the case if you are using Input.mousePosition to compute a delta or Input.GetAxis(...) to query unity for a delta directly and you are emulating mouse using touches

#

which obviously isn't going to work for you because a mobile device is multitouch

arctic lintel
#

but the real problem, it's that when the multitouch activate, it cound like i mouved ans this is what i dont want, multitouch isnt the problem, juste the movement when actived

polar marten
#

so i don't know what to tell you, you can reinvent Input System using Input and try to fix this issue

polar marten
#

you can ask questions about the solution, that might help you understand it

#

or you can try to tell me i don't know what the problem is

#

there's no easy fix

#

if you want to use the camera movement and eventsystem together (i.e., the Button scripts on your movement UI elements), you will need to specify which touch moves the camera. this is a lot harder to do with Input than it is with Input System

arctic lintel
#

when I touch with 1 finger, no problem happen... when I put 2 or more, it takes the middle point of them... but when it is putting the middle point, it is counting this as moving. and I dont want this...

polar marten
#

it's not that much harder*, but it would require extending StandaloneInputModule and doing something pretty arcane

polar marten
#

as soon as you try to use Input.touches, you will not know whether one of the two touches is being used by UGUI or not. you will have to determine that heuristically, for example by using screen regions; or, in Input, you can query the pointerId for a pointer event data using protected methods in the StandaloneInputModule (so you'll have to subclass it); or, you can use Input System and query directly

#

also, as soon as you use Input.touches, you'll have to make the code make sense for the editor

#

there can be surprising misbehaviors here. for example, the mouse is always moving in the editor, but not pressing.

#

@arctic lintel does this make sense?

#

in any case, you can't use Input.GetAxis

#

🫡

#

you will not know whether one of the two touches is being used by UGUI or not. you will have to determine that heuristically, for example by using screen regions
this is probably the most useful approach for you

#

@arctic lintel another approach is to exclusively use event system. for example, place a 0-alpha Image behind your controls (i.e., an object that can receive graphics raycasts, but doens't do anything visually), and add a script with IBeginDragHandler and IDragHandler interfaces onto it.

#

this image should cover the whole screen. whenever you touch and drag on this image, you'll receive calls to OnDrag(PointerEventData pde)

#

and that pde object has a delta property which you can use instead of Input.GetAxis

#

that PointerEventData object will correspond to a distinct pointer (i.e. touch) and it will Just Work

#

i see that i made your brain explode and you yeeted out of here in frustration. this is okay. you are on an early part of your mobile game development journey.

coral hornet
#

just a quick question:

how should i go about making plant vines? i basically want to have the player be able to sprinkle seeds that can be grown out into infinitely long vines, i want them to squirm about and brush up against walls they collide with, with each step bieng a different vine

i can set up a simulation, but im mainly wondering how i should go about making this visually

rich leaf
#

Hey, is it possible to trigger onEnable to run again inside the same script?

#

Like i have a script that does some initialization stuff, and i want a condition in my Update() method that basically triggers the script to disable and enable again.

#

i was thinking of doing like this.disable and in the onDisable function just do this.enable. Will this cause issues?

worldly hull
buoyant crane
coral hornet
buoyant crane
coral hornet
worldly hull
#

high end modeling software can use python scripting to achieve this

#

dunno in unity tho

coral hornet
#

i could probably do it as a baked operation, since i dont really need the vines to curve around things like players or enemies, because they grow incredibly slow

#

but i also intend for the player to be able to cut the vines..

#

perhaps i could place gameobjects that have meshes of different vine segments in a way to achieve the effect?

rich leaf
#

Thanks

polar marten
coral hornet
polar marten
#

and want like, lots of vines all animating

coral hornet
#

nah itl be alot on the CPU

#

the vines will be practically still

hard sparrow
#

How dumb is this?

#

ignore the spriterenderer

#

(uic = ui controller)

cosmic rain
west sparrow
#

Keeping in mind, I don't know what a status is in this context, or why it needs a private setter, or why you would want the status and the reference out of sync

#

So it might be a solution to a problem that I'm not knowing, and I hesitate to provide much advice on it

hard sparrow
#

I thought I needed to instantiate it because I wanted statuses to be able to remove themselves and decrement their own durations and such

cosmic rain
#

Why can't you do the same with plain classes or SOs?

hard sparrow
#

I guess I'm supposed to make StatusEffect an SO and have the UIC track duration and handle removing and such?

cosmic rain
#

You could have a plain class StausEffect that holds the status effect SO and the runtime state of the current effect, like duration and such. Then you can update a list of effects from your script(not sure what UIC is).

unreal temple
# hard sparrow How dumb is this?

If you want a clean solution you can use an SO with serialised reference for the behaviour, then use one of the unity plugins that gives you a dropdown for the serialised reference

#

There are a few, including Odin

#

There are two on open upm two, I've tried them both and they're both good

#

So a single status effect SO, but you can select its functionality from a dropdown instead of using inheritance

#

Works a treat

#

I do mine using graphs because we have very complicated status effects, but that's a huge can of worms

sterile tendon
#

I made an infinite breaking bad episode generator in python that spits out mp3 text to speech audio for each character in order

sterile tendon
#

after the mp3s are generated, how do I access them in c# and play them in order?

#

I thought about making them one big mp3 but then it would be way harder to get information on which character is talking at what time

#

right now they're formatted like "(index) - (character name)"

unreal temple
sterile tendon
#

oh audiosource isn't instantly loaded?

#

that explains a lot

#

thanks

unreal temple
#

Lol I just googled it

#

Never tried before

#

I'd def go with the individual files though

sterile tendon
#

I'll see if I can figure it out

unreal temple
#

That way you can keep them generating in the background and loading them on the fly

sterile tendon
#

yeah I really didn't want to export labeled timestamps or something

#

right now it generates them in batches

unreal temple
#

I assume this is something like that amazing Seinfeld show?

sterile tendon
#

yeah almost exactly like it except I built a chatGPT webscraper and ask it to continue from the previous prompt

#

it's hilarious, it goes off the rails after 5-6 iterations

unreal temple
sterile tendon
#

I also coded in random chance "mood affectors"

unreal temple
#

And then have the unity program step through it line by line

#

Loading the file and playing it with the subtitle

sterile tendon
unreal temple
#

Waiting for the audio to finish is easy enough, the entire program could be a giant coroutine

sterile tendon
#

right now it generates one script ahead and shifts everything from newScript() to script()

unreal temple
#

I'd go all in on coroutines. Just a big while(true) loop that loads the script, plays it out, loads the next script and so on

sterile tendon
#

that's pretty much what the python script is haha

unreal temple
#

I did this for an interactive narrative game

sterile tendon
#

since the webscraper holds the tab open it has to be a giant while loop

unreal temple
#

You can call out to the python program to ask for the next script

sterile tendon
#

so it waits for the c# script to tell it to generate a new script and make the audio and stuff

unreal temple
#

Yeah perfect

sterile tendon
#

hopefully it shouldn't be hard to control with c# now that the python stuff is done

unreal temple
#

Can you DM me when you've got something to show? I'm very interested in this XD

sterile tendon
#

oh I can show you some of the example scripts it makes

unreal temple
#

Yes plz! DMs are open

potent glade
#

how does someone get the back buttno input on the phone [with and without the new input system]

prime sinew
potent glade
#

i used "input.backbuttonleavesapp = true" that should work (haven't tested it yet) but what about ios.. that's my concern

mellow sigil
#

iOS devices don't have a back button

plucky inlet
#

You only have the swipe back action when you swipe from the left on iOS

potent glade
#

ah ok

#

(i dont have an iphone obviously 😂 ) thank you both

lusty dragon
#

Hey yall, my mind is stuck.
How do I create a new 'type' in c#.
I mean like: myColors that can only take red and blue using a dropdown

#

I remember using something like a struct

plucky inlet
#

enum?

lusty dragon
#

thank you

#

Sadly you cannot use a method that has an enum as a parameter as a clickEvent :/

thin aurora
#

You can translate whatever the event brings to your enum?

lusty dragon
plucky inlet
#

Oh you mean like in the inspector having the dropdown?

#

Inside the onclick event

#

You could write your own class that you can use to set in the inspector and just onClick.AddListener in your script to hook into the button

lusty dragon
#

That's true, nice idea. The reason is to avoid a switch case mistake using the strings etc. That approach seems nice

thin aurora
plucky inlet
#

It would just be a class on the gameobject with a button, on that you already can set your enum. But SO can be an alternative depending on the complexity

lusty dragon
#

What property of the camera should I change in order to zoom in? (Z axis is not working on a 2d game)

plucky inlet
thin aurora
#
[SerializeField]
float zoomFactor = 1.0f;

[SerializeField]
float zoomSpeed = 5.0f;

private float originalSize = 0f;

private Camera thisCamera;

// Use this for initialization
void Start()
{
    thisCamera = GetComponent<Camera>();
    originalSize = thisCamera.orthographicSize;
}

// Update is called once per frame
void Update()
{
    float targetSize = originalSize * zoomFactor;
    if (targetSize != thisCamera.orthographicSize)
    {
        thisCamera.orthographicSize = Mathf.Lerp(thisCamera.orthographicSize, 
targetSize, Time.deltaTime * zoomSpeed);
    }
}

void SetZoom(float zoomFactor)
{
    this.zoomFactor = zoomFactor;
}
#

Maybe adjust the if statement since comparisons with floats should not be done like that btw

lusty dragon
#

Thank you

swift aspen
#

How can I force remove a component and it's dependencies? I.E CompB has RequireComponent(CompA). If I call Destroy on CompA it won't do anything, pointing out CompB is dependent on it. But if I call Destroy on B, A will remain.

thin aurora
#

Or add custom behaviour to an onDestroy method

#

Can't really prevent it without RequireComponent but you can log a message and maybe add it back in an onDestroy method

swift aspen
#

I think you're misunderstanding. I want to remove the component CompA, but I can't since CompB has dependency on it. afaik I can't from code figure out (maybe through reflection) which components I would have to remove first before I can remove A

simple mountain
#

how do you work with untity's camera functions like
WorldToScreenSpace, ScreenToWorld, ScreenToViewPort
I'm trying to add buttons to my own ui tool, therefore I need to
1.st project the mouseposition to my ui, I'm using an ortographic camera for this
2.nd project the mouseposition onto my workspace, which is using a camera with perspective
I think the first one will work something like

public Vector3 MousePosToOrtographic(Vector3 mousePos,Camera camera )
{
Vector3 point = camera.ScreenToWorld(mousePos);
return point;
}
public Vector3 MousePosToWorld(Vector3 mousePos, Camera camera)
{
Vector3 position = camera.GetComponent<Transform>();
 Vector3 point = camera.ScreenToWorldPoint(//idk what to put here);
}
//would be great if someone could help me 
restive dirge
#

I am trying to create an endless line drawing game, am using Linerenderer with edge collider2d on it, as it is an endless game will the the increased number of points in the line renderer and edge collider2d affect the performance of the game

thin aurora
swift aspen
#

That would just break the purpose of RequireComponent? I want the attribute to ensure prefabs are correctly set up

thin aurora
#

If you want to ensure the component exists, do it in an onValidate method instead of using the attribute?

#

But these also run every validation cycle, so you will still have the issue

#

So you should ask yourself when you need it. Perhaps do it in a Start method if you want it to appear during runtime?

#

Either way, my point is custom behaviour is probably better than RequireComponent in your case, so that you can define how it should work.

#

Adjusted my messages since I was thinking out loud 🙃

swift aspen
#

Yeah I noticed 🙂 Can't really work around that though, so I think I just have to do the full reflection lookup and delete each component in order.

#

Anyway thanks for your help 😄

thin aurora
mental rover
swift aspen
#

It's in editor time, so performance is kinda irrelevant 🙂 Can't tell to much since NDA but the base idea is that I can define a meta-template for a type of prefab. Then I can create instances of that prefab using the template, now if someone modifies the template I have a function that updates the instances, either by adding or removing new/old components.

#

First plan was to use Prefab and Variants, but they come with their own slew of UX issues, and creates a hierarchy which is unflexible at times

thin aurora
#

Yeah, onValidate sounds best I think. just make sure you're in editor more somehow, because this also runs in play mode (I think??)
The only problem is figuring out how you can only add components on the first run, and not when you remove them

swift aspen
#

Honestly scrapping usage of RequireComponent is a good valid approach here. Since if the template is used anyway, it's sort of doing the same thing

restive dirge
fringe ridge
#

Is the gravity calculated with refresh rate in mind? Because it feels like when the fps is lower the objects fall slower.

prime sinew
fringe ridge
#

okay, so basically to account for slower computers I should simulate the gravity myself?

#

in 2d it shouldnt be hard, but maybe there is an option

prime sinew
#

slower computers..? i dont think so. it's not device based

#

it's based on the time step that's set in the project

fringe ridge
#

oh, my bad misunderstood

#

I unplugged my laptop and put it in power saver mode

#

now the gravity feels like reduced

prime sinew
#

but honestly, this is just my assumption.. Gravity is a physics thing, and physics stuff is done in parallel with FixedUpdate

#

thats odd. sorry I can't be more sure

fringe ridge
#

No worries, i'll try plugging my laptop back in at home and testing it out.

mellow sigil
#

It's more likely an optical illusion. Things moving in lower framerate look slower even if they really move at the same speed. Measure, and if there's really a difference it's more likely that there's code that interferes

keen spruce
#

Im developing a plugin for unity but it seems I cannot access the Vector2 struct because its in UnityEngine.CoreModule

tired sorrel
#

hi. i have this

    private void Tree()
    {
        foreach (Transform tree in Trees)
        {
            float dist = Vector2.Distance(tree.position, CollectionPoint.transform.position);
            if (dist < nearestDistance)
            {
                nearestTreeDistance = dist;
                nearestTree = tree.gameObject;
            }
        }
    }

i have filled the array with my transforms. but it keeps giving back the wrong tree(gameobject/transform) and with wrong i mean not the closest one. how how do fix it?

west lotus
#

nearestDistance and nearestTreeDistance are two different variables

tired sorrel
#

OH MY GOD. THANKS

#

how cuild i miss that lol

#

i was trying this for fucking 20 min

deft timber
#

what are those errors, this is the first time im seeing them (only when building the project)

hollow stone
#

My wild guess would be that when built the macros/methods are optimized to be inlined and creating clashing variable names 🤷

deft timber
#

i would but then it'll build another 2h :/

#

bump

latent fractal
# tired sorrel hi. i have this ```c++ private void Tree() { foreach (Transform ...

The code you provided is missing some important context, so it's difficult to say exactly what the issue is without more information. However, it appears that you are trying to find the closest Transform in the Trees array to the **CollectionPoint **Transform.

Based on the code you've provided, it looks like the issue may be with the **nearestDistance **variable. It appears that you are using **nearestDistance **in the comparison in the if statement, but that variable is not declared or assigned anywhere in the code you've provided. Instead, you should be using **nearestTreeDistance **in the comparison, like this:

Try This Code

`private void Tree()
{
float nearestTreeDistance = float.MaxValue;
GameObject nearestTree = null;

foreach (Transform tree in Trees)
{
    float dist = Vector2.Distance(tree.position, CollectionPoint.transform.position);
    if (dist < nearestTreeDistance)
    {
        nearestTreeDistance = dist;
        nearestTree = tree.gameObject;
    }
}

}`
This code should initialize the **nearestTreeDistance **variable to a very large value (in this case, float.MaxValue), and then use that value in the comparison in the if statement. If the distance between a given tree Transform and the **CollectionPoint **Transform is less than nearestTreeDistance, then **nearestTreeDistance **will be updated with the new, smaller distance, and the **nearestTree **variable will be updated with the corresponding tree Transform.

This should help ensure that the closest tree Transform is correctly identified and returned by the Tree method.

#

iknow its got solved but for more info if you want to understand

plucky inlet
# simple mountain how do you work with untity's camera functions like WorldToScreenSpace, ScreenT...

If you want to have your mouse position in UI, it should already work, because screenspace is in pixels and your mouse pos is too. For the other, if you want to have a screenposition in world space, you have to use ScreenToWorld as you said but keep in mind, that you have to set your z value manually because otherwise, your worldspace z would be 0 and the worldposition would just be at your cameras position

simple mountain
#

Yeah so I will have to add the camera posiiton into the equasion

plucky inlet
#

Oh wait, wrong channel 😄

steady granite
#

I have some issues with setting UI to mouse position.
I have a Loading Scene where there is my canvas in screenspace camera with a dont destroy on load and singleton instance so I can use it in my other scenes
Some objects have a script to show a tooltip in this canvas and set its position to Mouse.current.position.ReadValue() (using InputSystem)
My issue is that the same code is called on different scenes but the position set is different (one is correct, the other is setting position to 40000+)
(canvas' camera is set on scene loaded with the same parameters on the camera on the 2 scenes)

plucky inlet
steady granite
#

Also, setting my tooltip position works weird :

public void KeepFullyOnScreen()
    {
        string log = "";
        Vector3 position = Mouse.current.position.ReadValue();
        log += $"{position}";
        movable.position = position;
                //More code after.......
}

this logs something like (480, 10) but sets the position in inspector to (965, 6) as if there was some scale applied somewhere

plucky inlet
#

yep, it is taking the nreaplane value I think of the camera, or whatever its called in your renderpipeline

#

At least one assumption

steady granite
#

hmm well the cameras on both scenes have the same params for clipping planes, so it should be the same I assume

#

I see nothing related in my URP settings so I think it should use the camera's

plucky inlet
#

Is movable a UI object? Or 3D object

steady granite
#

2D UI

plucky inlet
#

Why do you cast the position to a 3D vector then?

steady granite
#

yes this cast is not needed (does not fix anything though)

plucky inlet
#

and why do you set the position of your movable instead of the anchoredPosition as supposed to in UI? is movable a recttransform?

steady granite
#

yes it is a recttransform, I am not familiar with the anchoredPosition, will try

plucky inlet
#

anchoredPosition is the pixel pos on UI elements dependant on their anchor and the parent recttransform in 2D. position is the inheritance of transform and is not in pixel space but in 3d world space

steady granite
#

OK! This works way better, it adds some offset now, so I guess it needs to be changed to another referencial (world, screen)

steady granite
plucky inlet
plucky inlet
steady granite
#

more than an offset it is more of a ratio applied

#

I think my anchor point is correct the problem is more getting this position from screensize to canvas size I think, like a Camera.WorldToScreen of sorts

plucky inlet
#

how do you currently get the position?

steady granite
#

Mouse.current.position.ReadValue();

plucky inlet
#

And then how do you set your object right now?

steady granite
#

which returns from 0,0 (bottom left) to Game window max size (top right)

#

just apply flat to anchoredPosition

plucky inlet
#

and what does your parent object look like, inspector wise in its recttransofmr values?

steady granite
#

I think I could get Screen.width & height and apply mathemagics to scale it to the canvas' 1920/1080 but isn't there a Unity function to do just that?

plucky inlet
#

you want it to be always on the propirtions of 1920?

steady granite
#

my canvas is in scale with screen size based on a 1080p reference so the values should always be calculated on this base right?

plucky inlet
#

Yep, no need to do something codewise

steady granite
#

movable.anchoredPosition = new Vector2(position.x * (1920f / Screen.width), position.y * (1080f / Screen.height));
This applies the correct scale

#

Thank you for your hep, I have been on this problem for way too long

plucky inlet
#

still weird, its taking this into account for you

steady granite
#

Yes, I think it did not until I used the anchored position

plucky inlet
#

But looks like its the way people handle it on the web. So you might just have a static vector for your mouseposition that you can access from anywhere that already takes that calculation into account, so you dont have to copy paste that code everywhere

plucky inlet
rare lodge
#

Hello guys got a problem and nowhere i cant find solution ....... im accesing animator parameters via scrypt 1 of 4 parameters work the rest 3 is showing error the Parameters not found...... i checked spelling , calling it same as the first param which is working , i tried recreate animator restart unity and many other things nothing work , can anybody have idea??? thank you

leaden ice
rare lodge
#

There is whole script and screen that these parameters are there

leaden ice
rare lodge
#

i checked it and there is no extra spaces , only the isMoving bool working as it should the rest dont

leaden ice
mellow sigil
#

The handleAnimations method doesn't actually set the field values. It creates local variables and then discards them.

leaden ice
#

oh yes and this^^^

#

that's absolutely the issue 🤣

#

just a variable scopting problem

idle meteor
#

Hi everyone, I'm about to go crazy now. I am trying to develop a UI system. But no matter what I do I can't make the Pause Menu. Let me explain it this way. I assigned a task to the "Escape" key in both scripts. One of these managers is Game Manager and is responsible for bringing the Pause Menu when the "ESC" button is pressed during the game. Another manager is UIManager and this manager allows the player to return to the previous UI window sequentially when the "ESC" key is pressed. (I used the Stack structure to sort the classes I named View in UIManager and implement FILO (First In Last Out). This way I can bring up the previous UI window.)

The first problem when I started building this system was that the UIManager was running after the GameManager, causing the menu to close before it even opened. I solved this somehow, I don't face such a problem anymore. But now it's reversed. Since GameManager is running after UIManager, the pause menu opens right after closing.

I could not establish the logic of this system. Please help me.

rare lodge
mellow sigil
#

The thing that I just said is what's wrong

#

you're not storing the IDs, you're creating new variables

#

remove the ints from inside the method

rare lodge
rare lodge
silent basin
#

Hey guys, I've kinda ran into a stump here and request guidance from the wisemen of coders.

Currently I'm trying to create a system in my game where a cube with a battery script detects all generators loaded into the game to manage some charge functions. Currently I'm running into an issue where one script doesn't seem to be able to access the other. It's probably very trivial what I'm missing here, but I'm really confused on how to handle this.

This is the issue; My scripts don't seem to be able to access each other.. I'm getting two errors which are fairly the same:
"Assets\Scripts\BatteryScript.cs(34,35): error CS0122: 'GeneratorInteraction.isActive' is inaccessible due to its protection level"
and
"Assets\Scripts\BatteryScript.cs(39,35): error CS0122: 'GeneratorInteraction.isRegressing' is inaccessible due to its protection level"

what would be a good way for my battery script to detect generators loaded into a scene with the interaction script? I've been scratching my head for a minute thinking about this but I cant seem to figure it out. Also I've tried namespacing but im VERY bad at it.

steady granite
silent basin
steady granite
#

basically a public function that only returns a private field, the goal is to be able to read data from outside but not allow write

main shuttle
steady granite
#
public float GetLength()
{
    return length;
}

from the outside you can call this function to get the variable length, but you cannot modify it

silent basin
steady granite
rare lodge
#

one more question guys is there any way to compare on which frame is animation currently?

steady granite
#

Depends on what you want to do.
If you want something to happen on a specific frame, you can use animation events
If you want to know the progress of an animation you can use AnimationState.normalizedTime : myAnim.GetCurrentAnimatorStateInfo(0).normalizedTime

#

Which returns the progress state between 0 and 1

rare lodge
floral coral
#

Does the rigidBody component calculate the position over time like this objectPosition += rigidBody.velocity * 0.02f (the 0.02f being the deltaTime of FixedUpdate)?

leaden ice
#

and yes more or less

#

not accounting for collisions etc

floral coral
#

I'm trying to calculate the future position of rigidBodies (planets, afected by gravity only) (gravity between the planets) and it doesn't seem to follow that path

leaden ice
#

it follows that path, I've done trajectory paths before

#

I added a throwing mechanic to my untitled drone puzzle Unity game. This makes it a little easier for the player to insert objects such as power plugs and batteries into their slots from a distance, without having to awkwardly fly every object around.

In order to get an accurate throw path I had to do a discrete integration over time of the obj...

▶ Play video
tacit edge
#

Hi i'm new to unity and i'm trying to have people enter multiple names into a different inputfield and trying to use it in another scene. I looked a lot of video's of it but I didn't find any help for it sadly..

steady granite
leaden ice
#

I also like to be explicit about it, especially since trajectory calculation code is often not done in FixedUpdate

steady granite
#

you're right

hard sparrow
#

I'm having a lot of trouble knowing when it's appropriate to separate logic from UI, and when it isn't

steady granite
floral coral
#

So in FixedUpdate() I have bodyVelocity += gravityImpulse

hard sparrow
#

Like right now I have a StatusEffectUX class which is responsible for both applying statuses to units, and for creating ui controllers for the display of those statuses. Is this already too mingled?

leaden ice
#

assuming your gravity is expressed in the normal units of m/s^2

floral coral
#

Yes

leaden ice
#

Also if you're doing a planetary gravity thing, that gravity value will change every simulation frame according to distance

#

(universal law of gravity)

floral coral
leaden ice
#

in that case you may need to also incorporate the object's mass

floral coral
#

I do

#

I have the script on the two planets, the script giving an "impulse" towards the other gameobjects with the tag planet

#

and since I'm using newtons formula, it emplies I am using the mass of the two objects

#

I'm setting the mass of the planet in the rigid body component, and getting that for the math

leaden ice
#

i.e. this part: bodyVelocity += gravityImpulse

floral coral
#

so the impulse * the mass then added to the velocity?

#

We'll that doesn't work

#

The mass of the planet/s is about 80000kg

#

wait but acceleration isn't velocity

#

velocity is a vector over time, acceleration is a vector over time^2

cosmic rain
#

velocity is a vector over time too 😛

floral coral
#

I corrected it

cosmic rain
#

to be precise, it's a change in position over time squared

floral coral
#

same for velocity without squared

cosmic rain
#

Yeah

floral coral
#

so then we need to remove one of the time values from the acceleration to then add the velocity to the rigid body

#

add force

#

wow

distant glen
#

If I have two floats:
float 1 = 0
float 2 = 1000

How can I plot out a certain amount points along these two floats that are a certain distance apart?

Let's say I want four points...

I don't want to just have 1 point at 200, another point at 400, another at 600 etc.

Point one might be at 160, point two might be at 400 etc.

floral coral
vivid osprey
#

I'm trying to edit a save game file that starts with "  ÿÿÿÿ  FAssembly-CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
how would i turn this file into something easily readable and modifiable? the game its from has unity as its game engine

leaden ice
#

because you're just kinda stating random numbers here

#

for evenly spaced points you can just do something like:

float min = 0;
float max = 1000;
for (int i = 0; i < numberOfPoints; i++) {
  float val = Mathf.Lerp(min, max, (float)i / (float)numberOfPoints);
  print($"Point {i} is {val}");
}```
vivid osprey
#

damn

distant glen
#

Okay, well lets say evenly divide the total number by the amount of points that I want, and then shift those points around a little, but not so much that they are overlapping or passing each other

vivid osprey
#

yall dont know?

hexed pecan
leaden ice
jagged laurel
#

how to fix and give me the script

hexed pecan
leaden ice
hexed pecan
#

If thats what this is

leaden ice
#

probably just trying to edit the save file to cheat

vivid osprey
#

nah nah of course not

leaden ice
#

I don't say this in a bad way. I don't think there's anything wrong with cheating in single player games

leaden ice
#

you only stand to ruin your own fun, nobody else's

leaden ice
#

but impossible to really say without seeing the code.

vivid osprey
#

if this gives u an idea of what format was used lmk 🙏

leaden ice
#

you think we're going to reverse engineer someone's binary save file format for you here?

vivid osprey
#

i dont know how hard or easy it is

#

thats why im asking

leaden ice
#

tedious at best

vivid osprey
#

dang thats sad

late lion
#

Good chance it's BinaryFormatter.

floral coral
#

I have this code to calculate the gravity between two objects (planets)

for(int i = 0; i < rigidbodies.Length; i++)
        {
            if(rigidbodies[i] != thisBody)
            {
                Vector2 delta = rigidbodies[i].transform.position - thisBody.transform.position;
                Vector2 direction = delta.normalized;
                float distance = delta.magnitude;

                float force = Gconstant * ((rigidbodies[i].mass * thisBody.mass) / (distance * distance));

                Vector2 impulse = direction * force;

                thisBody.AddForce(impulse * Time.fixedDeltaTime);
            }
        }

and this code to calculate the trajectory (using a for with the trajectory length to draw the line)

for(int i = 1; i <= trajectoryLength; i++)
        {
            for(int o = 0; o < rigidbodies.Length; o++)
            {
                if (rigidbodies[o] != thisBody)
                {
                    thisMass = thisBody.mass;
                    thatMass = rigidbodies[o].mass;

                    Vector2 fakeDelta = rigidbodies[o].transform.position - thisBody.transform.position;
                    Vector2 fakeDirection = fakeDelta.normalized;
                    float fakeDistance = fakeDelta.magnitude;

                    float fakeForce = Gconstant * (rigidbodies[o].mass * thisMass / (fakeDistance * fakeDistance));

                    Vector2 fakeImpulse = fakeDirection * fakeForce;

                    fakeVelocity = fakeVelocity / thisMass * Time.fixedDeltaTime;
                }
            }
            currentPointLocation += fakeVelocity * Time.fixedDeltaTime;
            lineRenderer.SetPosition(i, new Vector3(currentPointLocation.x, currentPointLocation.y, 0));

        }

However, I have to set the initial speed to be in the millions in order to start seeing the line because of how close the points are one to another. I assume that is because the mass of the planet is ~80000kg.

plucky inlet
floral coral
#

(there are unused variables, I added them to be able to calculate the gravity with the other body moving, right now it's assuming all other bodies are stationary)

plucky inlet
#

Working with values of millions and 80k kg in rigidbody might just make it way more complicated to handle values later on. You could just divid the whole thing by thousand for example to have readable values.

floral coral
#

Well I don't want the initial speed to be in the millions, what's why I asked

#

And I want to keep at least some realism in the game, since if the density of a planet would be set to 500kg/m^3 (density of the earth / 10), normal water would be 100kg/m^3

plucky inlet
#

Yeah, thats why I said, you are right with your values you need to move a 80ton object. But for you to make it easier to read and calculate, lower everythign by thousand so your force does not have to be in millions.

#

Yeah, but you can still scale down kg as well as m3

#

Thats just a suggestion for you to make it easier to write and read. The physics behind it will still need your force to be the nth multiplier of the mass

distant glen
floral coral
#

you use lerp when you want a linearly interpolated number between two numbers

grizzled venture
#

Hi everyone,
how can I force the build executable to open on the main monitor?
It always opens on the wrong screen.

I tried this code and it didn't make any difference.

private void Start()
        {
            int primaryDisplayIndex = 0;
            Display.displays[primaryDisplayIndex].Activate();
        }
loud wing
#

Hey guys, i've been struggling with this for a few days now

#

text won't change it'll log to the console but the text on screen won't change

grizzled venture
loud wing
#

So sorry about that

#
  private IEnumerator RegisterAsync(string name, string email, string password, string confirmPassword)
    {
        if (name == "")
        {
            Debug.LogError("Username is empty!");
        }
        else if (email == "")
        {
            Debug.LogError("Email field is empty!");
        }
        else if (passwordRegisterField.text != confirmPasswordRegisterField.text)
        {
            Debug.LogError("Password does not match!");
        }
        else
        {
            var registerTask = auth.CreateUserWithEmailAndPasswordAsync(email, password);

            yield return new WaitUntil(() => registerTask.IsCompleted);

            if (registerTask.Exception != null)
            {
                Debug.LogError(registerTask.Exception);

                FirebaseException firebaseException = registerTask.Exception.GetBaseException() as FirebaseException;
                AuthError authError = (AuthError)firebaseException.ErrorCode;

                string failedMessage = "Registration failed,  ";
                switch (authError)
                {
                    case AuthError.InvalidEmail:
                        failedMessage += "email is invalid!";
                        break;
                    case AuthError.WrongPassword:
                        failedMessage += "wrong Password!";
                        break;
                    case AuthError.MissingEmail:
                        failedMessage += "email is missing!";
                        break;
                    case AuthError.MissingPassword:
                        failedMessage += "password is missing!";
                        break;
                    default:
                        failedMessage = "registration failed!";
                        break;
                }

                Debug.Log(failedMessage);
                warningLoginText.text = failedMessage;
            }

                    {```
#
public class FirebaseAuthManager : MonoBehaviour
{


    // Firebase variable
    [Header("Firebase")]
    public DependencyStatus dependencyStatus;
    public FirebaseAuth auth;
    public FirebaseUser user;

    // Login Variables
    [Space]
    [Header("Login")]
    public TMP_InputField userLoginField;
    public TMP_InputField passwordLoginField;


    // Registration Variables
    [Space]
    [Header("Registration")]
    public TMP_InputField nameRegisterField;
    public TMP_InputField emailRegisterField;
    public TMP_InputField passwordRegisterField;
    public TMP_InputField confirmPasswordRegisterField;
    public TMP_Text warningLoginText;```
pulsar ivy
# loud wing So sorry about that

Oh firebase does that stuff on a separate thread so if you try to use it to set stuff that runs on main thread only like Unity UI, it won't work

#

You need to use a firebase extension called ContinueWithOnMainThread iirc

loud wing
#

how do i add that extension

pulsar ivy
#

Add the namespace

#

I don't remember exactly what it's called sorry

loud wing
#

how much easier would it be if i just switched over to playfab?

pulsar ivy
#

Hard to say but I prefer playfab over firebase personally so imo it'd be worth it

loud wing
#

it'll have a database as well?

#

and can i save player points to playfab ?

native rock
#

Hi guys, I have list as see in the image which has Buttons in it instantiating at runtime.
I want to make these button pop in (scale up one after the other) as they spawn in a sequence.

I have tried using animation clips but they all run at the same time voz well,

I would like to know how can i achieve the sequence pop in effect

quartz maple
#

how long would it take to learn to program in c#
i already have a some experience with lua

dire gulch
#

how do you render a RenderTexture created in runtime with URP?

rain minnow
chilly beacon
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public Rigidbody2D rb;
    public float playerSpeed = 5f;
    public float dashSpeed = 10f;
    public float dashDuration = 0.5f;

    private float inputX;
    private float inputY;
    private bool isDashing;
    private float dashTimer;


    private void Start()
    {
       rb = GetComponent<Rigidbody2D>();
    }

    private void Update()
    {
        inputX = Input.GetAxisRaw("Horizontal");
        inputY = Input.GetAxisRaw("Vertical");

        if (Input.GetKeyDown(KeyCode.LeftShift) && !isDashing) {
            isDashing= true;
            dashTimer = dashDuration;
        }
    }

    private void FixedUpdate()
    {
        Vector2 input = new Vector2(inputX, inputY).normalized;
        rb.velocity = input * playerSpeed;

        if (isDashing)
        {
            rb.velocity = dashSpeed * input * dashSpeed;

            dashTimer -= Time.fixedDeltaTime;
            if (dashTimer <= 0)
            {
                isDashing = false;
            }

        }
        else {
            rb.velocity = input * playerSpeed;
        }
    }

    // Powerups
    public void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Ability"))
        {
            playerSpeed += 5f;
            other.gameObject.SetActive(false);
        }
    }
}
#

why does the dash speed not change even when i change the value

#

it gives me the same dash speed

loud wing
dense moth
leaden ice
#

according to your code it's not going to do any of the other stuff in that case

thick socket
#
protected virtual IEnumerator ShootCoroutine()
    {
        // cooldown between multishots
        while (true)
        {
            if(pauseShooting==false)
            {
                //multishots
                firedShots = 0;
                while (firedShots < attackStats.multiShot && !pauseShooting)
                {
                    character.Animator.SetBool("Cast", true);
                    yield return new WaitForSeconds(0.05f);
                }
                character.Animator.SetBool("Cast", false);
            }
            yield return new WaitForSeconds(attackStats.attackSpeed);
        }
    }
#

is there a better way to code this since I have !pauseShooting twice

#

(I need the while loop to end if pauseshooting)

mental rover
floral coral
#

I'm not trying to make a 1:1 solar system, I want the game to act realistic

mental rover
loud wing
loud wing
#

someone said something about continueWithOnMainThread because im using firebase

#

if someone can please help it's been 3 days

ocean nymph
#

Hi!

I have a particle system that has texture sheet animation module enabled with mode=Sprites and the sprites array is populated.
I want to spawn particles using Emit function from code, and change which sprite will be used for that particular particles batch.

And now I face an issue, where I set textureSheetAnimation.startFrame (basically sprite array item index) and it changes all the previously spawned particles to the new sprite.

Is there any way around this? Something like spriteIndex (like the existing meshIndex) would be nice in the ParticleSystem.EmitParams, but uh...

The only way around this (that I can see) would be to play with the randomSeed, set the startFrame to 0-max, and then build a seed table (which seed gives which sprite index)... But that is just tedious, and probably won't give the same results for each platform.

(duplicated from #✨┃vfx-and-particles as it involves code actually)

covert scaffold
#

For a top-down game, do I want dynamic rigid bodies or colliders? I see both in various tutorials but i also see some terrible code in them so idk

#

For the characters**

hybrid sleet
#

Hi all, is this the right place for this? If not, I'll delete the comment and take it to the correct channel:
When I create an assembly definition asset in the folder containing all my scripts, it appears to break all references to plugins installed via the package manager (could be more or less, but the list is long and I haven't checked every single broken reference). I think I could relink the packages individually as references, but according to the docs, it should have these definitions auto-linked: https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html#:~:text=the predefined assemblies.-,Default references,-By default%2C the
This is the flavour of error that I'm getting:
Assets\Scripts\PuppetTool\AprilTags\AprilTagRecorder.cs(3,19): error CS0234: The type or namespace name 'Recorder' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Why isn't it working for me?

cold parrot
ocean nymph
hybrid sleet
cold parrot
hybrid sleet
#

this is a bunch of old code, so it isn't the first time i'm using them

#

so i just have to go through each one and add it I guess

cold parrot
#

managing such references is a normal/required process in all of software development

hybrid sleet
solemn topaz
#

using a cellular automata to create a random map that looks something like this. the map is represented as an int[x,y] with each position being a 0 or a 1, is there any way i could check for little pockets (like the one on the left hand wall)? they're messing with some of the post generation stuff that needs doing.

dapper schooner
#

Hey, I am looking for a solution to determine if a user is moving in VR and when they stop. The problem is that the OVRCamera is your head so it registers movement if you nod your head as well as when you walk. I just want the walking and ignore the head nods and looking around.

I have tried velocity but if you nod your head fast enough you can trick it. I tried tracking my previous position and current position but the head nods register a change in position.

mental rover
solemn topaz
#

i think i might

#

it's already janky as

#

plus i can run it from the center of the map because it already ensures that the center tile isn't a wall

loud wing
#

anyone know anything about firebase?

mental rover
#

yeah - was about to say the harder part is dealing with edge cases where you might start in one of the smaller caves

sleek bough
#

@loud wing Don't cross-post and ask the actual question.

loud wing
#

i've been for 3 days no one knows

#

i can't seem to have the debug.logs to print on the screen to show the user error messages

sleek bough
#

Also is it related to Unity?

loud wing
#

on unity

sleek bough
#

Look at the API examples

solemn topaz
loud wing
#

this won't change that error is suppose to show where text is on the screen

#

i tried literally everything

surreal phoenix
loud wing
#

someone said something with firebase it won't display on the main task or something

sleek bough
#

There are plenty Unity centric tutorials on it as well

loud wing
#

i am desperate to figure this out

#

and i cannot

ripe vale
#

Hey guys dont know if this is the right place to post this so apologies if it isn't. Im trying to make a first person player controller using the new input system. Now I got the WASD keys working fine, and I set up the Mouse delta in the InputAction panel. I can get the mouse delta but now I'm not sure what to do, I'm using cinemachine with the settings in the screenshot. I have removed the Input Axis names because I think I have to set it to the new Input system, but how ?

#

If this is the wrong way please tell me what the correct way to do first person player rotation is

ripe vale
#

so I can control the sensitivity etc

#

nvm I got it thank you

maiden zodiac
#

What's a good way to shorten SetEntitySpriteHorizontalVertical(Sprite sprite)? This method sets the sprite for a tile whenever it has north and south or west and east neighbors with the same tile

leaden ice
maiden zodiac
#

yeah sorry, i just replaced it with SetEntitySprites instead

#

then take parameters for corner, horizontal, and vertical sprites

ripe vale
#

One more question, is it bad if I rely on the camera transform inside the player to make the player rotate ? Should I use the Vector2 MouseDelta from the input system instead? The reason I ask is because considering the camera has a certain speed etc and is using the input system I'm not sure how I would obtain the same results using mouse delta instead

rustic furnace
#

I am lost and need some advice. You know those 3d hole games on mobile you move to suck items into the void?
I'm not sure how to make a hole where the cylinder is at and when it moves, regenerate the ground it previously made a hole at. Unless I'm going about this wrong?

desert shard
#

Mesh deformation/runtime editing

#

it's not easy

lyric wadi
hexed geode
#

how would one go about making a level editor for a rhythm game osu-style?

leaden ice
hexed geode