Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 hyeqt100 · Jul 26, 2018 at 08:06 PM · memorydictionaryhow tomatching

Selecting between user-made levels

In my game, which is a variation of flashcards, the player can create their own flashcard sets and name them. To create the terms, I have an input field for the subject name and then two columns of input fields for the actual terms. I was thinking of creating different dictionaries for each subject the player makes (there can be up to 9 subjects/card sets), but how can I do this with the same input fields? Or I guess I should say...how can I save the terms and definitions with their respective subject name so that different subjects can be selected to play a new game? Here's what I have so far...sorry if this is really messy. BTW, the modal panel is a popup message that tells the user to delete a set since the maximum number of sets that can be stored is 9.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class CreateSet : MonoBehaviour
 {
     public GameObject Subject1;
     public GameObject Subject2;
     public GameObject Subject3;
     public GameObject Subject4;
     public GameObject Subject5;
     public GameObject Subject6;
     public GameObject Subject7;
     public GameObject Subject8;
     public GameObject Subject9;
 
     public Text subject1;
     public Text subject2;
     public Text subject3;
     public Text subject4;
     public Text subject5;
     public Text subject6;
     public Text subject7;
     public Text subject8;
     public Text subject9;
 
     public InputField subjectName;
     public static Button ContinueButton;
     public GameObject modalPanel;
 
     public InputField term1;
     public InputField term2;
     public InputField term3;
     public InputField term4;
     public InputField term5;
     public InputField term6;
     public InputField term7;
     public InputField term8;
     public InputField term9;
     public InputField term10;
     public InputField term11;
     public InputField term12;
     public InputField term13;
     public InputField term14;
     public InputField term15;
 
     public InputField def1;
     public InputField def2;
     public InputField def3;
     public InputField def4;
     public InputField def5;
     public InputField def6;
     public InputField def7;
     public InputField def8;
     public InputField def9;
     public InputField def10;
     public InputField def11;
     public InputField def12;
     public InputField def13;
     public InputField def14;
     public InputField def15;
 
 
     public void SetName()
     {
         subject1.text = "1. " + subjectName.text;
         if (subject1.text != null)
         {
             subject2.text = "2. " + subjectName.text;
             if (subject2.text != null)
             {
                 subject3.text = "3. " + subjectName.text;
                 if (subject3.text != null)
                 {
                     subject4.text = "4. " + subjectName.text;
                     if (subject4.text != null)
                     {
                         subject5.text = "5. " + subjectName.text;
                         if (subject5.text != null)
                         {
                             subject6.text = "6. " + subjectName.text;
                             if (subject6.text != null)
                             {
                                 subject7.text = "7. " + subjectName.text;
                                 if (subject7.text != null)
                                 {
                                     subject8.text = "8. " + subjectName.text;
                                     if (subject8.text != null)
                                     {
                                         subject9.text = "9. " + subjectName.text;
                                         if (subject9.text != null)
                                         {
                                             modalPanel.SetActive(true);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 
     public Dictionary<string, string> termsDefs;
 
     private void Start ()
     {
         termsDefs = new Dictionary<string, string>();
 
         termsDefs.Add(term1.text, def1.text);
         termsDefs.Add(term2.text, def2.text);
         termsDefs.Add(term3.text, def3.text);
         termsDefs.Add(term4.text, def4.text);
         termsDefs.Add(term5.text, def5.text);
         termsDefs.Add(term6.text, def6.text);
         termsDefs.Add(term7.text, def7.text);
         termsDefs.Add(term8.text, def8.text);
         termsDefs.Add(term9.text, def9.text);
         termsDefs.Add(term10.text, def10.text);
         termsDefs.Add(term11.text, def11.text);
         termsDefs.Add(term12.text, def12.text);
         termsDefs.Add(term13.text, def13.text);
         termsDefs.Add(term14.text, def14.text);
         termsDefs.Add(term15.text, def15.text);
    
 
 
     }
 }
 
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

0 Replies

· Add your reply
  • Sort: 

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.

Follow this Question

Answers Answers and Comments

152 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Optimise scene when making an "Angry Bird" like game 1 Answer

Application Error after baking lightmaps 0 Answers

Editor Input.PreUpdate absurd lag 0 Answers

NullReferenceException being thrown when I try to add a component to a dictionary 0 Answers

How to create a turn based system manager? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges