• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by YanCanCook · Oct 01, 2015 at 12:04 PM · c#unity 52dbutton

Creating dynamically moving buttons/GUI objects.

Hello, I am creating a hybrid quiz/RPG-ish game. I have most of the game basics done and the problem that I am facing is that i am unable to randomize the options for my game. The options are pulled from an SQL database and are projected onto the text of a button.

The buttons are then coded so that the character either does damage or gets damaged. The issue is that the right answer is always on the bottom as that is the button that displays the right answer. I am wondering if it's possible to randomize button positions with the anchors so that the answer isn't always at the bottom.

Here's a screenshot if it provides any clarity SCREEN

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by KwahuNashoba · Oct 01, 2015 at 02:28 PM

I would say that there is no need for hardcoding bottom-most button to be the one that will trigger function to handle right answer. You can randomise answers and then on click check if text on the button is same as correct answer text. You can then handle demage based on the output. This way each button will have universal behaviour.

I mean, you can move UI elements just like you move 3D objects except you'll have to use Rect transform instead, but IMHO this is more painfull way to do this.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Having a couple of problems regarding 2D Movement. 1 Answer

Unity jump from one canvas scene to another scene with canvas 2 Answers

Disable load new level until all enemies are dead 2 Answers

Someone please help me with combination lock 0 Answers

I'm working with the corgi-engine/inventory engine and need help with a script. 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges