#💻┃code-beginner

1 messages · Page 710 of 1

boreal violet
#

If i change displacement multiplier... Idk how to change anything to connect edges

near junco
#

Hello
I was wondering on how to use the Cursor.Lockstate, CursorLockMode and Cursor.Visible
Should I put those in Update() ? Is there a "best" practice to know ?

I tried using those lines in Start() but at runtime in the editor the cursor wouldn't lock or hide so I'm curious

wintry quarry
#

In the editor this will only have an effect when the game window is focused

near junco
#

the game window is in "Play focused" , that's why I don't understand why it doesn't lock/hide

slender nymph
#

you have to actually click into the game view window to focus it

#

if it is still not working then you need to make sure this code is actually running

near junco
slender nymph
#

either you are not actually clicking into the game view window or some other component is unlocking it

wintry quarry
strange kelp
#

How should I handle all of the scripts in my simulation(e.g. physics script)? Should I use a monobehaviour script attached to some object?

wintry quarry
#

in general yes you will need at least one MonoBehaviour as a code entry point in Unity to orchestrate your game logic.

strange kelp
#

But I heard there are also scripts that don't need a gameobject

raven pilot
#

Beginner here but should just be able to run a check if it's focused unsure if it's possible to allow a check of the editor itself or not, feel like this could be useful in some cases.

wintry quarry
strange kelp
#

Eh, I'll just make a gameobject called main and put all my monobehaviours on there

raven pilot
west sonnet
wintry quarry
#

I bet the pivot of whatever object you're rotating is off center for the gun

#

you'll also want to show the actual code for the shooting though

#

because this recoil script looks like only half of the equation

west sonnet
#

It's just behind the gun

wintry quarry
#

You want this generally on Pivot/Local

#

Ok show us the shooting code - where's the code that actually initiates the recoil movement

#

i.e. calls RecoilFire?

west sonnet
#

!code

eternal falconBOT
west sonnet
wintry quarry
#

yes you showed this code already. Show the shooting code

wintry quarry
#

How does the hierarchy of this gun and the thing holding it look?

west sonnet
#

Oh dude, my bad! I have a Gun parent object (which is empty) that has all the gun components inside of it. my shoot and recoil scripts are attached to that. It looks like the pivot is below the gun

wintry quarry
west sonnet
#

Oooh right

#

How can I move the pivot?

wintry quarry
#

you can just move the object that has the renderer

#

the child object

#

to where you want it

west sonnet
#

I've moved it so that the pivot is near the grip, but the gun still moves downwards when shooting

wintry quarry
#

