#archived-code-general

1 messages · Page 404 of 1

jaunty sleet
#

I figured it out, I had to set the sprite type to single. Very annoying lol

winged tiger
#

Why is that necessary?

somber nacelle
maiden fractal
#

It seems to generate new random GUID, I don't see a reason why it wouldn't change

still jungle
#

to serialize the field which you lose

soft escarp
#

fair enough
but is it supposed to visualize something? am i supposed to see the spherecast? if so, i dont see crap

winged tiger
hexed pecan
#

I think it's different from version to version

soft escarp
hexed pecan
#

Hard to say from my end lol

soft escarp
#

the anatomy of the player lmao

hexed pecan
#

Idk which one is the spherecast here but both look incorrect

#

The bottom ball would already start inside the ground and therefore not detect it

#

The top (cyan) part looks like it never leaves the player

soft escarp
hexed pecan
#

So your spherecast is too short

#

Or is it hitting the trigger perhaps

#

It shouldn't hit triggers by default AFAIK

soft escarp
#

and too large for some reason
the yellow ball and the cyan ball has .4f radius

hexed pecan
#

I dont know why that would be

#

Is the bottom sphere scaled perhaps

#

By transform

maiden fractal
#

@winged tiger Sorry, I didn't read the whole code, I think reaz is right though. The way you have implemented it, it seems to me like you would have to save the scene every time SetDirty is called though to which there might be a better solution that doesn't require manual saving

soft escarp
#

anyway thanks for the help
i will use the physics debugger very often i think

winged tiger
maiden fractal
still jungle
winged tiger
still jungle
#

and since you added ExecuteInEditor atttribute it also execute Awake each domain reload

still jungle
winged tiger
still jungle
#

then remove [ExecuteInEditor]

winged tiger
smoky stream
#

anybody who is skilled at coding that can help me?

hexed pecan
#

Don't crosspost please

still jungle
#

What if there are several GameObjects of the same prefab?

maiden fractal
#

That's the problem, it should be persistent between scene objects but not for prefabs

still jungle
winged tiger
#

I stated the current behavior

heady iris
#

You can write an editor script that assigns IDs to all objects in the scene that don't currently have one

#

You can also assign a new ID to objects that you instantiate at runtime -- you'll need to do so in a consistent way, of course.

#

I suppose that'd be the job of the object's owner.

winged tiger
heady iris
#

I'm not aware of a way to react to a prefab instance appearing in the scene

maiden fractal
#

PrefabUtility.IsPartOfPrefabAsset might prove useful.

Returns false if the object is part of a Prefab instance in a scene

heady iris
#

I guess you could use [ExecuteAlways] and then check yourself in Awake

#

being careful to avoid doing anything if you're in a prefab stage

winged tiger
maiden fractal
heady iris
#

You'd need to write the code so that it never tries to modify an actual prefab asset

#

It must only ever touch prefab instances

#

This gets kind of scary :p

maiden fractal
heady iris
#

dragging object from the scene into prefab

Are you talking about prefab creation here?

maiden fractal
#

Yes

heady iris
#

I guess that'd be an issue

#

It's just not a very common one

maiden fractal
heady iris
#

I haven't tried to do that before, so I'm not sure

#

It sounds plausible

still jungle
#

Thought the use for ISerializationCallbackReceiver is to prepare data to be serializable, in his case it is serializable, a serialziable id string exactly

#

other case he doesn't need to assign persistent id in Awake for a prefab, so it stays empty

maiden fractal
# heady iris I haven't tried to do that before, so I'm not sure

I haven't done either so it might or might not work but I think OnBeforeSerialize is called every time the prefab is created (having this script) or the component modified on the prefab so it should always override null for every instance lying on a prefab if I'm not mistaken

still jungle
#

also when he assign persistent id in Awake for GameObject it should dirty and save the scene, to serialize it in to scene asset

maiden fractal
still jungle
#

it can but it doesnt make sense, i mean for this case, since data is all ready to be serialized

#

and there is also internal serialization, so everytime this gameobject will be viewed in inspector the callback will be trigged

maiden fractal
still jungle
#

changes done to a prefab, after instantiating in scene, are stored in the scene

#

basicly every game object is serialized as a part of a scene asset, if it have prefab it is saved as prefab blueprint + changes

#

thats what modified gameObject from a prefab generates

maiden fractal
still jungle
#

if check if its prefab, which you proposed, would solve this issue

maiden fractal
#

Now that I think about it, I'm not too sure myself that the solution that I provided would work anyways though. It is very well possible that this is not recogniced as a prefab by PrefabUtility.IsPartOfPrefabAsset at the time the prefab is first time created. Should try that though to make sure

still jungle
#

the best would be if the user would just take care of it himself, since its one time thing to do

maiden fractal
# still jungle the best would be if the user would just take care of it himself, since its one ...

@winged tiger Now that I tried it, ISerializationCallbackReceiver does seem to work as I thought. It seems to be quite excessive though, I thought unity would do the serialization only when something is changed but it seems to be called all the time prefab or object with the script is selected (with inspector open). I don't have any experience with AssetDatabase but with it there might be a better way than with the serialization callback. Making the user be aware of this edge case might be good enough too. The name of NetworkObject suggests that this script would be used quite much so it wouldn't be a surprise if this edge case happened though.

still jungle
simple void
#

Hey guys, I'm trying to add xml documentation to my project which I then use docfx to build a static site for. I'm using a CsprojPostProcessor to add "<DocumentationFile>./Docs/File.xml</DocumentationFile>\n" to my Assembly-CSharp.csproj. However I don't know how to trigger this csproj to generate the xml. I've tried reloading the domain and deleting library folder. So far I've only gotten it to generate the xml using an msbuild command, does anyone have any pointers?

simple void
#

Nevermind I figured it out, docfx automatically builds the csproj given the correct path.

viral oyster
#

trying to do unity collaboration and it says this

inner yarrow
#

Sorry, I've asked this before, but I forgot. What is the class/variable called that allows you to select a function.

leaden ice
#

Or maybe you're thinking of UnityEvent

inner yarrow
#

UnityEvent sounds right.

gritty jacinth
#

I am moving a rigid body with wasd input like this

        private void FixedUpdate()
        {
            _movementVector = _input.x * transform.right * settings.moveSpeed + _input.y * transform.forward * settings.moveSpeed;
            _rig.linearVelocity = new Vector3(_movementVector.x, _rig.linearVelocity.y, _movementVector.z);
        }

How would I make it rotate on the y axis to face the direction the rigidbody is being moved? currently it moves to the right but faces forward

#

i tried this doesn't work correctly the rotation bugs out and spins infinitely as soon as i move to the right or left

 if (_rig.linearVelocity.x != 0)
 {
     float rotationAngle = Mathf.Atan2(_rig.linearVelocity.x, 0) * Mathf.Rad2Deg;
     transform.rotation = Quaternion.Euler(0, rotationAngle, 0);
 }
vestal arch
#

oh wait you're already doing that whoops

#

what is the issue right now?

#

im confused

rain minnow
gritty jacinth
# vestal arch what is the issue right now?

chat gpt figured it out. I was trying to make player movement work how it does in the original san andreas game.

if (_rig.linearVelocity.magnitude > 0.1f)
{
    // Create a new vector that only has the X and Z components of the velocity
    Vector3 direction = new Vector3(_rig.linearVelocity.x, 0, _rig.linearVelocity.z);
    // Check if the direction is not zero
    if (direction != Vector3.zero)
    {
        // Calculate the target rotation based on the direction
        Quaternion targetRotation = Quaternion.LookRotation(direction);

        // Smoothly rotate towards the target rotation while maintaining the current X and Z rotation
        Vector3 currentRotation = mesh.rotation.eulerAngles;

        var rot = Quaternion.Euler(new Vector3(0, targetRotation.eulerAngles.y, 0));
        mesh.rotation = Quaternion.Slerp(mesh.rotation, rot, Time.deltaTime * 5f);

    }
}
#

there may be a better way to do it but it acheives what I need until I feel like fucking with it again

rain minnow
#

i would use LookRotation with your _movementVector to get the rotation, then use a physics rotation method to turn (rotate) . . .

vestal arch
#

you might want to use the input vectors instead of the velocity

gritty jacinth
rain minnow
#

velocity should be fine. wait, what is mesh?

gritty jacinth
#

if I dont apply the rotation to the visual representation of the mesh

#

then the rb spins indefinitely and walks in a circle when holding down d

gritty jacinth
vestal arch
#

oh i see what the intended control is now lol

gritty jacinth
#

imo its the only third person game that made sideways movement not feel ass

vestal arch
#

i haven't no, so i was trying to imagine what that was

gritty jacinth
#

unless you're aiming then you strafe

rain minnow
gritty jacinth
#

and if I do rotate the rigidbody it will continue to walk in a circle

vestal arch
#

you'd need to use the camera forward/right instead (projected onto the xz plane and normalized, probably) with that route

rain minnow
gritty jacinth
#

i dont want it to continue to rotate, I just want it to face the direction of the movement and keep looking that way.

#

oh wait waht

vestal arch
#

discord can't embed mkv

gritty jacinth
#

mp4?

rain minnow
#

that's def not right . . .

gritty jacinth
#

it keeps rotating the entire time I hold d

#

this is the desired behavior

#

but i can only achieve it if I rotate the child of the rigidbody not the actual rigidbody itself

