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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Loading Text - XML or something else?

Discussion in 'Scripting' started by RussellT, May 4, 2015.

  1. RussellT

    RussellT

    Joined:
    Feb 1, 2015
    Posts:
    18
    Hello All,

    Just trying to work out what the best way to load some text in is.

    I am going to be having about 150 Objects in my scene and each one when clicked on will need to display some text in a UI text.
    I know how to load a text file in, But should I be using XML? Or is that overkill for this?

    Thanks,
    Rusty
     
  2. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    Depends, XML or JSON can hold more structured information but if it is just a bunch of strings you need to extract from the text file you could just use plain text and use either lines or a seperation character like a , to split it into multiple strings.
     
  3. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    If the relationship between the object and the text is 1:1 is there any reason you can't just write the text in the Inspector of the text element for each object?
     
  4. RussellT

    RussellT

    Joined:
    Feb 1, 2015
    Posts:
    18
    Passerbycmc - I think the plain text option would work well, I was concerned before about the idea of having to specify an amount of lines for each object from the file. But If I can just break it with something that sounds great!

    KelsoMRK - I should have added before that I only want to have one Textbox that when items are selected displays information from a file.

    Cheers,
    Rusty