(please don't crop screenshots, it removes helpful information)

west sonnet
#

The script is attached to the selected Gun object and in the script, what's affected is "Transform.rotation" so that would be the same pivot, right?

wintry quarry
#

yes

#

change the rotation in the inspector a bit to see how that rotation will affect things

#

if it's doing something different than when you run the game - some other thing is happening

chrome falcon
#

Hi, I'm trying to use yarnspinner for a dialogue system but I'm running into an issue after completing a build (either webgl or win64). Basically, the button to continue dialogue on click autodisables.
I'd appreciate any help. The issue is specifically triggered by building.

The docs say: https://docs.yarnspinner.dev/components/dialogue-view/line-presenter
"The supplied Line Presenter has an arrow button at the bottom. Clicking this will call RequestNextLine on the Dialogue Runner:"

Details:

  • In Editor (fresh scene with default presenter from Dialogue System ), continue button works as expected: one can click and trigger "RequestNewLine" via default arrow button.
  • After building for WebGL or Win64 development (no code changes as seen in git), returning to Play mode in Editor shows that the button is disabled and non-interactive in the inspector (see first image) even after the first line of text finishes appearing, and therefore, dialgoue doesn't continue to next line. This persists after closing the editor and reopening many times.
  • Creating a new presenter fixes it, but issue returns after another build.

Setup:

  • Default Unity Universal 2D template
  • Yarn Spinner component added via Hierarchy -> Yarn Spinner -> Dialogue System
  • No other canvas elements in view
  • Unity 6000.0.55f1

Please help me understand why is the button disabling itself during runtime after it has well finished typing the line and what I should i do to recover the default behaviour.

The image below shows it is disabled (during runtime)

Here is the repo with the minimal sample: https://github.com/jmferreirab/YarnIssue (you need to trigger build to trigger the error, otherwise you won't see the bug).

wintry quarry
#

Does your gun have an animator or something?

west sonnet
wintry quarry
wintry quarry
# west sonnet

one thing that's weird to me is we don't see it in the camera t all.
And nowe I realized the gun is a child of the camera and the camera is moving

#

my guess is you have some kind of impulse listener on the camera or something

chrome falcon
wintry quarry
wintry quarry
#

which I assume is not free, and I don't have

chrome falcon
#

no, no, its free. You can add from Open UPM or github. The repo has that.
You can also get it from itchio and pay

Literally just need to clone the github project and unity will set itself up with the package.

west sonnet
#

Ah man, I figured out the issue. I'm coming back to this project after a few months and forgot I added recoil to the camera

#

Thank you @wintry quarry

wintry quarry
#

Yuup seemed that way

near junco
chrome falcon
elder tusk
#

Hi! I'm new to Unity and I'm trying to use a Tetris Style Inventory System that someone else made available for download here:

https://github.com/DavidSouzaLD/InventoryTetris-Unity

I'm running into a couple of Null Reference Exceptions when I try to run the game, and I'm almost certain I set up everything correctly in the inspector.
I get the error immediately upon running the game, on line 157 of the Item Script.

When disabling the function in LateUpdate, the game runs until I click on an item to move, I then get another Null Reference Exception, this time at line 330 of the Inventory Script.

GitHub

This is a Tetris/Grid inventory design that you can use in any game. - DavidSouzaLD/InventoryTetris-Unity

naive pawn
#

on line 157
...this script?

wintry quarry
#

Item is only 156 lines long

#

so I think you're mistaken @elder tusk

naive pawn
#

perhaps show your stacktrace

elder tusk
#

for me Item.cs is 166 lines? If its okay I can send a screenshot of my VS Studio or maybe send a link to what my formatting looks like

naive pawn
#

the info you give for the other error you mention isn't sufficient to say anything either. something's calling it with null is about it

wintry quarry
eternal falconBOT
naive pawn
#

(also the S in VS stands for studio)

elder tusk
wintry quarry
west sonnet
#

When I shoot, a bullet is instatiated from the gun barrel and moves forward in whatever direction the gun is facing. Because of the slight distance in between the gun sights and barrel, if I aim at something, my bullet hits slightly below it, not at the actual target. Does anyone know how to mitigate this?

wintry quarry
west sonnet
#

Yeah, I've been reading about it :/

#

Not sure how to resolve it

naive pawn
#

isn't it a thing IRL too

wintry quarry
#

one common approach is to fire the bullet from the center of the camera instead.
Another approach is to fire a raycast from the center of the camera and then make a visual-oinoly bullet that goes to that point

#

there's no perfect answer - you need to think about what's a priority for your game

west sonnet
#

Hmmm okay, I'll give it a go. Thanks!

wintry quarry
#

(that plus bullet drop)

elder tusk
# wintry quarry `rectTransform` is null

making the rect transform public and getting rid of the {get; set;} lets it show up in the inspector and I can assign it, thus fixing the issue. Although I'm confused why the item script cant access the rect transform on my item prefab, I'd think I wouldn't have to manually assign it.

As for the second null reference exception, what could I provide to help solve the issue?

wintry quarry
wintry quarry
tidal tide
wintry quarry
#

and you may still run into issues of the bullet hitting cover when your sights are peeking over cover in that case. Which is maybe fine since that can happen in real life too

wintry quarry
#

I don't like that pattern 🤮

naive pawn
#

yeah yikes

tidal tide
elder tusk
wintry quarry
elder tusk
#

Im not sure what is null on 330

wintry quarry
#

Because it was different for Item

#

maybe share your version

elder tusk
#

Okay, Ill share just in case

wintry quarry
# elder tusk Okay, Ill share just in case

either way - a NRE is usually pretty easy to diagnose.

Identify all of the references that are being dereferenced in the line. For example if you see x.y, x is being dereferenced.
Then just put a breakpoint there or use Debug.Log to see which one of those references is null

#

then trace it back to where it should be set to see what's wrong

naive pawn
#

are these your own modifications?

elder tusk
naive pawn
#

i'd recommend just.. not doing that and perhaps using wrappers or your own classes adapted/inspired by that code
you'll just confuse yourself and others by saying you're using the scripts provided in that repo when you aren't

wintry quarry
naive pawn
#

which is a parameter

#

so it's from the calling code

wintry quarry
#

right so you should check the stack trace and see what's calling this and how it gets that reference

naive pawn
#

so you have to go a level deeper in the stack trace

elder tusk
#

is this the same place it takes me when i double click on the error? because it actually takes me to the Inventory Controller when i click on the error, or am I misunderstanding

wintry quarry
#

when you select it, you should see the full text at the bottom of the console window

naive pawn
#

when you double click the error you get the location of the last stack frame, the very top of the stack trace

elder tusk
#

oh so i get what you meant by deeper now

#

NullReferenceException: Object reference not set to an instance of an object.
Inventory.ReachedBoundary (UnityEngine.Vector2Int slotPosition, InventoryGrid gridReference, System.Int32 width, System.Int32 height) (at Assets/Inventory/Scripts/Inventory.cs:330)
InventoryController.Update () (at Assets/Inventory/Scripts/InventoryController.cs:25)

naive pawn
#

so the code that's erroring is called from InventoryController.cs:25

#

is that modified?

elder tusk
#

ill send mine just in case

naive pawn
#

so inventory.gridOnMouse isn't set

#

are you using the old or the new input system?

elder tusk
#

Im using the new input system

naive pawn
#

oh wait no that would be OnMouseX that has that issue..

#

not sure about IPointerEnterHandler...

raven pilot
#

Does prefixing a variable with a underscore vs not prefixig it with a underscore serve any puprose?

private InputAction _moveAction
// example 
naive pawn
#

it's convention to mark the variable as private

wintry quarry
raven pilot
#

so what's the use case of private then?

elder tusk
naive pawn
#

it's a vestige of an era where IDEs didn't exist, it made reading code easier since you didn't have to go back to check how the variable was declared
now we can just hover over the variable

naive pawn
wintry quarry
#

(although not really because private is the default if you don't put any access modifier 😛 )

raven pilot
#

Public is the default I'm aassuming.

wintry quarry
#

you assume wrong

naive pawn
raven pilot
wintry quarry
naive pawn
#

members in C# are private by default, adding private just makes it explicit

#

both adding that and the underscore prefix are style choices

raven pilot
#

ahh gotcha makes sense.

#

sorta

naive pawn
#

they don't have an effect, the only rule is to be consistent

wintry quarry
#

private is still a style choice but it feels more functional than the underscore because it's analagous to other modifiers like public, internal etc that actually do things

raven pilot
#

so you don't have to prefix it with a unscore it's just prefrence.

elder tusk
acoustic belfry
#

Hey, how i can make this script, work on a 3D space?


Vector2 direction = objetivo.position - transform.position;
float directionX = Mathf.Sign(direction.x);
mortemRb.linearVelocity = new Vector2(directionX * speed, mortemRb.linearVelocity.y);
rough granite
#

change the 3 Vector2's into Vector3's

acoustic belfry
#

t h a t ' s a l l ?

#

this became easier than i thought

rough granite
#

and maybe change the directionX to Z, or well whatever way is meant to be forward

acoustic belfry
#

well, thanks :3

naive pawn
#

and might change directionX to a Vector2 (x and z) if it's intended to be a horizontal direction

wintry quarry
#

float directionX = Mathf.Sign(direction.x);
should be changed to a vector projection on the x/z plane

naive pawn
#

ooh, that's probably a better idea

#

would that be projecting onto Vector3.up?

rough granite
wintry quarry
#

Yes ProjectOnPlane with Vector3.up as the normal

lethal meadow
#

Alright im modifying a RenderTexture inside a compute shader to output the height (0-1) value to my terrain.
when i do this :
heightMap[id.xy] = float4(x, y, 0, 1);
it displays a normal uv map (proving it works). seen in image 1

but when i do this:
heightMap[id.xy] = float4(height, height, height, 1);
it becomes very warped for some reason. (image 2)

here is the full code
https://paste.mod.gg/ptarneakknfz/0

#

the noise itself and vertex displacement works perfectly fine so its not wrong data

#

im probably being slow but i have no clue whats wrong

rough granite
lethal meadow
#

for testing

#

soon ill only put it in red when i know it works

#

it SHOULD look something like this

wintry quarry
#

basically it looks like that image, just squished vertically

rough granite
wintry quarry
#

doing height *= blendFactor; in a loop is probably part of it

lethal meadow
#

in the uv image does it look wrong to you?

#

i thought the black part was far too small

wintry quarry
#

it does have a break; true

#

if you play with noiseScale what happens?

rough granite
wintry quarry
#

sure it does

rough granite
#

onlt that one instance it continues after

wintry quarry
#

you're thinking of continue;

lethal meadow
#

when i set nosieScale to 1 (originally 3) this happens

#

first image is what the texture is vs what the actual thing is

wintry quarry
#

sorry which one? The left or the right?

#

is the result

lethal meadow
#

the left

#

this one is the texture

#

hold on one second ill add some more detail

rough granite
#

damn things confuse me too much

wintry quarry
#

without the getHeight wrapper or any of the other stuff

lethal meadow
#

oh i used the wrapped actually

#

one second

wintry quarry
#

then there's an issue with your perlin noise

lethal meadow
#

but it works fine on the vertices?

rough granite
wintry quarry
#

I mean it's a shader, logging isn't really a thing

#

the texture outputs are the logs

lethal meadow
#

im using the same height variable for the vertex displacement and the noise generates fine

rough granite
rough granite
wintry quarry
#

No... there is no inspector. Shader programs run in parallel on thousands of pixels at once

lethal meadow
#

the noise works fine

#

i dont know why the texture isnt

#

i tried what you said about using just the perlin2d function though and it generates the same issue

wintry quarry
lethal meadow
#

ive just changed the colors so appologies for that

#

im trying to cut a path into the terrain which is why im doing this nightmare

#

ive made it so it writes that part as green

#

so the green stuff at the bottom SHOULD be inside the path?

strange kelp
#

Guys, how do I create a clone of a class object?
Like an independant clone of the same class with the same values. I need it to simulate orbits

wintry quarry
strange kelp
wintry quarry
#

those are 3 different options, by the way

strange kelp
celest ocean
#

so what language does unity support that is good for beginners?

strange kelp
#

C#

celest ocean
#

👍

strange kelp
#

Tbh, idk if unity supports other languages than C# without some random plugin

wintry quarry
strange kelp
#

I know godot has more than 1 supported

celest ocean
#

did unreal support multiple then?

strange kelp
#

Idk, it uses c++ i think

wintry quarry
#

Unreal used to support multiple
Unity used to support multiple

#

both of them now consolidated to one

celest ocean
#

alr then

strange kelp
#

C# is a bit better imo, it got foreach loops

celest ocean
#

say do any of u have some ideas for an game tht is similar to stardew walley in terms of features

wintry quarry
#

Stardew Valley in space

celest ocean
#

features not idea

strange kelp
#

stardew valley in germany

#

oktoberfest event

#

beer

rough granite
#

stardew valley in my backyard

strange kelp
#

drunk people around the world

naive pawn
celest ocean
#

my idea is tht player is an forger and u can sell ur creations for money or save em and go to a dungeon for more loot

strange kelp
celest ocean
#

beer and geting drunk could be a good idea tho

strange kelp
#

🤣

#

more drunk = more screen distortion

slow hollow
#

might be a dumb question but: how do you assert that you calculated ur normals correctly on terrain?

naive pawn
celest ocean
#

another feature is tht later player can monopolyse some buildings for npc like entry fee or sth

strange kelp
naive pawn
rough granite
strange kelp
celest ocean
celest ocean
#

if its tht bad i can switch but ppl are active on here so i can get faster opinions yk

past sentinel
naive pawn
#

whoops missed my own message..

rough granite
strange kelp
naive pawn
celest ocean
#

somehow i managed to make ths channel talk about code language and stardew walley

celest ocean
strange kelp
naive pawn
#

-# why is there no intellisense in discord smh

strange kelp
celest ocean
#

intellisense is wild misstype icl

#

how do u talk in small letters

strange kelp
#

"-#"

celest ocean
#

-#test

strange kelp
#

put -# befor your messages

#

add a space

celest ocean
#

im smurt

fickle plume
#

There's no off-topic here. If you want to talk game design create a thread in #💻┃unity-talk

celest ocean
#

-# i like men

naive pawn
#

google exists yall

strange kelp
naive pawn
#

not really

#

they're talking about the off-topic

celest ocean
#

if its small question like how to make small text thn ion see the prob

naive pawn
#

it's unnecessary noise; again, google exists

#

also, copy text exists

#

you can literally just find out yourself in 1 second without having to ask anyone

celest ocean
#

takes longer tho

fickle plume
#

Next one will be muted

rotund root
#

why is it 0.1 in unity and why setting acceleration to 1 or higher will make the character movement clanky? (i'm not smart enough to understand it)

silver fern
#

I have a WeaponController firing an AttackOne Unity Event. If I understood it correctly, I have to drag the script with the function I want to trigger into the event field in the editor, but when I do that it doesn't show me the methods of that script. How do I define a method that can be triggered by that Unity Event?

wintry quarry
#

Also for sharing code don't use screenshots.
!code

eternal falconBOT
silver fern
#

currently all I see is this

wintry quarry
#

you need to drag a GameObject that has the LiskarmAttackScript attached to it into that slot

#

not the script itself

silver fern
#

oh

#

cool thanks

strange kelp
#
public class Orbit
{
    public List<Orbit_segment> orbit;
    struct Orbit_segment
    {
        public Vector3 position;
        public Vector3 velocity;
        public float time;
    }
}

Why is this wrong? Sorry for german warning btw, gonna change language later

naive pawn
#

doesn't the error tell you exactly why it's wrong

#

orbit is public, but part of its type is not

wintry quarry
silver fern
#

the struct has to be public too

strange kelp
#

Oh, bruh

#

Thanks

naive pawn
#

is that not what the error says

strange kelp
#

Nah, not realy

silver fern
#

"Inconsistent accessibility"

#

a bit cryptic

strange kelp
#

It says less accessable, too cryptic for me tbh

wintry quarry
#

well "access modifiers" are things like private public

#

so it's saying Orbit_segment is less accessible than orbit which is a problem

strange kelp
#

First or second time having this error, pretty new to c# and unity in general
gonna remember that

#

Dang, rewriting this entire physics script was the best decision I've made so far. I can literally just make a loop and calculate the orbit from that lol

raven pilot
#

Think of Private as like your bedroom and public as the front porch is how I've started to remember.

strange kelp
#

Oh, I think of it as local variables in lua

#

or indentation levels, like in python I thnk

naive pawn
#

no, those are very separate concepts

#

that is scoping

strange kelp
#

Eh, works for me

keen dew
#

Unrelated and unsolicited advice, but that struct would typically be either defined outside the class (and named OrbitSegment) or if it's inside the class it can just be called Segment (so that its full name is Orbit.Segment instead of Orbit.Orbit_segment)

raven pilot
#

that's one way, I'm new to the whole programming all together, no programming knowledge or computer science so tryna use real world examples with certain modifiers etc

naive pawn
#

scoping is about what you're thinking about at a given time
accessibility level is about what info you give to other people (or allow other people to change)

strange kelp
naive pawn
#

to generalize the above advice a bit - types are by convention always PascalCase

silver fern
#

is a general question about events code talk or unity talk?

strange kelp
naive pawn
timber tide
#

python's concept of access is very loose and unlike c# it's not enforced

naive pawn
#

python doesn't have access levels

#

it's all convention, no?

timber tide
#

pretty much without plugins / editors

naive pawn
strange kelp
#

Not that the admin is gonna come again and mute us

naive pawn
#

jesus christ stop whining

silver fern
#

if I make a multiplayer game, and two players have events with the same name, will unity still keep them separate or will they trigger other people's listeners?

wintry quarry
wintry quarry
naive pawn
#

depends on how you trigger the event

wintry quarry
#

What kind of events

naive pawn
#

if it's by name, then yeah i guess it would? but usually it shouldn't be by name, or at least not just by name

strange kelp
#

I think yes if they're local and not over the network or smth
never used events in unity

silver fern
wintry quarry
#

And how is it listening

silver fern
#

Unity Event

wintry quarry
#

And is it a static event

#

Or an instance variable

#

Unity events are not fired or subscribed to by name

#

It will trigger whatever specific listeners you have added in the inspector or in code.

silver fern
#

ah I see cool

silver fern
strange kelp
#

in germany we say "trying > studying(like in university)"

wintry quarry
#

If each player has their own weapon controller with its own listener, no the paths won't magically cross

naive pawn
silver fern
#

also, if I then want to make an event that can be listened to by other players, I'd have to use a different kind of event right?

#

idk if it even makes sense to do that tbh

timber tide
#

no, everyone gets the same game version with their own same events

wintry quarry
timber tide
#

oh yeah that's true. If it's local you can run into problems

silver fern
wintry quarry
wintry quarry
#

You need to think about RPCs for communication over the network

#

Or network variables

#

aside from explicitly networked things, there is no communication between clients in a networked game

silver fern
#

I think it will probably be a p2p type game

timber tide
#

only problem with local is if you do use a global event manager with two similar controllers, but not hard to not code yourself into that situation

wintry quarry
silver fern
#

alright cool

#

thanks

naive pawn
#

!job

#

!collab

eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
Collaboration & Jobs

strange kelp
#

i dont this this is right here

#

Is this the time to call mods?

naive pawn
#

i think they're here lmao

brave robin
#

Trying out Unity's awaitables. For something like this, is there a return type or method I can use to exit out of this method that would remove the warning? Not every instance of this method needs an await, but some do

#

Unitask had a way, but can't seem to find the counterpart in this framework

grand snow
naive pawn
#

what's the warning, btw?

grand snow
#

the warning will be that the function does not await so its synchronous

#

so you can remove the async keyword and return a task object instead

brave robin
#

return default only works if I remove async from the signature
But problem there is that the method is being awaited on, and return default breaks it and it stops ther

grand snow
#

its fine

#

Oh, then that means a new awaitable instance is not in a complete state

#

unitask is fine

brave robin
grand snow
#

and we can see from the src its actually just a new UniTask instance

#

so unity fucked up somehow

brave robin
grand snow
#

no idea they have nothing similar listed in their docs

#

you can try doing return new Awaitable() instead?

#

but if it gets awaited forever then its not going to fly

brave robin
#

Nope, doesn't like that either
Ah well, back to Unitask

grand snow
#

Unity plz fucking finish a feature

#

unitask is just better it has way more features making it a good Task replacement

rich adder
grand snow
#

its when you are overriding something that returns a task

#

some things may need async some may not

rich adder
#

oh soo it seems to just be a superficial thing not wanting the IDE warn about this function being run as Sync not Async

umbral hound
#

Hey got a question. Please ping me if you answer, but I know UnityAction is a delegate, but what is UnityAction<> for? For example, UnityAction<float, string>

rich adder
grand snow
#

well yea but also better I think if you just return a task without async manually as it may simplify the compiled code

grand snow
rich adder
umbral hound
#

Because I saw that in Unity's FPS Microgame

#

I was just curious what those do

rich adder
#

those are just the types you want to pass through the event

#

if you did Action<string> then a string is expected when you do Invoke

grand snow
#

its the generic type argument that specifies the first event arg type

umbral hound
#

Okay, and just to clarify, UnityAction is the thing in the inspector that you can tie to a certain script or a gameobject, etc right?

rich adder
#

no thats UnityEvent

grand snow
#

yea, unity event uses the UnityAction delegate type

#

a delegate type is just a definition of a function signature

#

if this confuses you then you can research c# delegates and or c# Action

umbral hound
#

Huh, anyone have documentation on UnityAction I can read? I know the documentation page of it, but I wanna see further examples for how it's used

rich adder
#

most times you should just use System.Action

wintry quarry
rich adder
#

UnityEvent if you need inspector . everything else stick to Action or your custom Delegate

grand snow
#

public event Action myEvent 🙂 fast code event
public UnityEvent myUnityEvent; mid speed code event and slow inspector subscriptions 😐

#

public Action foobar; delegate abuse please seek help

rich adder
#

UnityEvent. is really good when doing assets / modular

naive pawn
rich adder
#

"oops we accidentally copied Action" /s

grand snow
lethal meadow
# lethal meadow

alright im gonna post this one last time before i completely give up even considering it for today
this is my compute shader
https://paste.mod.gg/rrymxsdcvpat/0

how would i go about adding a texture, in which i add the height value as a color? without causing this weird artifacting

#

the "weird artifacting" is in the replied message

rich adder
grand snow
#

anyway with normal c# events the delegate type can be anything, UnityAction, Action, your own its all the same

lethal meadow
rich adder
umbral hound
#

I see now. I just watched a video on it. For example, if you have UnityAction<float> when you invoke that action, you must insert a float value when you invoke it

rich adder
#

pretty much

#

generic <T> you give the type

grand snow
#

dang guess i was teaching no one

rich adder
#

its okay cause I made the same exact example instead of float used string but that kinda flew out the window ig lol

umbral hound
lethal meadow
#

i have absolutely not a clue why it wasnt working

#

hoping someone with more braincells than me can figure it out

rich adder
#

If I knew shader code I'd chime in lolno idea sry hence why I think someone in that forum might have more xp

lethal meadow
#

nah its all good

#

the data works and the texture coordinates work but put it together and it just doesnt

rich adder
#

overriding it or something ?

lethal meadow
#

nope

#

i tried remakign the data before i assign it and it had the same issue

rich adder
#

if you need 16 args in an action...something is wonky with your code or sum..

grand snow
#

well you can define your own delegate type so its not really an issue (except with UnityEvent specifically)

rich adder
#

just strange giving someone 16 args I wonder who requested that lol like just make struct bruh..

naive pawn
#

defining your own delegates is for wimps, in this household we use currying 💪

#

Action<T> is all we need

#

that's just what lambda calculus is, huh

acoustic belfry
#

what is the replacement of rb.drag, rb.linearDamping?

acoustic belfry
#

thanks :3

terse forge
#

Did you manage to fix this?

wintry quarry
#

additionally - much of the API has changed, so it's likely things will have to change other than the using statement

terse forge
#

ty!

rugged beacon
#

how do you change cursor on a button? do you just have a script chagne the cursor on every button ?

rich adder
#

or use IpointerEnter

wintry quarry
rugged beacon
#

so first one is update() on empty object and second its still script on everybutton?

cosmic dagger
#

Pointer events FTW!

rugged beacon
#

is pointer event basically script on every button ?

wintry quarry
#

I would write one script that allows you to assign textures for mouseover and just put that same script everywhere you need it

#

make heavy use of prefabs to simplify the authorship process

acoustic belfry
#

i dont know why my 3D character has a floaty jump, like if were on the moon

remote sparrow
acoustic belfry
#

how i modify the gravity?

remote sparrow
#

It should be in the rigidbody component no?

acoustic belfry
#

... no?

remote sparrow
#

Oh mb but u can check the project settings by going to edit in the top

#

Also can u send me the script I wanna see how your jump works

rich ice
acoustic belfry
#

but i mean, why this happens with default gravity?

#

wouldn't default gravity just well, make things fall, normally?

rich ice
#

well, it's not gravity causing the issues but instead how you're handling your jump in the code

#

changing the gravity will definitely make it feel less floaty, will also make it so you dont jump as high though

remote sparrow
#

I think u might have to use like the time.deltaTime thing

rich ice
#

pretty sure most games like mario increase the fall speed artificially to make the jump feel less floaty. platformers are a surprisingly nuanced genre though so there's a range of different ways to fix it

rich adder
remote sparrow
# acoustic belfry wat

I don't have access to my computer rn but I think u can just look that up on the unity docs

rich ice
rich adder
#

mixed with rb.linearVelocity = new Vector3(limitedVel.x, rb.linearVelocity.y, limitedVel.z);

wintry quarry
#

First is for movement.
Second is to set a speed limit

acoustic belfry
#

for movement

remote sparrow
rich adder
#

oh was looking at the wrong methodm

acoustic belfry
#

and make it dont go nuts

#

oh you mean movement2 and movement?

#

i was experimenting wich movement was better

#

as you can see, there's nothing that calls movement2

rich adder
#

yea saw you had two my mistake

acoustic belfry
#

so i should just modify the gravity?

#

i mean cuz modifing the mass i think makes it slower :<

rich adder
#

modifying mass has no effect on how it falls

remote sparrow
# acoustic belfry so i should just modify the gravity?

Follow Isadora's Edge on Kickstarter: https://www.kickstarter.com/projects/inboundshovel/isadoras-edge
Wishlist Isadora's Edge on Steam: https://store.steampowered.com/app/3125320/Isadoras_Edge/

(My actual fast fall value is about 47.5% but that felt too wordy to use in the video)

The game that I'm developing an an indie game dev is called Isa...

▶ Play video
rich adder
short condor
#

My bad

#

Oopsy

acoustic belfry
rich ice
acoustic belfry
#

How i do so?

wintry quarry
#

ever heard of the hammer and feather experiment?

short condor
#

Does anyone know what a boocean is, it keeps popping up

wintry quarry
#

it can only have two values, true or false

#

unless you actually meant "boocean", no idea what that is

short condor
#

No it says boocean

wintry quarry
#

that's not a thing I'm aware of. Give us some context?

#

popping up where?

acoustic belfry
#

But i mean actually Doesnt matter rn

acoustic belfry
short condor
#

WHAT IS BOOCEAN

acoustic belfry
acoustic belfry
wintry quarry
short condor
#

YES

#

There's A WEIRD MAN

#

DANCING

acoustic belfry
#

Wat

short condor
#

DID GET A VIRSU

acoustic belfry
rich adder
acoustic belfry
#

Like in mario.

I dont know

#

I just want to fix my fall

#

Or i should just modify the gravity?

teal viper
#

You'll need to explain the issue that you're trying to fix.

rich ice
# short condor WHAT IS BOOCEAN

<@&502884371011731486> they're trolling, also not the first spam/troll message they sent (message that was deleted earlier and the japanese shitpost in #💻┃unity-talk which was also spammed but prompty deleted by dyno)

#

no one here is going to help via DMs. if you have a question or want to help, just use the correct channel

rich adder
#

sounds like weird scam / phishing

hardy spear
#

I wanna work unity project, hdid?

acoustic belfry
teal viper
#

Games like Mario often have gravity increased

acoustic belfry
#

It doesnt

#

It doesnt

rich ice
#

me and krish also posted a solution which should fix the floaty jumps.
should just be able to add some artificial gravity with something like this

if(rb.linearVelocity.y < 0)
   rb.AddForce(Vector3.down * fallSpeed)
acoustic belfry
#

Define Normal

teal viper
acoustic belfry
#

I didnt touched a thing on sizes if thats what you refer

#

I have some drag things in code

#

Tho

#

I use it for fox the sliperring

#

And when i set it to zero the fall keeps slow

teal viper
#

minus air friction

acoustic belfry
teal viper
#

which is roughly equivalent to 2 meters.

acoustic belfry
#

2 units?

#

Mine is 1

teal viper
#

Anywhere in the range of 0.5-2 would be fine. Buf if it's scaled up to like 100s units, it would look like it's falling slower simple due to the scale

acoustic belfry
#

O h

acoustic belfry
#

still falls slowly

teal viper
acoustic belfry
acoustic belfry
teal viper
acoustic belfry
#

in air

#

in ground

acoustic belfry
teal viper
teal viper
acoustic belfry
acoustic belfry
teal viper
# acoustic belfry but doesn't feel like is like too floaty? like if it were on the moon?

No. It seems to align. Check out this video. They're throwing a ball from 2 meters and it takes around .62 sec to fall down.
https://www.youtube.com/watch?v=6PiACgsutGw&ab_channel=PhysicsBurns(RaymondBurns)

Then look at the attached video where I drop a .1 scaled sphere(basically 10 cm diameter I think). It takes around the same time to fall from 2 units height. The same is true for the capsule.

acoustic belfry
#

O h

But i mean. Then how i should do for make it jump and fall faster?

teal viper
#

Fall speed in mario is not realistic

#

So it's fine to adjust the gravity if your game requires it

#

Or you can add extra downwards force during the fall, just like @rich ice suggested.

rich ice
#

yup, should be something like this

if(rb.linearVelocity.y < 0)
   rb.AddForce(Vector3.down * fallSpeed)

may also want to check if the player is grounded, to account for slopes.

acoustic belfry
#

oh

#

thanks
:3

teal viper
#

It might also be way simpler in mario. It might be a constant speed throughout the fall

#

In real time(and unity physics) objects are accelerating as they fall, so the initial fall speed is very small, but as the object continues to fall, it grows more and more

acoustic belfry
#

oh

#

interesting

teal viper
#

Many platformers would prefer a constant fall speed over the realistic model

#

Or ast least some modified form of it

acoustic belfry
#

and Unity has a realistic model for default, isnt?

teal viper
#

Yep.

acoustic belfry
#

good

#

well, thanks a lot

teal viper
#

Well, it's a simulation, so it's not 100% realistic.

acoustic belfry
#

but is more realistic than a plataformer

teal viper
#

But it's way closer to realism than what you have in many platformers

acoustic belfry
#

yeah

floral trout
#

I hope this is the right place. Im making a 4x4x4 cube made of basic cube gameobjects, that are childed to an empty parent. Im trying to rotate the entire 4x4x4 cube around its center (0,0,0) and have it spin but whenever i mess with the rotation it ends up tilted and not rotating the way i want it to.

keen dew
#

You'll have to show the code and explain more clearly what you want it to do and what it does now

floral trout
#

i managed to get it to spin correctly on the x axis changing values cube vector offsets, parent's position, etc and now im 90% sure its the cube generation being wrong.(example of it spinning incorrectly)

rich ice
#

change this to pivot

floral trout
#

holy easy fix

#

would that also apply to "parent.transform.Rotate(Vector3.right, speed);" or would i need to specify pivot somehow?

rich ice
#

transform.Rotate always uses the objects default pivot.

keen dew
#

That setting only changes where the transform widget is shown in the editor. It has no other effect

floral trout
#

that toggle was screwing up my testing, but i think im the right track now, ty fellas

marsh plover
#

Hi, can anyone help me? I'm trying to import a house model, but when I start the game, the camera gets stuck on the house. Does anyone know why this happens?

meager gust
#

attached to it

marsh plover
meager gust
#

in the top left search bar, type t:camera

#

it will show you all the cameras in the scene

marsh plover
meager gust
#

under hierarchy

#

where it says "All"

#

its a search bar

#

top left

marsh plover
meager gust
#

yes, you've got multiple cameras in your scene

marsh plover
#

then I would have to leave the player camera

#

oh yeah, thank you

acoustic belfry
#

hi, how would this go on a 3D plane?


    protected void dispararBalas(GameObject balas, Transform balasPos, float bulletspeed, float angulo)
    {
        GameObject nuevoProyectil = Instantiate(balas, balasPos.position, Quaternion.identity);
        Vector3 direccion = (objetivo.position - balasPos.position).normalized;
        Rigidbody rb = nuevoProyectil.GetComponent<Rigidbody>();
        Vector3 direccionAngulo = Quaternion.Euler(0, 0, angulo) * direccion;
        if (rb != null)
        {
            rb.linearVelocity = direccionAngulo * bulletspeed;
        }
    }```

like this?

```cs
    protected void dispararBalas(GameObject balas, Transform balasPos, float bulletspeed, float anguloHorizontal, float anguloVertical)
    {
        GameObject nuevoProyectil = Instantiate(balas, balasPos.position, Quaternion.identity);

        Vector3 direccion = (objetivo.position - balasPos.position).normalized;
        Rigidbody rb = nuevoProyectil.GetComponent<Rigidbody>();

        // Apply horizontal rotation (yaw), then vertical rotation (pitch)
        Quaternion rotacion = Quaternion.AngleAxis(anguloHorizontal, Vector3.up) *
                               Quaternion.AngleAxis(anguloVertical, Vector3.right);

        Vector3 direccionAngulo = rotacion * direccion;

        if (rb != null)
        {
            rb.linearVelocity = direccionAngulo * bulletspeed;
        }
    }```
glossy turtle
#

why i am getting null reference exception when loading unity interstitial ads

naive pawn
#

that's not much info to go off of

glossy turtle
#

this is the error and ad is not showing.

naive pawn
#

that sounds like perhaps you haven't set a reference as expected

glossy turtle
naive pawn
#

a serialized reference in the inspector

#

but this is a guess since i don't have all the info

#

you'd have to go check the line that's triggering the error, see which values are possibly null, and trace them back to where they should be defined or provided from

waxen glacier
#

I have the issue with inconsistent jumping again, and although now it's way less blatant, on rare occasion the character jumps noticeably higher than it should. I added a bunch of code since the last time I had this issue so i'm not sure what the mistake is this time.
https://paste.ofcode.org/mzLQJwF4VnPXYAyPgd9Sjk

#

Also is there something I can use that's more precise than the Lerp function for decceleration ? because although the character stops moving when there is no input the velocity values never quite reach 0

hexed terrace
waxen glacier
hot wadi
#

How do u guys spawn objects in a large 2D map? Everything in one go or only certain things that are going to be shown on the screen?

wintry quarry
#

You should start with everything at once though

#

See how that performs, then fix it if it doesn't

hot wadi
#

I'm only starting with a demo. It certainly can run without complex rendering
But I need to showcase my skills to the employers so I'm trying everything possible

rotund root
wintry quarry
hot wadi
wintry quarry
#

You will always think you're grounded

rotund root
#

so it wont update until i collide with other things?

wintry quarry
#

Is that happening? No. So it won't become false

hot wadi
wintry quarry
#

Code only does what you tell it to do

rotund root
wintry quarry
rotund root
#

oh i didn't notice that

hot wadi
#

OnCollisionEnter only called when u collide. If u stay in the air, it's not called, no comparison is made, hence isGrounded keeps its last value unless u change it elsewhere in the code.

lapis pond
#

Can someone help me why my onmousedown doesn't work?
`using UnityEngine;

public class ClickOnBird : MonoBehaviour
{
void OnMouseDown()
{
Debug.Log("Hello");
}
}`

naive pawn
lapis pond
#

I don't know, I am using the default one

naive pawn
#

default of which version? it recently changed

wintry quarry
#

Which unity version

lapis pond
#

Input System Package (new), is this what I am looking for?

wintry quarry
#

Yep, that's why

#

Switch to IPointerDownHandler

naive pawn
#

yeah that doesn't work with OnMouseX

wintry quarry
#

(Google how to use that)

naive pawn
wintry quarry
#

Yes or that

#

But that has larger consequences

naive pawn
#

i mean if they're following a tutorial it'd probably be better to go with what the tutorial's doing

#

just for now while you're using the tutorial

wintry quarry
#

Well they're already using the wrong Unity version for that 😛

lapis pond
# wintry quarry Switch to IPointerDownHandler

I'll try that, I am not following a tutorial, I wanted to try unity out because I've been learning c# on a basic level, like making databases in wpf and stuff, and I am trying to make like blackjack and stuff to learn

shell sorrel
#

if thats the case IPointerDownHandler is what you want

#

for it to work you will also need to have the correct raycaster on your camera, is this for a UI object, a 2d object or a 3d object?

wintry quarry
#

(also an event system)

lapis pond
#

I've got it working, added an event system and a raycaster on the camera, I am working with an empty thing that has a sprite renderer

#

I am probably making it harder for myself not using the UI system

rancid tinsel
#

I recently learned how to use "=>", and it seems a bit too good to be true. Is there any issue with using it like I did here?

slender nymph
#

that's just a read only property, it's nothing all that special

rancid tinsel
#

It does make it so I don't need to set "waveFinished" in a method though - I'm just wondering if there is any reason I shouldn't do that I guess

sour fulcrum
#

It’s typical to use a CapitalThere for properties like you would functions btw

wintry quarry
#

Nothing more than a shortcut

#

Note it's not storing anything

sour fulcrum
rancid tinsel
#

okay so let's say it was a more expensive conditional - it would make more sense to actually store it, and therefore we don't run the method every frame in update for example

#

right?

wintry quarry
#

Potentially

ivory bobcat
#

If they're explicitly needing an up to date expression though, is fine.

wintry quarry
#

It depends on the access pattern

sour fulcrum
#

Yeah but like don’t overthink how expensive we’re talking about here, you can spend a lot on dumb checks and iteration type stuff for properties like this

wintry quarry
#

If you write a lot more than you read, then no sense caching.

If you read a lot more than you write, it can make sense to cache

rancid tinsel
#

okay so as a rule of thumb - if it will be called in update, I should probaby store the value normally

wintry quarry
#

Not necessarily

#

Once per frame is still really slow and infrequent in computing terms

#

If you did it 40,000 times per frame, sure

rancid tinsel
#

I know, I just mean more broadly in terms of building habits

sour fulcrum
#

If it’s in update and doing multiple layers of iteration maybe

rancid tinsel
#

I'm prone to adopting something and paying the price later lol

wintry quarry
#

I think it would be a mistake to make a variable for this particular thing as you're duplicating state

ivory bobcat
#

It's not significant to performance

sour fulcrum
ivory bobcat
#

Just use whatever's readable for you and your team

rancid tinsel
wintry quarry
#

Yeah and this is just a shortcut to that

#

With a variable you risk them going out of sync

sour fulcrum
rancid tinsel
#

Btw what on earth is up with SplineAnimate component? I recently made a game for a gamejam using Splines, and it straight up drops 170fps when running

ivory bobcat
#

It's private though so not applicable but yes

final kestrel
#

I am watching a video and see the person using constructors on MonoBehaviour derived classes. Is there really a need for that when you can just Initialize them on awake?

polar acorn
quick fractal
burnt perch
#

Im looking to make a dialogue mechanic in my "Mostly UI stuff" game. Can someone recommend me a good youtube tutorial for creating dialogue, similar to how Papers Please dialogue works? If not, any dialogue tutorial can work

final kestrel
#

All right. Thanks

quick fractal
#

If you make your Init method return itself you can do the same as a constructor too :catye

#

Awh damn no custom emojis 😞

final kestrel
#

Yeah it got me confused a bit. I think they never use it themselves either. Just making Set methods afterwards...

polar acorn
final kestrel
#

These two dimensional arrays making me so confused too smh

final kestrel
#

Yeah I think.

quick fractal
#

I shall continue to cope, in that case..

burnt perch
#

Is there a way to hide thing in editor without inactivating them? I dont want to have to activate my fade panel everytime I go test and deactivate it when in editor so I can see stuff

frosty hound
covert sinew
#

Okay, so I'm kind of losing my mind here, or at least, it feels like I'm going crazy.

I need a way to deep clone a class without manually defining everything that will be cloned in it. Just- Clone every single thing, all the references get clones, everything.

And yet, as far as I've been able to find, this is just- seemingly impossible? The closest I've found is writing a class to JSON, then basically reversing that to get a new instance of the class, but that seems ridiculous and inefficient.

There are ways to clone Monobehaviors and Gameobjects, but I don't need those, I just need a normal, ordinary class, that holds references to normal, ordinary classes, ect ect, and a way to just clone the entire hierarchy from top to bottom.

patent wedge
#

why does my public list when reloading the scene become empty?

covert sinew
slender nymph
covert sinew
sour fulcrum
#

Whats causing it

rich adder
covert sinew
# rich adder oh okay, have you looked into how to perform a deep copy in c# ?

I have looked into it, but all the resources I've found basically say you need to manually implement every layer of the copying process, which is not really feasible, for my usecase.

(Context, if it's absolutely needed: I'm trying to clone "Equipment" in my game that has some pretty beefy hierarchys of references self contained within it, which would mean for a fully manual cloning method, I'd end up with an extremely high maintenance problem when trying to modify it at all. The Equipment itself is a normal class, not derived from Unity's Monobehavior or Object classes, currently)

sour fulcrum
#

Not to hit you with the stack overflow question but do you need to do it this way?

patent wedge
#

i still don't know why unity is deleting my list after refreshing the scene?

rich adder
rich adder
patent wedge
strange kelp
rich adder
covert sinew
# sour fulcrum Not to hit you with the stack overflow question but do you need to do it this wa...

It is absolutely needed, unfortunately. My game currently has a custom crafting mechanic, which means items need to be able to know their relationships with one another, and also be copied from template assets without decently nightmarish consequences.

I don't usually like clarifying what my usecase is, to avoid questions like this bogging down the solution.

if JSON works, I might have to use that, I suppose.

rich adder
#

you said editor only feature to autofill ?

patent wedge
#

i just fixed it by moving something in the list and now it just works!

rich adder
strange kelp
sour fulcrum
covert sinew
#

Items need to know their connected relationships, in order to spawn them from data during battles.

#

I have the system already functional, but there's issues with, like I said, cloning these hierarchies when needed.

rich adder
#

this is basically a save system needed?

#

I think serialization / recreating it that way is the most straightforward

covert sinew
#

I have a save system, already, the hierarchy cloning is for editing safety, and certain Unity Editor functionalities, like accessing immutable templates to make copies of for various purposes.

#

But yes, I'll try serialization. Thank you very much.

rich adder
#

cool! let us know how it works out 🙂

strange kelp
#

Uh, time to code my orbit visualization 😭

waxen glacier
waxen glacier
#

but setting it to 1f or any other value works

strange kelp
#

yeah, vectors work with floats

keen dew
waxen glacier
keen dew
#

yes

strange kelp
#

Also, tryitandsee is the way to go imo

waxen glacier
# keen dew yes

Alright thanks, I was starting to loose my mind over this, gonna have to rework some of the code so it works with sprinting too

strange kelp
#

You already got the script, so change it and test it. Doesn't take very long, it takes longer to ask here I think

keen dew
#

Usually you'd clamp the input, not the final velocity

waxen glacier
waxen glacier
#

doesnt seem to work for some reason

#

ah yeah i get why now, my movement works a little differently, so i'll just stick to what i was gonna do

thick breach
#

Oh,hello everyone,I'm newbie and my purpose when I joined group is hoping everyone support me.I extremely love AI🥰

naive pawn
eternal falconBOT
thick breach
tiny bloom
#

guys how do u mark a whole scene as DontDestroyOnLoad?

naive pawn
#

DontDestroyOnLoad is per-gameobject, you would have to loop through root objects

strange kelp
#

Sup yall
So I need to clone a class with the following attributes:

public List<Physics_object> physics_objects;
public Physics_object center;
public const double gravitational_constant = 6.67430e-11;

Physics_object:

public Physics.body_type body_type = Physics.body_type.Planet;
public double mass = 1;
public Vector3 size = new(1, 1, 1);
public Vector3 position = new(0, 0, 0);
public Vector3 velocity = new(0, 0, 0);
public float sphere_of_influence = 100; // The range where vessels only get influenced by this body. Only planets have this attribute.

BUT: Physics_object is a monobehaviour. From what I've read, you can't copy them regularely, but you have to copy the whole gameobject it's parented to. How would I integrate it into this clone function?

public Physics_object Clone()
{
    return new Physics_object
    {
        position = this.position,
        velocity = this.velocity,
        size = this.size,
        mass = this.mass,
        body_type = this.body_type,
        sphere_of_influence = this.sphere_of_influence
    };
}
naive pawn
#

load other scenes additively

strange kelp
#

Yes, I need one

naive pawn
#

Instantiate lets you clone gameobjects (or components - it'll clone the gameobject that the component belongs to) including all their components and children

tiny bloom
naive pawn
#

you can't use new on a MonoBehaviour-derived class and expect it to work, btw.

naive pawn
strange kelp
#

I already saw that online, but should I then simply return the Instantiate(blablabla).GetComponent<Physics_object>() or smth

naive pawn
#

and then unload them as necessary

naive pawn
#

though keep in mind - with this pretty naive approach, you'll be duplicating any objects that are referenced in separate places

strange kelp
naive pawn
#

is that initial class not a MonoBehaviour? if it is you might be able to just Instantiate that
i think the references should work if they're all children of that object

strange kelp
#

The class Physics is not a monobehaviour, no

naive pawn
strange kelp
#

I hope that's not gonna become a problem
-# forshadowing maybe lol

burnt perch
#

Im looking to make a dialogue mechanic in my "Mostly UI stuff" game. Can someone recommend me a good youtube tutorial for creating dialogue, similar to how Papers Please dialogue works? If not, any dialogue tutorial can work

strange kelp
daring sentinel
#

Can someone help explain how async methods can react to events using delegates?

wintry quarry
#

perhaps you mean a pattern like:

- subscribe to an event
- wait until the event gets fired
- continue```
#

it'd just be something like:

bool eventFired = false;
someEvent += () => eventFired = true;
// pseudocode
wait until eventFired == true```
daring sentinel
wintry quarry
#

or you use an animation event to set a flag that you poll in the async

silk night
daring sentinel
silk night
#

Oh if you are using it anyway you can just use WaitUntil and check for your state that you are expecting

#

but yeah its just doing what PraetorBlue explained above, it just polls the state each frame 😄

daring sentinel
#

Ah ok, thanks, it's only for this use case where if a progress bar fills, an event fires. Using that I want to transition with silencing the audio and transitioning to that animation.

Then after that transition back to normal audio, with a different animation then playing a different timeline.

My game's basically interactive cutscenes

silk night
#

are you using unity animations for that?

#

if so I'd like to quote

or you use an animation event [...]
-# PraetorBlue

Thats most likely the easier solution 😄

daring sentinel
#

I am using the animator if that's what you're referring to?

silk night
#

yes, in animations you can place events that you can subscribe to

daring sentinel
#

As in like the state machine where I'm just transitioning with SetTrigger()

daring sentinel
#

Oh I wasn't using this at all, I was using the animator state machine, not this, my b.

silk night
#

yeah but the state machines contain animations

#

if you click on one of the states, the inspector shows the animation "file"

daring sentinel
#

Is it ok if we could make this into a thread and I could tag you?

Sorry I'm just having trouble understanding

acoustic belfry
#

Hey, someone knows why is this working... backwards?

rough granite
acoustic belfry
#

i mean, is shooting from it back

rough granite
#

You haven't provided any example of what you are experiencing, im not even sure if you are in 2d or 3d and there is not code i could help with

old coyote
#

Henlo, is anyone available? I need help with something basic ~

naive pawn
#

!ask

eternal falconBOT
naive pawn
acoustic belfry
rich ice
#

the humble negative operator katten_flatten_lkatten_flatten_r

rough granite
naive pawn
eternal falconBOT
acoustic belfry
#

again my bad

#

this makes sense why nobody understood

#
update
{
        dispararBalas(bala, transform, firingSpeed, 0, 0);
}


    protected void dispararBalas(GameObject balas, Transform balasPos, float bulletspeed, float anguloHorizontal, float anguloVertical)
    {
        GameObject nuevoProyectil = Instantiate(balas, balasPos.position, Quaternion.identity);

        Vector3 direccion = (objetivo.position - balasPos.position).normalized;
        Rigidbody rb = nuevoProyectil.GetComponent<Rigidbody>();

        // Apply horizontal rotation (yaw), then vertical rotation (pitch)
        Quaternion rotacion = Quaternion.AngleAxis(anguloHorizontal, Vector3.up) *
                               Quaternion.AngleAxis(anguloVertical, Vector3.right);

        Vector3 direccionAngulo = rotacion * direccion;

        if (rb != null)
        {
            rb.linearVelocity = direccionAngulo * bulletspeed;
        }
    }```
acoustic belfry
naive pawn
#

(objetivo.position - balasPos.position)
have you tried negating this

#

or, well, swapping the operands

acoustic belfry
#

no

naive pawn
#

that direction is from balasPos to objetivo

rough granite
#

Is the rotation part needed? Should a normalized Direction work for linearVocity?

acoustic belfry
#

i mean

#

i want to use the rotation on others enemies

rough granite
#

Meaning for the Vector3 direccionAngulo

acoustic belfry
#

for make the bullets be slighty angled from the line between the enemy and the player

#

but in this case no

naive pawn
#

which is the enemy and which is the player

acoustic belfry
#

objetivo is player

#

cuz is well, the objetive, target

naive pawn
#

so you get the direction from the enemy to the player

#

and then you.. rotate that value away from the correct value

acoustic belfry
#

thats the idea

naive pawn
#

pretty sure it isn't

#

think about that for a sec

#

you're getting the direction, and then you change it so it's wrong?

#

and then you expect that direction to be accurate?

acoustic belfry
#

i mean,

mmm wait

i mean in 2D worker

#

my idea is to be like the shoot of a...shotgun?

naive pawn
#

with some spread?

acoustic belfry
#

yeah

rough granite
#

Just make the rb.linearVelocity shot on the forward of the transform * speed and have the quaternion rotation when instantiated be the rotation

acoustic belfry
#

now i just realized that the bullets also dont move......

#

i had them with rigidbodies, so it pushed the enemy, a mere glitch i was gonna fix

#

when i did it, i discovered why the enemy was pushed, wasn't for the huge amount of spheres....was cuz they were spawning inside of it

#

uuurggghh

#

doesn't make sense, the code works on 2d i just tweak it

#

you know what, i will return it to 2D and see again how i can convert it to 3D, cuz i dont know what went wrong

#
    {
        GameObject nuevoProyectil = Instantiate(balas, balasPos.position, Quaternion.identity);
        Vector3 direccion = (objetivo.position - balasPos.position).normalized;
        Rigidbody rb = nuevoProyectil.GetComponent<Rigidbody>();
        Vector3 direccionAngulo = Quaternion.Euler(0, 0, angulo) * direccion;
        if (rb != null)
        {
            rb.linearVelocity = direccionAngulo * bulletspeed;
        }
    }```
#

here's the original working code

naive pawn
#

what's the point of angulo exactly?

acoustic belfry
#

spread

rough granite
acoustic belfry
#

just a collisionbox

wintry quarry
#

you could do Physics.IgnoreCollision between the bullet and the collider of the thing that's shooting it, if that's an issue.

acoustic belfry
#

oooh, wait

#

thats why didnt moved

rough granite
acoustic belfry
#

habit

#

but wait

#

in theory then it has a rigidbody then

#

letme check the og proyect

wintry quarry
#

i mean if you're doing that and there's no error, it definitely has an RB

acoustic belfry
#

i mean, it pushes the enemy back

waxen glacier
#

I'm trying to make a freelook binding, but right now I can only get it to work as a toggle instead of having to hold middle mouse to use it, how can I fix that ? I know that using freelook.perfomed makes it that way, so i'm wondering if there's a different method, because putting the Action Type as value (which I do for action where you have to hold a key) doesn't give me the option to add Middle Mouse as a binding.
https://paste.ofcode.org/BG5Z6CsxuSvdz4vmPPZV3Y

acoustic belfry
waxen glacier
wintry quarry
#

this is a property, not a field

#

it's equivalent to just writing a function:

public bool IsCurrentlyPressed() {
  return freelook.IsPressed();
}```
old coyote
#

if someone got any time to help with a basic 2D project let me know please, I've been struggling for a while (it's related to the new Input System and it's genuinely confusing)

wintry quarry
#

The inspector is really NOT a debugging tool, get used to using Debug.Log or an actual debugger for that.

waxen glacier
old coyote
#

oops, thank

cerulean badger
#

guys how do you make persistent displays (like hp bar, level text, etc) that keep working after transiting between scenes?

cerulean badger
#

should I make the whole canvas DDOL or only the specific objects with each display? If the second option, how would I make it stay inside the current canvas from the scene?

wintry quarry
#

"current canvas from the scene" doesn't really mean anything

#

you would make a canvas that is DDOL and moves between scenes

#

But it really depends on the specifics of your game

wintry quarry
#

Most games would just spawn the UI again in the new scene, based on the game data

#

It really depends on the structure and flow of the game

cerulean badger
#

i gotta remake the entire display system I've just made

#

I frickin hate this scenes system

wintry quarry
#

Can't you just turn it into a prefab?

#

or make it DDOL and put it into a bootstrap scene?

cerulean badger
#

I've done such a mumbo jumbo with events and idk

topaz chasm
#

how can ı make better colliders in 2d polygon collider cant move in record mode and box collider is so useless for some cases and hard to control multiple boxes is there a better way to do it?

surreal fox
#

I am getting confused, has anyone had this issue before?
I'm working on networked/replicated stuff. I'm spawning in an actor with BPs server side. I then attach the actor to a second parent actor server side. The reason is I want the parent actor to move around and the child to follow it. (Object on a vehicle) So far so good. Child follows parent around.
I then try to destroy the child after detatching it server side. This works on the host session but not on the client side of things. Child actor stays there. :\

The strange thing is if I don't attach the child, everything works just fine. Attaching it seems to be the cause of the failure to destroy the child.

topaz chasm
#

you can edit colliders without knowing the exact math positions

#

manually

topaz chasm
rough granite
topaz chasm
#

yes

#

it seems dont work but

#

ı dont know ıf ı do something wrong

wintry quarry
#

If this is for a sword swing attack or similar, colliders are simply not a good way to do it

topaz chasm
#

can you explain more? newbie in unity sorry

wintry quarry
#

it's often much more convenient to use direct physics queries

#

i.e. OverlapXXX or XXXCast queries

topaz chasm
#

i already built with colliders and it will hard to change i think

#

ı just wonder if ı can move multiple colliders in record mode or can ı move the polygon collider as ı wish

old coyote
#

Rotation issue help

fickle plume
#

@final trellis Don't make people debug generated code for you.

#

Lookup a tutorial and test the code yourself.

final trellis
#

less of a debug more of a "is it really doing what i asked" but fair enough

wintry quarry
#

"is it really doing what I asked" is a pretty apt description of debugging

quick fractal
#

More like an apt description of generating code as a whole..

#

The answer is usually no

stuck current
#

I need some help. I new to unity and I’m making a fishing game. I’m using a line renderer for the casting line but no matter what I do it’s behind everything.
The only case I got it working was when I changed the Z offset but then it was ahead of my player.

wintry quarry
#

(MeshRenderers? SpriteRenderers? UI Elements?)

stuck current
#

So sprite renderers

wintry quarry
stuck current
#

Alright thanks, I’m already using layers

grand snow
#

having a large long transparent thing is asking for trouble (due to how transparent objects do depth sorting)

#

but dont ask about it more here

snow jewel
#

https://paste.ofcode.org/mfqmHAVEbmUCAMthCTjDLh

I’m working on a UI upgrade system in Unity where clicking a “Buy” button should open a PreviewPanel showing details of the selected upgrade. The button click is registering (Debug.Log works), and the Show() method on my OrderedPreviewPanel script runs, but nothing visibly changes in the game view. If I manually enable the PreviewPanel in the Hierarchy during play mode, it appears fine, so the problem seems to be that my script isn’t making it show properly. I tried to use a different method named ShowRaw and assigned it to my buy button, but the panel is still not showing up. Any idea as to why it's not showing up? Chatgpt gave me some solutions but none of them worked.

rich adder
snow jewel
snow jewel
#

is it something in the actual hierarchy or somethign

rich adder
snow jewel
#

and when i press the button the panel si still disabled

snow jewel
#

the script looks fine i think

stuck current
#

I want a specific variable type but don’t remember it’s name
Basically it acts as a list but for each spot can store a few things like a variable and a game object.

toxic cove
#

how do I exit out of whatever this is?
Every time I click on something it just gives me something like this.

#

I think im gonna reinstall this version

#

I have so much errors

rich adder
toxic cove
#

TypeLoadException: Could not load type 'UnityEngine.Timeline.AnimationTrack' from assembly 'UnityEngine.Timeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
System.Reflection.MonoMethodInfo.GetMethodInfo (IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:59)
System.Reflection.MonoMethodInfo.GetAttributes (IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:75)
System.Reflection.MonoMethod.get_Attributes () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:245)
System.Reflection.MethodBase.get_IsSpecialName () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:184)
UnityEditor.Build.BuildPipelineInterfaces.InitializeBuildCallbacks (BuildCallbacks findFlags) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:191)

#

its whatever anyway im reinstalling

rich adder
#

that not sure about , is brand new project ?

toxic cove
sour fulcrum
toxic cove
sour fulcrum
#

We still can’t help

toxic cove