#Arrow selection menu

1 messages · Page 1 of 1 (latest)

rose escarp
#

ok so i have arrows designed in photoshop already

#

where in the heirarchy and as what should i put them into the scene

fierce abyss
#

I don't think the position in the hierarchy will matter too much. They shouldn't be affected by a layout group, though.

#

placed after everything else so that they render on top

#

you'd compute the positions by halving the width of the target, then adding a fixed amount of space

#

to do the transition effect, you'd put a component on the images that lets them quickly fade in and out

#

probably just by scaling and adjusting opacity

#

i can't really tell; the animation is very fast

#

so you'd instantiate two new ones and destroy the two old ones once they fade out

#

alternatively, fade the two images out, then move them and fade them in

rose escarp
#

ok i am somewhat lost,

#

this is the arrow design i saved in photoshop

#

its in my assets folder

#

do i drag them in?

fierce abyss
#

well, yes, you need to create an object with an Image component on it

#

i forget what dragging a texture into the scene does

#

note that you shouldn't have both arrows in the same asset -- that means you can't adjust the spacing between them

#

just do one image and rotate/mirror one of the two arrows

rose escarp
#

Right got it i can do that in unity directly right?

#

so its ok if i just erase one

fierce abyss
#

You can't edit images in Unity. You can edit sprites, but that's mostly setting their size and stuff

rose escarp
#

can you mirror it in unity?

fierce abyss
#

you would do that on the arrow object itself

#

just rotating it 180 degrees would be fine

rose escarp
#

yep got it so i just erase one

fierce abyss
#

and then make sure that the resulting image has the arrow centered

#

that will make it easier to position

rose escarp
#

ok done

#

@fierce abyss so do i create a game object

fierce abyss
#

well, yes, you need something to actually render the arrows!

#

you can add an empty object and then add an Image component

#

set it to use the arrow sprite and parent it to the canvas

#

(I think you'll need to change the type of the image asset from Texture to Sprite)

rose escarp
fierce abyss
#

Create Empty, then attach an Image component.

#

or UI -> Image

rose escarp
#

k

fierce abyss
#

have you not done much UI work before?

#

you sound very unfamiliar with it

rose escarp
#

no I was mainly the one who did the art

#

not the assembling of it

#

so i am unfamiliar

#

i will admit it is one of the main things i need to work on

rose escarp
fierce abyss
#

the Image component has a field for the sprite called Source Image

#

select the asset created from the photoshop file and make sure you've set the Texture Type to "Sprite (2D and UI)"

#

then apply in the bottom right corner

#

that will change how the PSD is imported, so that it gives you a sprite

#

then you can assign that to the Image component

#

you can drag it in directly, or click the little circle on the right side of the Source Image field and then search by name

rose escarp
#

right i see

rose escarp
fierce abyss
#

it's not showing up where?

fierce abyss
#

so you selected the arrow asset and changed the Texture Type

#

and applied that

rose escarp
fierce abyss
#

okay, so if you search for "Arrow" when selecting an asset to use in the Source Image field, that image should come up

rose escarp
#

it dosent

fierce abyss
#

oh, I see

#

it's called Layer 1

#

the square with the big dot in the center is the sprite

#

I guess the PSD importer looks at layer names?

rose escarp
#

found it

rose escarp
#

ok i got it

fierce abyss
#

also, you should crop the arrow better

#

it's got a bunch of blank space to the side

rose escarp
#

yep i see it,

#

ok done

fierce abyss
#

to actually position the arrows, you'll need to respond to the player either selecting (if using a controller) or hovering (if using a mouse) the button

#

i'm still figuring out the best way to do that myself, since i've had problems with mouse and controller inputs fighting (especially on my Steam Deck)

#

it'll take some scripting

#

i'm actually not sure what the easiest way to do that will be

rose escarp
#

right. i guess i should look around for some scripts i can personalize for this?

#

thank you!

fierce abyss
#

I'd start by making a component with a method that moves the arrow to its position

#

and then use an Event Trigger component to run that method when you mouse over the button