Advertisement

In game shop

Started by June 27, 2017 01:37 AM
12 comments, last by Lactose 7 years, 5 months ago
8 minutes ago, NeroGame said:

yes yes i create buttons and use the onclick event to call a script

 

Good. On to some more questions :)

Do you know how to dynamically make a button disabled/greyed out?

Do you know how to set a variable in script that persists/is stored as long as the game is running? (Doesn't need to be saved for now.)

Do you know how to check a variable in a different script?

Do you know how to disable/enable a specific skin? (What does a "skin" actually mean in your case? Swap texture? Swap model? Something else?)

Hello to all my stalkers.

didnt understand first and second question third question yes i know how to do that last question is one of my problemes

In my case i want to make both (texture and sometimes models change ) and i dont intend to use a buy/set button i want it done when the screen is pressed

Advertisement

To check if any point on the screen is pressed, you can either make an invisible button that covers the entire screen, or you can make a trigger area (2D box collider or similar with trigger flag set) that covers the entire screen, and check for mouse events in its attached script.

 

If you want to swap the mesh, you can for example have all the meshes as sub-objects of the character object, and store references to them in a script. Then you can enable/disable those sub-objects based on what skin should be active.

You can also use a script to find the correct mesh component (or mesh renderer component, I can't remember exactly right now), and assign a new mesh or material that way. That's probably a cleaner way, but it might be more complicated to start with.

Hello to all my stalkers.

This topic is closed to new replies.

Advertisement