#
 if (_rig.linearVelocity.magnitude > 0.1f)
 {
     // Create a new vector that only has the X and Z components of the velocity
     Vector3 direction = new Vector3(_rig.linearVelocity.x, 0, _rig.linearVelocity.z);
     // Check if the direction is not zero
     if (direction != Vector3.zero)
     {
         // Calculate the target rotation based on the direction
         Quaternion targetRotation = Quaternion.LookRotation(direction);

         // Smoothly rotate towards the target rotation while maintaining the current X and Z rotation
         Vector3 currentRotation = mesh.rotation.eulerAngles;

         var rot = Quaternion.Euler(new Vector3(0, targetRotation.eulerAngles.y, 0));
         mesh.rotation = Quaternion.Slerp(mesh.rotation, rot, Time.deltaTime * settings.timeToTurn);

     }
 }
vestal arch
#

it keeps rotating because it keeps going "right" of the transform, which is also being rotated

rain minnow
gritty jacinth
gritty jacinth
azure frost
earnest gate
#

just make the game the executable, and driven by scripts inside it.

ocean hollow
earnest gate
#

I would like to create a 2D game development tool like RPG Maker. Is this possible with one-person development?

#

Can I extract a game created with development tools made with Unity into an executable file?

azure frost
#

Setting it to "Frictionless" gets rid of the cling, but it makes my movements a bit slippery.

oblique spoke
earnest gate
#

So can you make it?

vestal arch
#

make the wall not have friction instead of the player

#

or add linear drag to the player, to compensate for the missing friction

oblique spoke
earnest gate
#

I want to create a mobile game development tool.

#

So, is it possible to create a game using the game development tool made by Unity and extract it into another apk file?

vestal arch
#

unity is a intended as a game engine, but doesn't mean you have to use it like that (eg, simulations, 3d environments, etc)

oblique spoke
earnest gate
#

I really want to create a mobile game development tool!

#

If I create a game creation tool, can I use it as a game portfolio?

vestal arch
#

for a game portfolio? i don't think much of making a gamedev tool overlaps with gamedev itself, save for ux/ui i guess (though still a different kind of ui)

#

it'd be more like, unity/c# familiarity, and making an app via unity rather than making a game

earnest gate
#

Ah, would it be better to use Unity as a game creation tool like this? Would it be better to make it with something like Android Studio?

vestal arch
#

"better" is very dependant on your personal experience

#

if you're like, really proficient with c# and unity and not at all familiar with java/kotlin and xml, then it could be a better option

#

that's an extreme case

#

it'll be possible with both

earnest gate
#

Do you recommend making it only with the Aha language library?

vestal arch
#

no clue what that is

#

i can't recommend anything in this space, i don't have any experience here

earnest gate
#

Is there a way to extract the executable file from a game creation tool made with Unity?

faint tree
#

what platform?

#

if its running on desktop the unity game could launch .bats to compile exes etc

earnest gate
#

Mibile

faint tree
#

see scorpion engine for a great example

earnest gate
#

Mobile

#

Ok

faint tree
#

the tool could export mobile games easily but not if it wasnt running on a desktop OS etc.

cosmic rain
earnest gate
#

It is scheduled to run in a mobile environment.

cosmic rain
earnest gate
#

This is something I've wanted to do for two years.

arctic sparrow
#

I think the tool

faint tree
#

i doubt u could make an APK etc on mobile it self, maybe could build on cloud and return one though

cosmic rain
wheat spruce
#

would it not be easier, to have the game itself output levels, that users can then load into the game?

earnest gate
#

I'm not good at Unity either, but I'll try making it for practice!

vestal arch
#

this is not a practice project

#

you have quite a large scope currently

#

this practice is gonna be like, 3 years

cosmic rain
# earnest gate Yes!!

Then this is not gonna be straightforward due to what Gaz said. Also, mobile apps don't have exe files. And then again, if you're gonna do that you're gonna need to have several years of experience as a programmer. At which point you'll probably realize that there's an easier way to implement what you want.

faint tree
#

id just build a game with a level editor inside, and have easy way to make and launch levels, most of my games have that

earnest gate
#

Yes I know. I want to break through my limits!

faint tree
#

current game i can make levels in it on say my steamdeck, and test them all on the move without a pc

#

or my switch etc

#

cant afford steamdeck yet but thats the plan lol..

earnest gate
#

Wow

cosmic rain
faint tree
#

haha

earnest gate
#

Ah... I see.

cosmic rain
#

Start simpler. Increase the difficulty steadily. Focus on few areas of expertise. Eventually you'll get to a level where you'd be able to plan and execute what you want without asking for an advice here. That's when you know you're ready for it.

earnest gate
#

So, shall we create another project and practice?

#

Let me show you the games I've made so far!

#

It's currently at this level.

faint tree
#

quite basic still but good start

#

making tools can be horribly overwhelming at times

#

and not that fun

#

almost lost interest in my whole game making this tool.. but got there

cosmic rain
earnest gate
#

Ah, then I will improve my skills and make it.

#

I’ve been doing it for about 2 years now!

faint tree
#

yeh build a basic engine, then build a basic editor for the engine

earnest gate
#

What kind of game would it be best to get a job making?

faint tree
#

so eventually u will have a way to make "levels" for the game engine

earnest gate
#

Yes

faint tree
#

then just load them levels up in the game engine, and youre half way there

vestal arch
#

and preferably not those weird mobile games

earnest gate
#

Yes

faint tree
#

2 yrs, i spent like 30+ yrs now and im still stuck everyday 🙂

#

coded every single day since mid 90s

earnest gate
#

What about horror games? 2D

#

I want to make a horror game or RPG! Which will your company prefer?

vestal arch
#

don't ask about what a company would prefer

#

just make stuff you want to make

earnest gate
#

Ok

faint tree
#

