#Aligning Sprite to a Template Sprite
1 messages Β· Page 1 of 1 (latest)
you should just be able to use a grid layout if you have the measurements
though i feel like it'd be easier to simply add the buttons fully in-engine rather than aligning them onto a template
it's not a UI object thou
oh huh?
it does look like ui yeah
yeah I guess I need to change my approach π€
I am not sure what those mean but I would assume world space π
it's definitley not in a Canvas
is it an in-world object or is it an overlay on the screen?
it's an in-world object
I did not π
I think I should change it to a Screenspace object
instead of a world space
I have everything coded out, I just need to play around with game objects right?
what is it supposed to be?
well, u click the buttons at the correct order to complete the task
and the right top button will light up
hm
you might wanna make it a world space canvas then
can you show how it looks in the game?
what do you want to see?
I am changing it to Canvas yes
i mean it's just an object positioned somewhere in the game world right, not a popup menu or something? if so you'd wanna use a world space canvas instead of screen space
though you could also just use normal non-ui game objects
uhh yeah, it's not, when u start the game, you will see this immediately
it's a simple game for a game jam π
now my Canvas is smaller than my object π€
then you probably wanna make it a screen space canvas
alright lemme change that
a screen space canvas is positioned on the screen directly, irrespective or where the camera is
Screen space overlay or scren space camera?
while a world space one is positioned in the game world and moves with the camera
there's another one called World Space Canvas
overlay
these left right up and down are offsets, you can change them
you can also press on the stretch icon and select center, then change the position and size
Hmmm, odd it didn't move
yeah, they keep the position nad size when you change them
you need to change the numbers
Hmm lemme look up some tutorial to refresh my memory on how to do this π
I remember there's a green anchor stuff
ok so I figured out how to stretch an empty game object to the canvas
now I want to stretch the Image and keep the ratio, how do I do that?
you can turn on preserve aspect on the image component
awesomeee
So I know my measurements, but they are in pixel π€
how do I convert it to the right size?
you can press set native size on the image
it's in a grid layout though, when I press that, nothing happens
do I need to wrap it in another game object?
on the panel i meant
tho i think you might just have to screw around until it looks about right
I think so too π€
the buttons right?
no the template one
does changing my PPU helps?
you can do that yeah
to 1?
actually i don't think it'll do much? it might change what it looks like when you press set native size
it becomes extremely big if I set it to 1 π
yeah, ppu is pixels per unit, so now 1 pixel in your image is 1 unit in the game
(and i think your canvas's reference pixels per unit is set to 100 by default)
so if I want to use my measurements that I measure from Aseprite
I should have my PPU as 1 right?
you'd want it the same as what you have set as your canvas's reference pixels per unit, which is by default 100
usually all that matters is you keep it the same for all sprites
hm, what are the settings on it?
but I kinda wanna control the size of each horizontal column though, the width
separately?
ticking the height solves the problem
you probably also wanna tick width
OMG I DID IIIITTTTT
but that means I cannot make one box smaller than the other right?
I want to do something like this
i think you can, you just need to give it a layout element component
which is?
you probably wanna change preferred width and height
or if it's too big you can turn off force expand children
but yeah ugui layout is a bit annoying sometimes (often)
is there a way to use my aseprite pixel units π
cause if I set it to 1 PPU, I can multiply every pixel to 100
i don't think so?
also, you should probably select "scale with screen size" on the canvas scaler component
understandable 
that's what i usually do haha
I'll think about it after dinner thank you so much :D