About message pop up and classes
Hello,
(I repost my question here because i think my previous post was in bad place)
I'm a noob in scripting and C#. I'm starting to learn about Unity's mechanisms. I managed to create some things.
I try to create something specific now and i'm quite stuck : A pop up composed of:
A predefined background image.
A second image above it.
A text placed at a specific place.
Several buttons, to leave the pop up or trigger other events.
I would like the images, the text and the button to be customizable. That is, depending on the situation, that some things are different in the pop up, but without having to recreate a new pop up from scratch each time.
I would like this pop up to be a "set". So when it moves, all his elements must move at the same time.
As I understand it, it would be necessary to create a "class" for that, but I am not sure and am not sure to understand how.
Any advices ? Thank you !
Answer by xxmariofer · Jan 31, 2019 at 11:42 AM
hello, i might be missunderstanding you, but you want one ui element pop up, with all those things inside? you can just drag all your ui elements in one empty ui elemtn, and call it pop up prefab, now you can drag and drop that gameobject inside your assets folder. so you will have a prefab of the desired object, you just need to instantiate it and you can easily modify iat runtime using getchilds and getcomponent to access colors images etc, or you can just drag and drop it again in another scene in the editor.
Your answer
Follow this Question
Related Questions
Prefabs and public variables 1 Answer
Prefabs getting deleted in all scenes! 0 Answers
Unity is not recognising MonoBehaviour,Unity not recognising MonoBehaviour 0 Answers
Prefab disapeared 0 Answers