W
W
Wadim_wadim20002020-05-23 19:16:26
C++ / C#
Wadim_wadim2000, 2020-05-23 19:16:26

Unity how to create a UI prefab at the click location?

Here's how to create it at the click site? Game 2d. There is a prefab - an image with a child button. It is necessary to create it in the place of the click. How to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Prizm, 2020-05-24
@Wadim_wadim2000

Not sure if it will work, but in theory it should.
1. create a prefab of the desired ui element
2. process the click and get the mouse position (google OnScreenPosition)
3. create an object, set canvas as its parent (X.transform.parent = Y.transform; )
4. save a link to this object for further manipulation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question