#Drag & Drop

1 messages · Page 1 of 1 (latest)

flint terrace
left stone
#

Smart

granite wyvern
#

after you click and it disappears, can you double click on it in the hierarchy and see what its values for its position are

brazen galleon
#

When in game

granite wyvern
#

i think the issue is with it being in world space

#

the tutorial you're following is supposed to be for a normal canvas

brazen galleon
#

@last haven what's ClickManager? Is it the canvas?

last haven
#

oh

#

yes its the canvas

brazen galleon
#

take a screenshot of it

last haven
granite wyvern
#

try with camera space or overlay

last haven
#

i guess i make a new canvas for that

#

cause the click manager worked pretty good set up like that

#

no harm right?

granite wyvern
#

yes just right click -> UI -> Canvas

#

don't set it to world space and put the same script and give it the same children

#

this is the set up of the canvas for the tutorial

#

the one you're following

last haven
flint terrace
last haven
#

but now on that canvas it doesnt do anything at all

flint terrace
#

What's the object you're clicking on look like?

flint terrace
#

What's Task Button?

last haven
#

yea that the sprite i just realized was unnecessary

#

now it looks like this BUT when i remove the sprite

flint terrace
#

Does it work now it's set up like this?

last haven
#

ah now its a sorting problem

#

wait

flint terrace
#

That width and height seems really really small but I'm unsure whether that'd affect anything

last haven
#

they are invisible when not in pause but they do show up and in the right spot

brazen galleon
last haven
#

yea its sorting order im now looking up how to change that. I only know how to do it with sprites there is just a "sorting order" option

flint terrace
#

the canvas has a setting

last haven
brazen galleon
flint terrace
#

Your camera may be hiding the UI layer?

last haven
last haven
brazen galleon
last haven
#

the camera is -10

flint terrace
#

They should all have z as 0

flint terrace
#

Can you check your camera isn't excluding the UI layer from rendering

#

Also, that's world space, not UI space

#

so that actually seems wrong

last haven
brazen galleon
#

Also this:

flint terrace
#

if the canvas is ScreenSpace Overlay and you're drawing stuff at ~(-400, -250) That is not going to be on the screen

brazen galleon
#

I imagine 1-1.5 pixels won't show very well

last haven
brazen galleon
#

At least if you are using screen space canvas

last haven
#

wtf

brazen galleon
#

I think I'm gonna stop here. Because it feels like it's going no where. Do your learning of the ui system, follow the tutorial exactly as it is and make sure it works. Only then attempt making changes.

last haven
#

I am not trying to make changes

brazen galleon
#

Yeah. You're trying to use some steps from the tutorial in a different context. That's even worse. At least if you're not understanding what you're doing.

last haven
#

I mean u are saying its pixels and i am sure u know what you are talking about but it did show up properly before with width 2 and height 1

#

i could see it and click t

#

it

#

the drag&drop behaved weirdly but it was not 2x1 pixels

#

and now you are acting like I am crazy to expect to see a 2x1 pixel image when it showed up perfect before

#

and no alternative

brazen galleon
last haven
#

i can make it bigger i tried

#

it did not show it just was huge

#

yes

#

it is huge in the scene but does not show in game either

brazen galleon
#

Well, then reread my message again. I said it's in pixels with what canvas?

brazen galleon
last haven
#

placed it directly in the scene

#

oh

brazen galleon
last haven
#

ok

#

now wiht 0 0 0
and 200x100 it shows

#

alright

#

still got issues but this is the first progress in 4 hours 😅
oh btw thanks alot for all of your time I am very grateful

#

ok drag&drop works which is nice but it always spawns at the bottom left
never out of screen or somewhere else

#

always the pivot at the outermost bottom left corner

brazen galleon
last haven
#

GameObject result = Instantiate(mathTask, rbody.position, Quaternion.identity);
so in here instead of the value of the rigidbody position is my guess

last haven
#

@flint terrace is that what the screen space camera is?

flint terrace
#

Screen space is that the positions are in screen coordinates

last haven
flint terrace
#

Yes

last haven
flint terrace
#

If you don't move something in screen coordinates, yes, it stays still on the screen

last haven
#

damnit

#

of course I dont want that

#

so all this trying to get "screen space" to work

#

was just a waste

#

I want it to be in the world

#

damn

brazen galleon
#

You can still make it stay in the same world position if you move it in script.🤷‍♂️

last haven
#

it feels like that object shouldnt be on a screen space canvas

brazen galleon
brazen galleon
#

It should've been a sprite renderer + collider in the first place. I've no clue why you decided to get involved with canvases

last haven
brazen galleon
#

There's a world space TMP component afaik

#

Might be mistaken...🤔

last haven
brazen galleon
#

Yes. In case I'm wrong, you might still need a canvas for tmp and will need to sync it's position with the sprite in world space.

flint terrace
#

The generic Text Mesh Pro text doesn't need a canvas and is just a mesh in world-space

brazen galleon
#

Ah, so there is one

flint terrace
#

If you're looking to switch this to world space you'd want to look for examples with 2D physics that have drag and drop behaviours

#

I'm sure Melv has one

brazen galleon