Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

a question about with Reorderablelist in game

Discussion in 'Scripting' started by freedom667, Feb 19, 2018.

  1. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    424
    I developing spelling word game with UI extension asset. when i drag and drop an object to another section, the answerCheck string not changing. I have to change it but i could not. do you know how can we do it? everything is ok about game. only I have this problem, then it will done.



    Code (CSharp):
    1. void Update () {
    2.         answerCheck = "";
    3.         foreach (GameObject item in objects)
    4.         {
    5.             if (item.transform.childCount > 0)
    6.             {
    7.                 answerCheck += item.transform.GetComponentInChildren<Text>().text;
    8.             }
    9.         }
    10. }
     
  2. Syganek

    Syganek

    Joined:
    Sep 11, 2013
    Posts:
    85
    Where and how are you updating your objects variable?
     
  3. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    424
    there are Text components inside each objects. the variable is List as GameObject. Now when i drag and drop any object to another section, answerCheck string will be change but it does not. So I wrote to Update method that maybe it works. When it equals to correctAnswer string, questionIndex will increase 1 and new question will come to panel
     
  4. Syganek

    Syganek

    Joined:
    Sep 11, 2013
    Posts:
    85
    This does not answer my question.

    Where and how are you updating your "objects" variable in code? The one from this line:

    Code (CSharp):
    1. foreach (GameObject item in objects)
    Maybe post full script here and I'll find out myself ;)
     
  5. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    424
    I will begin conversation with you.