doesnt matter what u make so long as u have fun, learn and finish it, though there are some genres that do better, (this guy talks about that https://www.youtube.com/watch?v=uPOSZ_jhCaw )

🎮 Get Chris' Masterclasses! Ending SOON! https://cmonkey.co/howtomarketagame

✅ Get my C# Complete Course! https://cmonkey.co/csharpcourse
🌍 Game Dev Report Newsletter - https://cmonkey.co/gamedevreportnewsletter
🎮 Play my Steam game! https://cmonkey.co/dinkyguardians
❤️ Watch my FREE Complete Courses https://www.youtube.com/watch?v=oZCbmB6opxY...

▶ Play video
earnest gate
#

Let’s take a look next time!!

faint tree
#

platform games tend to not sell well apparently, shame because one of my main games is one lol.

earnest gate
#

Okay

#

I'm Korean and using a translator, so there may be grammar mistakes!

faint tree
#

nice, went to korea, cool place, im living in taiwan 🙂

earnest gate
#

Thank you

#

I want to make a horror game, but I'm worried that it will be difficult to create a horror feeling.

#

I'm afraid of something

#

Can I do it?

faint tree
#

yeh its difficult, just consult existing games

#

silent hill, PT etc, resident evil etc.

earnest gate
#

Then wouldn’t it be better to create a genre other than horror?

faint tree
#

P.T. Silent Hills Gameplay Walkthrough PS4 PRO PS5 PC No Commentary 4320p 60fps HD let's play playthrough review guide
Showcasing all cutscenes movie edition, all boss fights / boss fights, side missions, upgrades, outfits / costumes, all characters, best moments, final boss and true ending, secret ending.

PC Version by Artur Łączkowski (PT Em...

▶ Play video
earnest gate
#

Oh

faint tree
#

create what you personally want to play

wide totem
#

Hello, is there anyway to insure that something within my start function will only be called after unity checks for collision enters, ie when the object spawns check for collisions before running start (beyond just adding a delay)

earnest gate
#

I want to make and play my own horror game!

faint tree
#

OnCollisionEnter()?

vestal arch
#

what are you even trying to do?

faint tree
#

then do it @earnest gate

vestal arch
wide totem
earnest gate
#

All right!

vestal arch
wide totem
earnest gate
#

I'm curious!

vagrant blade
earnest gate
#

Yes

vestal arch
#

or you might want to just have some centralized system that can keep track of it itself

wide totem
#

how can i check within the start function? I have only been taught collision detecting using the collision functions

vestal arch
#

raycast/overlap & friends

vestal arch
wide totem
azure frost
#

Current problems with my Rigidbody Character Controller

1. Rigidbody Forces can be easily counteracted by player input.

2. Bumping into walls doesn't seem to slow your movement.

3. No slope limit. Anything less than 90 degrees can be climbed.

4. The slightest dip in ground level will end up with the player airborne.```
vestal arch
#

Current problems with my Rigidbody Character Controller
you aren't supposed to have both on a single gameobject

azure frost
#

I don't.

#

I'm just not sure what else to call it.

wide totem
wide totem
azure frost
#

yep

wide totem
#

it is your movement system most likely, im guessing you are setting the velocity based on the input rather than adding it to the current velocity?

azure frost
wide totem
#

im not familiar enough with the physics engine for the other problems sadly, but when you get a chance ping me and send the code for that

azure frost
vestal arch
azure frost
#

Rigidbody

vestal arch
#

just a rigidbody, and no character controller?

#

aight

azure frost
wide totem
#

yeah im about to head to bed too, ill take a look tomorrow if no one else helps you tonight

vestal arch
#

actually for 1 you might want to just lock controls for the duration of the launch? that seems like a specific instance rather than a general issue

azure frost
vestal arch
#

ok so your air strafing is just too much then

azure frost
azure frost
vestal arch
#

for 1:
you have an acceleration value, but you're doing addforce with velocity change mode
so that's, just, a lot, and seems like your max speed is governed by max speed or linear drag settings

#

you might want to reduce that

azure frost
#

My bro says that our code should be able to differentiate speed applied via a player's input from speed applied by the environment...

vestal arch
#

they'd just be added together anyways

#

i don't think there's really a point to doing that

vestal arch
#

it's a physics thing, it works on colliders

#

when in doubt, consult docs

leaden ice
#

Physics.Raycast operates on Colliders. There are other raycasts available for other things.

spice vortex
#

can someone explain what an event subscription (+=) is

vestal arch
#

you subscribe to an event

#

later, that event can be triggered, and the delegates that have been subscribed will each be called

spice vortex
#

what do you mean by subscribe? to recieve updates or something?

late lion
#

You can think of an event as a list of methods to be called when that event is triggered.

#

Subscribing is adding a method to that list

robust dome
#

one event can have many subscribers. you simply subscribe to the event and wait until it is being triggered somewhere.

spice vortex
#

playerControls.PlayerMovement.Movement.performed += i => MovementInput = i.ReadValue<Vector2>();
in this code what does the += do, i am using it in an onEnable method so does it add it to that method?

vestal arch
#

it's essentially a function but as a value

#

when performed is invoked, that function will be run, along with anything else subscribed

spice vortex
#

so it basically means when when this action is performed you will do this

vestal arch
#

yes

spice vortex
#

can i replace lambda by another variable or does it have to be i

vestal arch
#

you can.. replace the entire lambda with a method reference?

#

do you mean the lambda parameter?

#

the i there is just a name, like a method parameter

#

you can name it anything

#

the lambda in full would be (InputValue i) => { MovementInput = i.ReadValue<Vector2>(); } but it can be shortened a lot

#

single parameter, so the parens aren't necessary
type of the parameter can be inferred
single statement, so the braces aren't necessary

stoic anvil
#

does scriptableobject being recognized automaticly by unity during the runtime becuase i am deleting one and making second as player and it could not be recognized

stoic anvil
#

and with bake you can move in the right way

thin aurora
#
playerControls.PlayerMovement.Movement.performed += UpdateMovementInput;
...
private void UpdateMovementInput(MyValue i)
{
  MovementInput = i.ReadValue<Vector2>();
}
#

This is the same, but now it's by method reference and you can also unhook from performed with performed -= UpdateMovementInput should you ever need to stop calling it

#

And just to summarize, performed is an event and += basically means "I want to invoke the right part when the event is called"

heady iris
#

yes -- it's impossible to unsubscribe an anonymous function if you don't keep a reference to it

thin aurora
#

+= is a short way to do addition, like i += 5 adds 5 to a variable

heady iris
#
foo += () => { };
foo -= () => { };

these two anonymous functions have nothing to do with each other

thin aurora
#

Exactly

heady iris
#

I was tickled when I found out about delegate addition

thin aurora
#

I'm sure there is some complex shenanigans that does end up allowing it, but now natively build in

heady iris
#
var what = (System.Action) Update + Update;
thin aurora
#

Anyway just 2 cents because performed += i => MovementInput = i.ReadValue<Vector2>(); is very hard to understand in general

heady iris
#

I prefer to only react to phase changes for button-like inputs

spice vortex
#

i was going through this tutorial and spent 30 minutes trying to figuire it out in chat gpt

thin aurora
#

It's also just written poorly

#
playerControls.PlayerMovement.Movement.performed += (i) =>
{
  MovementInput = i.ReadValue<Vector2>();
}

I'd write it like this

#

That is if you don't want/need a method

spice vortex
#

i see

thin aurora
#

So maybe that is more clear

spice vortex
#

in this code in the handle rotation method instead of giving targetDirection same the values as MoveDirection cant i just directly put Quaternion targetRotation = Quaternion.LookRotation(MoveDirection)

#

its written at the end of the handle rotation method

knotty sun
#

this is not the place for self advertising

mighty juniper
#

Hey all, I'm trying to make a movement system where i can pitch and yaw in space. Here's my code:

    private void Rotate(Vector2 axisValue) // axisValue.x = yaw (y rot), axisValue.y = pitch (x rot) (This hurts my brain)
    {
        if(axisValue != Vector2.zero)
        {
            Vector3 axisRotDir = new(axisValue.y, axisValue.x, 0);
            axisRotDir.Normalize();

            Vector3 torqueDir = transform.rotation * axisRotDir; // Direction of the torque relative to world rather than local object
            RotateInDirection(torqueDir);
        } else HaltRotation();
    }

    private void RotateInDirection(Vector3 direction) // Applys torque in a direction and damps change in velocity
    {
        if(rb.angularVelocity.magnitude < MaxRotationalSpeed)
        {
            float rotationalThrust = RotationalThrust; // Preventing repeat multiplication calculations

            direction.Normalize();
            isTryingToRotate = true;

            // Difference between the desired direction and current direction
            Vector3 dirDifference = direction - rb.angularVelocity.normalized;
            dirDifference.Normalize();

            // Damp in the opposite direction to the difference
            rb.AddTorque(dirDifference * (MaxRotationalThrust - rotationalThrust + overheadDampingThrust));
            // Apply a continuous torque in the desired direction
            // If current speed is less than 10% of maximum speed, give some extra thrust to make rotation feel more fluid
            rb.AddTorque(direction * (rb.angularVelocity.magnitude < (MaxRotationalSpeed / 10) ? rotationalThrust * 2 : rotationalThrust), ForceMode.Force);
        }
    }

    private void HaltRotation() // Same as brake function, but for rotation
    {
        if (rb.angularVelocity != Vector3.zero) rb.AddTorque(rb.angularVelocity.normalized * -(RotationalThrust + overheadDampingThrust));
    }```
#

I've gotten a similar system working for movement, but quaternions mess with my brain so much and implementing rotation like this causes all sorts of weird effects. Im using a controller joystick in order to control this rotation (that's passed into the rotate function). Does anyone know what i may be doing wrong?

#

No drag is affecting this rotation and there is no gravity, only the damping i've added to get rid of rotation in the directions im not currently trying to rotate in

(If you want me to move this to #archived-code-advanced i'll be happy too, but i wasn't sure whether or not it would qualify for that)

trim schooner
#

it's not advanced

knotty sun
#

do not cross post

#

also not a code question

leaden ice
#

I would say that part definitely needs rewriting

mighty juniper
leaden ice
#

It's like "Walrus - potato"

mighty juniper
# leaden ice If it's working in the other place it's from sheer dumb luck or that part is jus...

How would i go about doing damping properly then? I can't just add drag to the rigidbody in the editor as i don't want drag in the direction im moving if that makes sense, but if im travelling for example forward and then decide to go right, ill still have a bit of that forwards velocity. Hence why i thought finding the difference between direction im trying to go and the direction im currently going, and applying an opposite force to that would work, which it seems to do for movement

leaden ice
#

Your thought process is sound, the code just doesn't reflect that

mighty juniper
# leaden ice But "direction I'm currently going" is not what angular velocity is
    private void ThrustInDirection(Vector3 direction) // Applies a force in a direction and damps change in velocity
    {
        if (rb.linearVelocity.magnitude < maxSpeed)
        {
            direction.Normalize();
            isTryingToMove = true;

            // Difference between the desired direction and current direction
            Vector3 dirDifference = direction - rb.linearVelocity.normalized;
            dirDifference.Normalize();

            // Damp in the opposite direction to the difference
            rb.AddForce(dirDifference * (maxThrust - thrust + overheadDampingThrust));
            // Apply a continuous force in the desired direction
            // If current speed is less than 10% of maximum speed, give some extra thrust to make movement feel more fluid
            rb.AddForce(direction * (rb.linearVelocity.magnitude < (maxSpeed / 10) ? thrust * 2 : thrust), ForceMode.Force);
        }
    }```
So this logic for damping for movement is fine right? I just cant directly apply this to angular velocity as well?
leaden ice
#

Where is that coming from?

#

I'm assuming, as its name implies, it's a direction vector, which wouldn't make sense here

mighty juniper
# leaden ice I think the confusion is coming from the naming of your "direction" variable may...
    private void PlanarMove(Vector2 axisValue)
    {
        if (axisValue != Vector2.zero) // If player is trying to move, apply a proportional force in that direction
        {
            Vector3 camForwardDir = Camera.main.transform.forward;
            Vector3 camRightDir = Camera.main.transform.right;

            // Flatten vectors to be planar in X/Z
            camForwardDir.y = 0;
            camRightDir.y = 0;

            // Re-normalise vectors with new planar value
            camForwardDir.Normalize();
            camRightDir.Normalize();

            // Resolved movement direction from input 
            Vector3 moveDir = (camRightDir * axisValue.x) + (camForwardDir * axisValue.y);
            ThrustInDirection(moveDir);
        } else Brake();
    }```
That is coming from this, its just the direction that i want to go
leaden ice
#

You mean moveDir?

mighty juniper
#

yeah

leaden ice
#

Then yeah this doesn't make sense

#

We're talking about the rotation of the object

mighty juniper
#

this is just movement im talking about rn though

#

i was just trying to take that same logic and apply it to rotation. The code i just showed was purely for my movement, which as far as i can tell works as expected, i was just showing you what i was referencing when making the rotation

leaden ice
#

You want the desired angular velocity

#

Not the desired linear velocity

mighty juniper
#

Sorry i realise i've explained this badly

leaden ice
#

If you're talking about getting it to Face a certain direction that would be analogous to code that gets your object in a certain position, not to a certain velocity

mighty juniper
leaden ice
#

Desired position -> desired rotation
Desired linear velocity -> desired angular velocity.

What I believe you are trying to do is take code that gets you to a desired velocity and trying to use that to get to a desired rotation

mighty juniper
leaden ice
#

The correct analogous code would be code that gets you to a desired position, which I don't think you have

#

So you'll have to write this from scratch

#

Basically it's a second order integration on top of "desired velocity" code

mighty juniper
#

Right, i see what you mean. I just really struggle to wrap my head around rotation comparent to movement

leaden ice
#

Think about what code would look like to get to a desired position

#

You'd first have to accelerate towards the position, then you'd need to decelerate as you arrive there

#

It's the same for rotation

mighty juniper
#

yeah

#

the thing is for rotation i dont have a desired rotation i want to be at, i just want to rotate in a direction based on my inputs

leaden ice
#

But that's exactly the same

#

The desired rotation is just basically Quaternion.LookRotation(input direction)

#

(adjusted for the camera etc)

mighty juniper
#

i want it to be physics based though, wouldn't that not be physics based?

leaden ice
#

This is just math

#

This gets us the directions and rotations we will use physics to achieve

#

I didn't say to just immediately set your rotation to that

#

It's our target

inner yarrow
#

Is there a way to create an editable bounding box for a script (sorta like what you can do with a box collider)? Creating a public Bounds technically works, but I want the ability to see and edit it in the scene view.

mighty juniper
#

right

mighty juniper
# leaden ice It's our target

Where im not really following you here is how im figuring out my "target", because im just rotating in a direction until i decide i don't want to rotate anymore. Sorry if i'm slow at picking this up

inner yarrow
leaden ice
#

The current is whatever direction you're currently facing

#

If you mean that there's not a "face left if I'm holding left" and instead there's a "apply clockwise torque when I press Q", well that's much simpler

opaque sun
#

float density;
for(int i = 0; i < NumSteps; i++){ 
RayOrigin += (RayDirection*StepSize); 
//Get the density of the sphere. 
float SphereDistance = distance(RayOrigin, Sphere.xyz);
 if (SphereDistance < Sphere.w) 
{ 
density += 0.1*DensityScale;
}else { } 
} 
return exp(-density);  
#

Thats a script inside of my raymarching thingy for clouds

#

For some reason, I get these errors

opaque sun
# opaque sun

im very sure these errors are caused by the "return" portion

#

because if I comment out the return. these errors vanish, and others take its place, that the output isnt working

knotty sun
opaque sun
#

But i dont really understand why its doing this

#

(im stupid)

leaden ice
hexed pecan
#

I think that's HLSL

leaden ice
#

Well fine, same thing though

hexed pecan
#

Is it a custom function node in shader graph?

opaque sun
#

the only type i see is "string" or "file"

opaque sun
#

thats the issue

hexed pecan
#

So it doesn't even have a body that you wrote void in?

leaden ice
#

You need to use an out parameter for that iirc

hexed pecan
opaque sun
#

a float

leaden ice
opaque sun
#

im pretty sure it works properly for the out

opaque sun
#

wait

#

that actually worked

#

Thanks man

leaden ice
#

Ofc

vestal arch
#

did you expect it to not work

opaque sun
vestal arch
#

aren't we all

opaque sun
#

And tried MANY things that didnt work

mighty juniper
brazen kestrel
#

So I have been messing around with cinemachine and character movement and I got it down, and works as should. I understand what is happening but I dont understand why. In the code below I get the direction that character should move according to the cameras position but for example I would think forward direection = cameras transform. Forward but what worked was .right and for side movement I found that .forward works to move the player left and right according to camera position. Is this because the camera and the player object have different directions, if that makes sense. here is my code:

{
    if (verticalInput > 0)
    {
        // Get the camera's forward direction
        Vector3 forWardDirection = -cameraTransform.right;
        transform.Translate(forWardDirection * forwardSpeed * verticalInput * Time.deltaTime);
    }
}

void MoveSide()
{
    if (horizontalInput != 0)
    {
        // Get the camera's side direction
        Vector3 sideDirection = cameraTransform.forward;
        transform.Translate(sideDirection * sideSpeed * horizontalInput * Time.deltaTime);
    }
}```
brazen kestrel
soft escarp
#

im sure someone had this issue before
how to stop the player from sliding down the slope when jumping?

hexed pecan
#

Show a video of the issue?

soft escarp
hexed pecan
#

I don't know anything about your game, are you moving with a Rigidbody/Rigidbody3D? CharacterController? What does the movement code look like?

#

You could just manually set your velocity to zero when you are on the ground and not trying to walk

soft escarp
hexed pecan
#

setting the velocity to 0 wont work for my type of game(fast paced)
What do you want to happen when you land on a slope?

soft escarp
#

continue to move the player?
now i just realized im fuken dumb
those two things almost cant coexist

spare dome
#

setting the rb to velocity to 0 (when on a slope) should fix your issue then

soft escarp
#

idk, i have brain damage from unity lmao

soft escarp
#

so, it doesnt work but there is a second issue i have encountered
the spherecast lags behind the player or the physics debugger is not showing the true position

swift delta
#

still learning my way around the new input system. is there a delay on registering actions on Start() via InputWhatever.action.Started compared to just getting a value in Update() via InputWhatever.action.ReadValue<>?

#

ReadValue seems to be working flawlessly for my character's 3D platformer movement, but I'm not sure if I should be using that or Started/Performed for jumping

heady iris
#

oops, comlpetely misread that lol

#

Start runs before the first Update call.

#

Note that if the control was already being held down when Start ran, I'd expect for the performed callback to not get invoked at all

#

(until you let go and then press the control again)

swift delta
#

I'm most likely not going to be distinguishing between tapping and holding jump for now, so I guess started will work best

heady iris
#

started and performed will be invoked at the same time if you don't have any interactions on your action

swift delta
#

so I could just

void Start()
{
    (...)
    I_jump.action.performed += _ => Jump();
}

void Jump()
{
    // Do stuff
}

without worrying about delays then, right? neato

heady iris
#

I'm not sure what the "delay" would be here

#

I thought you might've been talking about a delay before you can start receiving actions t all

swift delta
#

unity taking a while to detect an input. I'm just assuming the worst

heady iris
#

I would not expect there to be any appreciable difference, beyond exactly where in the frame the performed event is invoked

#

I don't know exactly where it happens

polar marten
swift delta
#

just wanted a quick answer without needing to do performance analysis myself, just being lazy

mighty juniper
#

Hey all, I'm trying to rotate my character in space, in 3 dimensions, and here are the functions i've written for it:

    private void RotateInDirection(Vector3 direction) // Applys torque in a direction and damps change in velocity
    {
        if (direction.magnitude > 1f) direction.Normalize(); // If will gain extra accel from diagonal, normalise
        float thrustModifier = rb.angularVelocity.magnitude < (MaxRotationalSpeed / 10) ? RotationalThrust * 2 : RotationalThrust;
        rb.AddRelativeTorque(direction * thrustModifier, ForceMode.Force);
    }

    private void HaltRotation()
    {
        if(rb.angularVelocity.magnitude <= 0.1f) rb.angularVelocity = Vector3.zero;
        rb.AddTorque(rb.angularVelocity.normalized * -(RotationalThrust + OverheadRotationalDampingThrust), ForceMode.Force);
    }```

I have no drag on the rigidbody, and have not yet implemented my own damping system, as am just trying to get the basics down first. This mostly seems to work (i have only tested with pitch and yaw currently), but for some reason yawing seems to happen much quicker than pitching, but i cant figure out why, does anyone know what im doing wrong?
heady iris
#

Does your character have a non-spherical collider?

#

I believe the rigidbody tries to model the moment of inertia properly

mighty juniper
heady iris
#

A capsule is much easier to spin around its long axis than any its short axis

#

Perhaps you want to ues ForceMode.Acceleration to get a fixed change in angular velocity, no matter how much inertia there is

mighty juniper
#

is there a quick way to disable it, or do i just have to multiply it by the difference in lengths

wintry crescent
heady iris
#

If you don't want to factor in inertia, don't use ForceMode.Force

mighty juniper
mighty juniper
#

or is that not how it works

wintry crescent
heady iris
mighty juniper
mighty juniper
still jungle
#

i wonder if you got that prediction script, from past days, working right

mighty juniper
# still jungle i wonder if you got that prediction script, from past days, working right

I realised that my technique was entirely flawed due to an edge case (literally). I was casting a ray to detect things infront but what i would've needed to do instead would be to project my entire body forwards, and then check if that overlapped with anything, as the ray coming from the centre could miss a corner, when in reality the collider would still hit it, I will probably go back and implement it, but i decided to see how sickening damping it would actually be first, because it might not be that bad

rocky basalt
#

Could someone help me understand why a list is returning null immediately after its class is instantiated?

It's a non-Monobehaviour C# class. I instantiate it like this:
myClass = new MyClass();

..but the very next line, a Debug.Log indicates its contained list returns null.

The list is declared like this.
public class MyClass { public List<OtherClass> myList = new List<OtherClass>(); }

somber nacelle
#

are you sure the list is null? can you show the code where the NRE actually happens?

rocky basalt
#

OK it was because my init code had serialized the class and on restart had deserialized it, thus no lists. Duh

gritty jacinth
#

The following code works to rotate an object but it has a problem. The higher the degree of rotation the faster its rotating. Its happening because the it has to interpolate a larger span in the same amount of time but I am not sure how to fix that

Quaternion.Slerp(from, to, Time.deltaTime * rotationSpeed);
void basalt
#

this looks like a bandaid solution, but then again I dont really know what you're doing.

rich fog
#

it's true that using deltaTime as the interpolation parameter is technically 'wrong' because it can be greater than 1, but for any practical application it works fine as long as all you want is a smooth stateless interpolation towards a target

steady moat
rich fog
#

double linked

cosmic rain
#

The issue with using lerp that way is that theoretically, you'll never get to the target value

#

Also the interpolation curve is not straightforward to understand.

#

And there are better ways to damp the value than using lerp incorrectly

void basalt
summer tusk
#

Hey guys ive been using the new input system with a blend tree for movement im on the last steps to being finished. As you can see the characters goes back to nuetral idle pose when movement stops. I tried to capture last direction but with new input system I kinda got lost. Im fairly new to this.

dire crown
#

Is there any way to reopen a bug report that it says fixed?

#

This still happens in 2022.3

#

Well, kind of now that i read it better. This bug report is for play mode, in editor mode it still flickers

static bridge
#

I am getting this warning in unity once I switch scenes in runtime in unity:
The referenced script (Unknown) on this Behaviour is missing!
I believe this is because this script:

using TMPro;
using UnityEngine;

public class VolumeStatusUpdate : MonoBehaviour
{
    public TMP_Text VolumeStatus;
    // Start is called before the first frame update
    void Start()
    {
        GetComponent<UnityEngine.UI.Slider>().value = MainManager.Instance.volume * 100;
        VolumeStatus.text = "volume: " + (MainManager.Instance.volume* 100) + "%";
    }

    public void NewVolume()
    {
        MainManager.Instance.volume = (int)(GetComponent<UnityEngine.UI.Slider>().value * 0.01);
        VolumeStatus.text = "volume: " + (MainManager.Instance.volume * 100) + "%";
    }
}

may be trying to access MainManager.Instance.volume before it loads. The MainManager script is in an empty object:

using UnityEngine;

public class MainManager : MonoBehaviour
{
    public static MainManager Instance;
    public int volume = 1;
    public float mouseSensitivity = 10f;
    

    private void Awake()
    {
        if (Instance != null)
        {
            Destroy(gameObject);
            return;
        }
        Instance = this;
        DontDestroyOnLoad(gameObject);
    }
}

How could this be fixed?

Solution: #archived-code-general message

vestal arch
#

you aren't getting the issue when you load the scene directly and play from that scene?

static bridge
#

I only created the empty object in the menu scene as that's the starting scene

vestal arch
#

iirc that error is when you put a component on a gameobject and then delete the corresponding script

#

the error should highlight what object has the issue

static bridge
#

I may have forgot to drag the new script but it works as intended without it on the only place I think that may have happenned. I'll try

static bridge
vestal arch
#

that's not what im saying the issue is

static bridge
vestal arch
#

expand that (Script)

#

that's where the error's coming from

static bridge
#

Oh okay, thanks

#

Yeah that was it

ocean hollow
copper rose
buoyant kayak
#

Can any one help me fix my errors

tawny elkBOT
vestal arch
tawny elkBOT
buoyant kayak
#

Can we dm?

crisp flower
#

I'm using the unity pool namespace for my pooling of enemies. However, when I am prewarming I do

    {
        for (int i = 0; i < initialPoolSize; i++)
        {
            Health health = healthPool.Get();
            Debug.Log($"Prewarmed Health instance: {health.name}");
            healthPool.Release(health);
        }
        Debug.Log($"Total objects in pool after prewarm: {healthPool.CountInactive}");
    }```
However, the Release function actually removes it from the hierarchy instead of just inactivating. From what I understand this isn't expected behaviour. Any ideas? (if I comment out the Release() function they are definitely being created)
vestal arch
buoyant kayak
#

True

#

Here look

#

How do I fix

cursive granite
#

just for your info, you can take screenshots via win+shift+s

buoyant kayak
#

Ok

#

But can you help me?

cursive granite
#

Unfortunately not, I am currently getting help myself notlikethis

buoyant kayak
#

Ok

#

!bug

tawny elkBOT
#

🪲 To make bug reporting as quickly as possible, we made a bug reporting application for you. When running Unity choose Help->Report a Bug in the menu, or you can access it directly through the executable in the directory where Unity is installed. It will also launch automatically if you experience a crash.

📝 If your bug report is to do with Documentation, either an error, typo, or omission, you can report it by scrolling to the bottom of the page where you found the issue and click ‘Report a problem on this page’!

💡If your report is to do with a new feature idea, you can check the Unity Product Roadmaps page to see if your idea has already been planned.

For more complete instructions on how to report bugs, access: https://unity3d.com/unity/qa/bug-reporting

vestal arch
buoyant kayak
#

Ok

vestal arch
#

secondly, why do you have an assembly inside Scripts?

buoyant kayak
#

What’s an assembly?

vestal arch
#

the Assembly-CSharp, do you literally have that folder?

buoyant kayak
#

Yes

vestal arch
#

where did you get that

buoyant kayak
#

Idk

vestal arch
#

did you download some extra library or something

#

what have you done so far

#

what are you trying to do

buoyant kayak
#

Scripting

vestal arch
#

you really aren't giving much info to work with

buoyant kayak
#

30 errors

vestal arch
#

that's not what im asking, no

buoyant kayak
#

Ok

vestal arch
#

what are you trying to do

buoyant kayak
#

The scripting for playfab authenticator

vestal arch
#

where did you get this gorrila networking thing

#

did you download them somewhere, did you install an asset, did you write them yourself

buoyant kayak
#

I downloaded it somewhere

vestal arch
#

alright, where did you download it from

buoyant kayak
#

A discord server

vestal arch
#

what file did you download

#

a zip? a unitypackage?

buoyant kayak
#

A zip

vestal arch
#

...and there was an Assembly-CSharp folder in there?

buoyant kayak
#

I think

#

Why

#

Am I not supposed to have it

vestal arch
#

no

#

i don't think so

buoyant kayak
#

By the way, where did you see the assembly seas sharp?

#

Auto correction sorry

#

C sharp

vestal arch
#

in the error message

buoyant kayak
#

Ok

vestal arch
#

what does the file in question even look like to have all those errors

buoyant kayak
#

Why did it get rid of all the errors?

vestal arch
#

why did what

stoic sluice
#

@buoyant kayak Do you have experience with debugging code?

#

You should be able to open the project in your preferred IDE and identify the cause of that error.

#

It looks to me like a bracket out of place on first glance or something which would cause a cascade of compilation errors.

#

That's a lot of errors which likely have their root in a syntax error which is causing many other errors.

odd stone
#

Good day everyone, Does anyone here know How to script an ingame screen panel that Tells a person's location?

stoic sluice
#

Minimap?

heady iris
#

I mean, that could be as trivial as

#
text.text = player.transform.position + " <-- look where I am!";
#

Can you explain a little further?

#

maybe you're looking for a panel that displays the name of the place you're in?

#

like "West 6th Street" or "Diner"

civic folio
#

"screen that tells a person's location" can be interpreted in many ways

soft shard
odd stone
# heady iris Can you explain a little further?

Sorry my initial question was very vague currently i have a 2X3 cargo rack and im trying to create a Screen Panel that can track if theres is something wrong with one of the cargos in the rack, there would be random events that will flag the cargo

odd stone
elfin tree
#

I've been trying to take a TextMeshPro and send it to a render texture without using a camera, I read somewhere that it could be done. All I managed to do so far is display the whole glyph on the rendertexture, which is a start I guess.

  void Update() {
      // Works to display the whole glyph.
      renderTexture = new RenderTexture(1024, 1024, 24,  RenderTextureFormat.ARGBHalf); // Adjust size as necessary
      renderTexture.Create();
      _sdfMaterial = textToDisplay.fontMaterial;
      
      var rendrTexture = RenderSDFToTexture();
      var screenMaterial = UnityUtility.CopyMaterial(screenQuad.GetComponent<Renderer>().material);
      screenMaterial.SetTexture(InputVideoProperty, renderTexture);
      screenQuad.GetComponent<Renderer>().material = screenMaterial;
  }
  
  RenderTexture RenderSDFToTexture() {
      RenderTexture activeRT = RenderTexture.active;
      RenderTexture.active = renderTexture;
      GL.Clear(true, true, Color.clear);
      Graphics.Blit(null, renderTexture, _sdfMaterial);
      RenderTexture.active = activeRT;
      return renderTexture;
  }

According to that post I should use Graphics.Blit or a similar method to render the SDF material’s output to a render texture in HDR, not capturing the textmesh with a camera to a render texture. I should be able to use the Distance Field material from my TMP object to render to a texture.

jagged plume
#

huh

jagged plume
#

I have some images that seems quite pixelated when playing the game (on left scene editor they seem fine, pixelated on right)

rigid island
visual fjord
#

How I can have the script the a prefab, when this launch an event for other gameobject?

rigid island
visual fjord
leaden ice
rigid island
soft escarp
hexed pecan
#

Why abbreviate something like JFHandler

rich fog
# soft escarp can anyone rate my code and optionally say what i could do to make it function b...

i think it's pretty fine overall, the consistency of naming and style is a little all over the place tho (some public fields are CamelCase, others are _lowerCase, etc)

also I'd watch out for using AddForce in Update(), I believe pretty much any time you are adding force on a per-frame basis (even with velocity change), you should be doing it in FixedUpdate(). You also aren't using deltaTime in your AddForce calls which would be a good idea in case you ever change the fixed timestep

#

note that you'll have to re-balance all your force values once you incorporate dt

soft escarp
hexed pecan
#

I agree that AirTimeHandler should be called from FixedUpdate instead, since you are adding a continuous force there

rich fog
#

they are using it, but not for every call to AddForce, as Osmal pointed out

rigid island
#

oh yeah ok forget im blind today

gritty jacinth
#

question if i have X 3d points if I was to add them all together then divide by x it would return aproximately the center of the 3 points right?

rich fog
#

it would return the 'average' of the positions which depending on what you think of as center is probably close enough!

gritty jacinth
#

thats what im thinking too

#

doesn''t need to be perfect at all

tidal moss
#

Not sure what chat this should go in but, when the camera is zoomed in a lot, 24x, low fov. the looking around becomes choppy, like im watching the dpi of my mouse or something. any way to get past this so it is just as smooth as say 90 fov. using a dual render scope shader

visual fjord
# rigid island explain please

The prefab have a script, the script shoot a event for those gameobjects, but the prefab is instance to scene thanks to other gameobject

#

So, I need the script of prefab for the event in the hierarchy

rigid island
visual fjord
rigid island
#

are you using Action?

visual fjord
rigid island
visual fjord
#

Event and delegates

rigid island
#

Action is a delegate

rigid island
visual fjord
#

C# events

rigid island
#

it also has one for sender if you use EventHandler

visual fjord
#

So, is better use an Action and Eventhandler

rigid island
#

isnt that delegate you used ? EventHandler ?

simple egret
#

Just post your code at this point lol

visual fjord
#

@rigid island ```C#
using Unity.Burst.Intrinsics;
using UnityEngine;

public class Enemy_1 : MonoBehaviour
{
public float speed;

Rigidbody2D rb2D;

public float points;

public delegate void UpdateUI(float points);
public event UpdateUI UpdateUIPoints;

[SerializeField] GameObject burst;
void Start()
{
    rb2D = GetComponent<Rigidbody2D>();
}

void FixedUpdate()
{
    rb2D.AddForce(Vector2.left * speed, ForceMode2D.Impulse);
}

void OnTriggerEnter2D(Collider2D other)
{
    if (other.gameObject.tag == "bullet_ship")
    {
        speed = 0;
        UpdateUIPoints?.Invoke(points);
        Destroy(gameObject);
        Instantiate(burst, transform.position + new UnityEngine.Vector3(0f, 2.06f, 0f), Quaternion.identity);
    }
}

}

#

The script of the prefab

rigid island
#

Action<MyCustomObj>its neater than doing Action<GameObject, float>

visual fjord
#

I get it, thanks

rigid island
#

public event Action<(GameObject sender, float points)> MyTupleEvent;
tuple is okay for 2 items maybe 3 but looks messy as hell

leaden ice
#

I like to always make my own custom delegate types 😛

rigid island
hexed pecan
#

Would make more sense to move the arm with rigidbody forces or joints instead

#

I don't understand the part where you store the start position: startPosition = handRigidbody.position;
position is in world space

#

Well most of it doesn't make sense to me. Usually people do this kinda stuff with ConfigurableJoints/CharacterJoints

#

Also that's a weird attitude you have there lol

prime acorn
#

Whats my issue here? I try to figure out wether or not my mouse is inside a 2D Rect with this

hexed pecan
#

It expects a Vector2, you gave it a Vector3

#

Actually that should be fine

#

So show your code

prime acorn
#
if(RectTransformUtility.RectangleContainsScreenPoint(targetUI, new Vector2(Input.mousePosition.x, Input.mousePosition.y), mainCamera))
{
    OnDroppedOnTargetUI();
}
#

I put my mouse over the panel but its still false

#

Maybe I have the wrong approach but to me this looks like it should be working

lean sail
dusk apex
#

As for the behavior, you'd need to make sure that both the rect and point are within the same coordinate space.

lean sail
prime acorn
#

It appears to also work when changing screen space to camera didnt try giving a null argument

lean sail
#

It being without the camera

languid hound
#

How can I predict based off of a vector how far a rigidbody is gonna travel? I'm trying to calculate based off of a move direction where a rigidbody is going to end up in the next physics step

#

I tried multiplying (rigidbody.position + moveDirection) by Time.fixedDeltaTime but it wasn't exactly accurate

dusk apex
languid hound
#

Ohh thank you!!

#

Oh wait isn't that what I tried?

#

I just found out fixedTimeStep is Time.fixedDeltaTime

rich fog
languid hound
# rich fog it's a little unclear but it sounds like what you tried was `(position + moveDir...

I'm trying to get how far a rigidbody is going to move in a step based off of its velocity so I definitely should've worded it differently

My whole issue here is I'm basically raycasting down and having a capsule float above the floor as it's a tried and tested movement system. What's happening is it's finding how far up it should float but because it's calculating how far up it should float as if the rigidbody is static (it's not taking into account the velocity) the rigidbody floats lower than it should when moving up a slope and floats higher when moving down a slope

rigid island
languid hound
#

So much for a physics controller lmao. It's a shame this is annoying as it is

#

I'll probably explore other options before that but if it comes down to that then I guess so be it rip

olive tiger
#

Sorry to interrupt. My player has a child gameobject that acts as a pivot point for a weapon and has a script that handles rotating a weapon using the mouse (it faces the direction of the cursor). The player and the weapon both have a rigidbody, but the weapon's rb is kinematic. I'm trying to have it so that when the sword hits the wall, the player will be pushed back - somewhat similar to how you move around in Getting over it. The problem I'm having is that the weapon doesn't seem to cause any collision with the wall, I expected it to cause the player to be pushed back but the weapon instead just goes into the wall. I'm guessing it's to do with how I'm handling the rotation of the weapon, maybe because I'm just setting the rotation of the parent of the weapon?

public class WeaponController : MonoBehaviour
{
    [SerializeField] Camera cam;

    void Update()
    {
        Vector3 mousePos = cam.ScreenToWorldPoint(Input.mousePosition) - transform.position;
        transform.rotation = Quaternion.LookRotation(Vector3.forward, mousePos);
    }
}
rich fog
rich fog
strange patio
#

guys, can someone help me with new playstore policy. How can i get out from internal test, what should i test and how to test it i kinda confuse

rich fog
#

if you move straight forward when on a slope you'll run into the issue where the character kind of 'falls' down slopes rather than walking down them

faint hornet
#

hey, everyone. can anyone tell me if Jetbrains Rider editor is better than vsCode editor for unity projects? looking for someone with personal experience using both at some point in time. thanks

rich fog
faint hornet
rich fog
#

i just didn't want to switch haha

#

or pay for a code editor, but it really is worth it I think

olive tiger
#

Isn't there a free tier for Rider now?

rich fog
#

there is but only for non-commercial use

olive tiger
#

ah i see

faint hornet
languid hound
# rich fog this might be more of an issue of how you're moving the rigidbody when it's on a...

It's a completely physical character but I'm adjusting the velocity to have it instantly snap to a height above the floor. I tried projecting the vector onto the slope but this causes some weird horizontal movement (looking slightly left on a slope moves you more to the left than looking slightly left on flat ground would) and isn't exactly what I'm going for I don't think. I'm assuming that I have to do some form of world space movement like I am now because going into source games (basically the movement I want to replicate) shows that you'll shoot up a slope instead of moving up it slowly which is what projecting on a plane would do

rich fog
#

when you run it the first time they have an option to configure most of the hotkeys to be vscode-like

faint hornet
rich fog
#

it definitely still takes some getting used to and it feels a bit more heavy weight compared to vscode but overall its worth the switch

faint hornet
rich fog
#

it also automatically recompiles in unity when you save instead of waiting for you to focus unity, so half the time unity is already done compiling before you alt tab back

faint hornet
#

that's amazing

#

ok i'm switching

#

someone said it cost money to use it?

rich fog
#

you have to pay if you are using it for commercial purposes

faint hornet
rich fog
#

if the game is not free, yes

faint hornet
#

ahh i see

rich fog
#

i'm not sure of the specifics of the license, there might be a rev cap or something i'm not sure

faint hornet
rich fog
#

it handles everything like smooth movement up a slope etc

rich fog
languid hound
faint hornet
languid hound
#

I stand corrected there's only one result

rich fog
#

fwiw I initially resisted using something like that because I want very precise control over how my player movement works but that package is really well written and is very low level, it doesn't really have any impact on the game feel of your controller

#

the stuff it handles like standing on moving platforms and correct sliding against walls / slopes is tough to get right and nice to just have all working from the start

languid hound
#

That's same with me. I'm probably gonna end up only using it as reference

languid hound
#

Such a shame that literally everything works aside from some stupid issue with slopes lmao. Hopefully I can find the solution in the controller

fast vault
#

Hi all! I'm working on a Bloons Tower Defense-style game and need help debugging an issue with my "excessDamage" feature.

Currently, when you destroy a strong enemy, it spawns the next strongest enemy at its location (e.g., Yellow spawns Green, Green spawns Blue, Blue spawns Red). This works perfectly.

I tried adding excessDamage (e.g., if an enemy has 100 HP and takes 150 damage, it spawns the weaker enemy with 50 less health). However, my implementation breaks the "SpawnWeakerEnemy" logic, and no weaker enemies are spawned. The enemy is just destroyed outright.

Not Working Script (has excess damage): https://paste.mod.gg/nrbtsglmuxns/0
Working Script (no excess damage): https://paste.mod.gg/hbygerqlalwg/0

leaden ice
fast vault
#

One moment, will run it and screenshot for you. But will say, during one of the attempts, the debug logs indicated that the weaker enemies were indeed being spawned but instantly destroyed for some reason.

leaden ice
#

I mean one simple quick thing I'm seeing is that you're not making any attempt to spawn a weaker enemy at all unless there is excess damage:

        if (excessDamage > 0)
        {
            SpawnWeakerEnemy(excessDamage);
        }```
#

Wouldn't you spawn the weaker enemy no matter what, and just apply however much excess damage there was to it (including 0)?

fast vault
#

Yes, that clearly is an oversight on this most recent attempt. Ill fix that and let you know if that was the issue here

fast vault
# leaden ice I see you have debugging log statements in there - what was the result of that?

I removed the if conditional and am calling SpawnWeakerEnemy no matter what. Its still not working but I'm noticing some weird activity: from the debugs you can see that it looks like the enemy is being spawned. Also, for example, when my turret destroys a blue enemy I'm seeing blue particles (from its death effect) but also red particles (from reds death effect, blue should have spawned red). Indicating that, for some reason, the new enemy is instantly being destroyed

#

To clarify, the blue death was caused by a 100 damage projectile when blue was at 100 health, so expected behavior would be that blue spawns a full health red.

leaden ice
fast vault
#

I updated TakeDamage and SpawnWeakerEnemy with new debugs and the issue persist, but the logs are mad confusing. Red spawns, instantyl takes 0 damage, instantly 0 remaining health? Which trigger its dying debug, but then after it says red is spawning with 100 health?

fast vault
leaden ice
#

Which you don't

#

I do see that the red enemy is just never being given health

#

Oh I see why

#

it's because you're not assigning the health until Start

#
    void Start()
    {
        _health = stats.startHealth;
        _speed = stats.defaultSpeed;
    }```
#

that's much too late

#

you should delete this Start function and just make a function to set the stats:

public void Init(EnemyStats stats) {
  this.stats = stats;
  _health = stats.startHealth;
  _speed = stats.defaultSpeed;
}```
#

And then instead of:

            Enemy weakerEnemy = enemyPrefab.GetComponent<Enemy>();
            weakerEnemy.stats = weakerStats;```
#

you do this:

            Enemy weakerEnemy = enemyPrefab.GetComponent<Enemy>();
            weakerEnemy.Init(weakerStats);```
#

I would also change this variable name as a matter of suggestion:

GameObject enemyPrefab = Instantiate```
#

That is not a prefab

#

when you instantiate it, it's an instance

#

something like newEnemy or enemyInstance would be more appropriate

#

prefabs are only the things that live in your Assets folder

#

they never exist in the scene

fast vault
#

Three hours i spent trying to troubleshoot this and I can't believe I never considered removing health from start. Wow.

leaden ice
#

Start isn't going to run until like, the next frame after you instantiate

fast vault
#

Does this mean I don't need Start at all anymore

leaden ice
#

yes

#

Assuming you always call Init on a newly spawned enemy

#

You could also do:

void Awake() {
  if (stats != null) {
    Init(stats);
  }
}``` so that enemies placed in the scene directly instead of instantiated get their stats assigned properly
fast vault
#

Uh, I'll have to check my RoundManager to see how the waves are spawned in. I'll leave start there for the time being till I determine the manager is reliant on it

fast vault
leaden ice
#

well leaving start there could be problematic in that, if you have excess damage, and then Start runs after, they will heal

fast vault
#

Oh true, okay I'll check on RoundManager right now and make sure everything is setup to handle either Awake or Init

leaden ice
# fast vault Generally speaking, what would be the recommended approach

It kinda depends on how your game works.

If I made a game like this I would probably just have each enemy prefab just have their stats assigned in the inspector and this wouldn't be necessary at all.

But if the stats all need to be calculated at runtime then something like the Init method with a fallback in Awake would be about right.

You could have a bool that stores whether this enemy's stats have been initialized yet or not, to safeguard against accidental initialization.

olive tiger
leaden ice
#

Likewise - unless that sword has a Rigidbody, it will not be applying any forces to anything.

olive tiger
#

So is it just a case of getting the rigidbody of the child gameobject (the weapon in this case) and rotating that instead?

leaden ice
#

something like this would require essentially two Rigibodies attached to each other with joints

#

not a parent/child relationship

olive tiger
#

ohh i see

leaden ice
#

and they would both need to moving purely via physics

fast vault
#

@leaden ice Just finished implenting your suggestions and testing it. It works perfectly! I can even skip enemy types ie dealilng so much damage it jumps a level like yellow -> blue instead of yellow -> green -> blue. Thank you very much!

#

As to your suggestion about having the stats assigned in the inspector. Mine are attached to scriptableobjects, is that not a good approach?

leaden ice
#

that's fine as long as they're immutable

olive tiger
spark stirrup
#

How hard is it to convert a line renderer into a mesh?

cosmic rain
spark stirrup
cosmic rain
#

Depends on what you mean by it

spark stirrup
#

I'm using a line renderer to create a laser, but the billboarding looks weird and I would rather it just be fully 3D

leaden ice
spark stirrup
#

Haven't really done it before

leaden ice
#

if the thing is just a straight line, it would be simple enough to use a simple cylinder or capsule mesh and just scale it

leaden ice
spark stirrup
cosmic rain
spark stirrup
leaden ice
#

Honestly it's usually not that hard to improve the look of LineRenderer with some shader or other rendering tricks. Probably not worth the effort to get into procedural mesh generation. But, the answer is "hard, especially if you've never done anything like it before"

cosmic rain
#

Honestly, I wouldn't use it for a laser, but it's up to you. Either write your own mesh generator, or maybe use splines. I think they have a tube mesh generator included.

leaden ice
#

They do but I'm not sure if it works at runtime or how efficient it is

spark stirrup
obtuse relic
#

Do ScriptableObjects have a maximum number of allowed sub-assets?

marble badger
#

There is no defined limit for the number of objects that you can put into a single .asset file, no. I imagine that you might start to encounter some bugs at the 2 billion mark, and performance might be poor long before that.

polar marten
plucky inlet
steady bobcat
fresh notch
#

I`ve been trying to set materials to a mesh and its sub mesh through code, but when I duplicate the mesh afew times the materials seem to swap without any apparent reason, does anyone know why this may be happening?

placid summit
#

Hi does using Tasks allow multithreading for non-Unity API stuff in code or it just ends up like co-routines?

cosmic rain
placid summit
chilly surge
#

Just await it.

placid summit
#

u cant await from a normal function though - the example has all async calls

#

I need to start from a non async function!

chilly surge
#

Make the non async function call an async one where you can await, or use .ContinueWith.

cosmic rain
chilly surge
#

Tasks are fundamentally callback based, async/await is just nice syntax sugar to write code as if they were synchronous so you can avoid going into callback hell.
While you can use .ContinueWith to go back to writing callback based code with tasks, that's like going backwards.

steady bobcat
placid summit
#

yes but I am trying to compare to StartCoroutine(xxx), (then it ends current function). I must be confused how to do same with a Task. If you run one without await does it then continue the function?

steady bobcat
#

Its not the same as a coroutine, the async function runs regardless of it being awated or not

placid summit
#

so how do you achieve multi threading then?

steady bobcat
steady bobcat
#

packages probably work but again if they interact with say AssetDatabase it will probably break (attach a debugger to break on exceptions to know if this happens)

placid summit
#

yeah I find it odd gltFast went with the Task approach - not sure of the reason as Tasks are not seen anywhere else in Unity

thick terrace
cosmic rain
pine carbon
#

İs it possible to add a Destroy call here?

steady bobcat
#

I use UniTask as i mainly work in older unity such as 2022 where Awaitable did not exist.

cosmic rain
placid summit
cosmic rain
pine carbon
#

So i gotta create a sceipr?

#

İ thought it would be possible to xall Object.Destroy dkrectly

cosmic rain
#

It would block though

chilly surge
thick terrace
#

if you block the main thread waiting for the main thread nothing is going to happen

cosmic rain
pine carbon
#

Ok ty

placid summit
chilly surge
#

If you for some reason really don't want to make an async method to use await, use .ContinueWith, when people have no issue making a separate method so they can StartCoroutine. But if you really don't want to, that's the way.

thick terrace
steady bobcat
#

plz just read up on async this is not going well 😆

cosmic rain
thick terrace
#

you can use async void , it's safe in unity

placid summit
steady bobcat
#

you call it as a function but dont await 😐

thick terrace
steady bobcat
#
void Start()
{
  DoThing().Forget(); //Forget is a unitask thing to log errors properly
}

async UniTask DoThing()
{
   await UniTask.Yield();
}```
cosmic rain
#

Just this should work

void Start()
{
  DoThing();
}
steady bobcat
#

its shit though

thick terrace
steady bobcat
#

for runtime game code you don't want to use Task

cosmic rain
#
void Start()
{
  DoThing();
}

async void DoThing()
{
   //the async logic
}
steady bobcat
#

to be clear, Task is the .net async task object, UniTask is a unity specific replacement for Task that is better for Unity specifically.

#

and Awaitable is the same but made by unity but ONLY in later unity versions

placid summit
steady bobcat
#

async void is bad as it uses Task anyway which you want to avoid.

cosmic rain
thick terrace
steady bobcat
#

god i just explained

cosmic rain
#

There's nothing wrong with using .net Tasks.

thick terrace
#

async methods are async methods, whether you're using UniTask or C# tasks, and neither one is being used if you use async void because... it's void haha

steady bobcat
#

Task creates garbage. async void actually uses a Task behind the scenes but this syntax means "this function is not awaitable"

#

UniTaskVoid exists to replace this too

cosmic rain
#

There's nothing bad in a little bit of GC.

thick terrace
#

all async methods create garbage because it has to allocate a state machine on the heap, UniTask and Awaitable are just more efficient because the return object is pooled or a value type

#

that's a C# thing, not a Task thing

steady bobcat
#

Yes. UniTask also offers functions to let you properly interact with unity frame events just like coroutines.
They explain it on their github page readme.

thick terrace
steady bobcat
placid summit
chilly surge
thick terrace
#

or use Forget or whatever

placid summit
steady bobcat
chilly surge
#

Asynchronous actions fundamentally completes later, tasks is just an abstraction for this "start now, call me back when you are done" pattern:

void SomeMethod()
{
    StartATask().ContinueWith(result =>
    {
        // Do something with the result
        Debug.Log(result);
    });
}

This code sucks to read and sucks to write, so C# comes up with async/await, which allows you to rewrite the code above into:

async Task SomeMethod()
{
    var result = await StartATask();
    // Do something with the result
    Debug.Log(result);
}

This syntax sugar makes the code nicer, but behind the scene it does the same thing.

#

Just because StartATask returns a task, it doesn't mean you have to use async/await, you can just use .ContinueWith.

#

But again, I don't understand the obsession to "avoid making an async method."

steady bobcat
#

sometimes you dont want the function to be async (e.g. using ref/in/out)

#

anyway its flexable and its nice. I use ContinueWith often to add a result to a list and still await it.

chilly surge
#

I don't mean "making the method async" I meant "making an async method"

steady bobcat
#

wa

chilly surge
#

If for some reason you cannot make the method async (eg ref like you mentioned) but you still want part of the logic to use the nice async/await syntax sugar, you can move that part of the logic to a separate async method. Or if you are using UniTask, move the logic into UniTask.Void(async () => { ... }).

placid summit
#

actually is this _ = LoadBinaryTask(data, r); //run and continue the same as .Forget();?

steady bobcat
#

You can do await LoadThingy().ContinueWith(thing => things.Add(thing));

thick terrace
steady bobcat
chilly surge
thick terrace
#

errors thrown in an async void method are also logged by unity fwiw

chilly surge
#

And I suspect whatever things.Add(thing) is doing, can be better accomplished by friends like Task.WhenAll etc.

steady bobcat
#

you are right you get back all results, but ContinueWith() lets you react for that task when its done and still await after.

chilly surge
#

.ContinueWith has its place but it's very rare in modern code. Often time it's much easier to write the equivalent in async/await.

steady bobcat
#

look its just another option do u

eager tundra
#

it gets pretty messy when you mix callbacks and async await

thick terrace
steady bobcat
#

~~no async code guarantees this but ~~Unitask ofc offers things to help ensure you are on the main thread

steady bobcat
#

Hm didnt know this, cool if it does!

thick terrace
#

unless you use ConfigureAwait(false), awaiting a task never results in you resuming on a different thread

steady bobcat
#

you can use await UniTask.SwitchToMainThread() to make sure you execute on the main thread

cold parrot
#

Awaitable also allows awaiting the main thread switch.

chilly surge
#

ContinueWith has a TaskContinuationOptions argument where you can control which thread the continuation runs with.

steady bobcat
#

im stuck on 2022 so UniTask is all i get

chilly surge
#

I'm on 2022 as well and uses UniTask, I'd probably still stick with that even after migrating to 6. The cancellation situation with awaitables seems less than ideal.

steady bobcat
#

do they not provide a cancellation token arg?

#

like for waiting time/frames

thick terrace
#

all the methods do take one

steady bobcat
#

I like unitask too. I use UniTaskCompletionSource a lot as well as WhenAll() and WhenAny()

thick terrace
#

Awaitable itself has a Cancel method, i have no idea what that's for

cyan ivy
#

Aren't awaitables pooled and thats why you can cancel them? Because every instance of an awaitable is unique to the current task?

steady bobcat
#

UniTask is the same unless you use Lazy

thick terrace
grand aurora
#

hi, guys. how can i access surface type field via script (urp)?

fleet gorge
#

Hold on

#

This is lit default right?

heady iris
#

Surface Type is a bit weird -- it's not a single property on the material. It configures several different properties of the shader.

fleet gorge
#

I'm not on pc right now but we need to look at a copy of lit default shader for this

heady iris
#

(well, everything in the "Surface Options" section is a 'bit weird' in the same way)

fleet gorge
#

It would be more optimal if you created another material that has the settings you want, then change the materials as you need

heady iris
#

This is slightly tangential, but I know you cannot change these sorts of properties at runtime in the built-in render pipeline

#

(e.g. you can't change Stencil settings)

#

this has caused me enormous amounts of pain in VRChat

fleet gorge
#

I'm pretty sure you can, but you need to look at the original shader's property's name because the display name in the editor is different from in the shader

#

But yes it's an immense pain

#

like Base Map in editor is actually m_BaseMap when you GetTexture

grand aurora
heady iris
#

I'm actually not sure where you'd read about what you can and can't change at runtime. Most of my knowledge comes from bashing my face into a wall and reading the docs for Poiyomi Toon, lol

fleet gorge
#

I don't have a lot of experience working with shaders

#

The 2 times that I do I writhe in pain

#

Unity's (URP) shader workflow hurts my brain

cold parrot
#

What is it that you want to achieve anyway?

fleet gorge
#

change Opaque to Transparent

#

which might be an enum

cold parrot
#

In gameplay terms

heady iris
cold parrot
#

opaque/transparent is a major change and should not really be necessary at runtime.

heady iris
#

notably, changing it on an HDRP/Lit shader changes:

  • ZWrite
  • Several stencil settings
  • The blend modes
  • Several keywords
  • The render queue
#

You can do very funny things by writing shaders that don't fit cleanly into an existing surface type

west lotus
#

Why not just swap out the material ?

rotund perch
#

@heady iris I hope you don't mind if I copy paste some stuff from your GUID constructor, it's got a lot of code that I don't deal with regularly like getHashCode() or Equals().

heady iris
#

Most of that is itself copy-pasted from the blog I had linked :p

#

the circle of life

#

(and I think that mostly just mimics what Unity's GUID class does)

#

notably the GetHashCode method

#

it appears to use the standard technique: Multiply your numbers by a prime number

#

i remember making that up in high school lol

#

(why? because prime number are..."more random" in some vague sense)

rapid flicker
rigid island
quick token
#

so my code doesn't just look like bruh

rapid flicker
#

i think atleast

rigid island
leaden ice
quick token
leaden ice
#

But you can certainly do:

[SerializeField]
private int a, b, c, d, e;```
quick token
rapid flicker
#

i put logs into new script that searches for the navmesh, and that logs just fine, but i dont know why it would not work in buil, isant there something in project settings?

hot yacht
#

Hello, im trying to Load an addictive scene, i have 3 scene Demo, UI and Game. and im trying to load the UI and Game from Demo scene. but i got NRE?
i alredy put the scene on buildsettingg. appreciate any help thank you
https://hastebin.com/share/nuwiwerinu.csharp

leaden ice
#

Be less vague

#

Also note thjat:

!SceneManager.GetSceneByName(sceneName).isLoaded``` this is probably not correct
GetSceneByName only works for scenes that are already loaded.
rigid island
leaden ice
#

Also:
AddictiveScene 😮

quick token
#

what is addictive supposed to describing here?

leaden ice
#

pretty sure it's a typo - should be additive?

quick token
#

oh, that makes a bit more sense. still dont know what it means but i can guess from context

hot yacht
# leaden ice > i got NRE? Where?

yes i got NRE on this code

        // Got NullReferenceException: Object reference not set to an instance of an object
            SceneManager.UnloadSceneAsync("Demo").completed += operation =>
            {
                LoadAddictiveScene("Game");
                LoadAddictiveScene("UI");
            };
leaden ice
#

namely the filename and line number

hot yacht
#

im sorry got typo there. thank you for pointing out

quick token
#

i would assume the SceneManager is causing the error, i dont think anything else in the function can even be null

rigid island
#

well its probably UnloadSceneAsync("Demo") not finding Demo, and probably cannot be accessed by .completed prop

leaden ice
#

yes you can't do .completed += on the invalid scene

quick token
hot yacht
#

i already put the demo on BuildSetting..

leaden ice
rigid island
hot yacht
leaden ice
hot yacht
wintry crescent
#

I'm making a UI system, made of pages
So I have a
public void OpenPage<T>() where T : UIPage on my UIManager
which destroys the currently open page, and instantiates a new one from a Dictionary<Type,UIPage> of page prefabs

I have a list of all page prefabs inside a scriptableobject, to which I add all my pages through the inspector, but I'd like to be able to choose which page goes first, from inside that same ScriptableObject

and I'm not sure how can I create an in-inspector selector of a specific page, so that I can just open it through the OpenPage<T> function

I'd rather avoid using reflection for this please
do I have to create a separate OpenPage(Type pageType) or is there a nicer way?
This is ugly, as it doesn't have that nice compile time check that PageType derives from UIPage, that OpenPage<T> does

leaden ice
#

I would put any differing functionality on separate scripts

#

let the page component just be a single simple type

#

GameObjects can have multiple components for a reason

wintry crescent
# leaden ice Why do the pages need different types?

because then, from within a button that opens settings for example, I can just do uiManager.OpenPage<SettingsUIPage>() and it magically works
and if they weren't different types, I'd have to figure out some other way like string keys or integer IDs and I really don't wanna do that

wintry crescent
# leaden ice Why do the pages need different types?

And since I have a guarantee of never having mutiple prefabs for the same thing (so no doubling up on the Settings Page prefab for example), if every single one is a different script deriving from UIPage, I can extremely easily open them at will, with easy compile time checks that I'm not trying to open something silly like a plain monobehaviour or something

#

Unless I'm overcomplicating and missing something obvious here?

leaden ice
sacred python
#

what algorithm can i use for triangulation for a set o points in 3d that represents a surface?

wintry crescent