Search Unity

Attaching JSON file to Game Object

Discussion in 'Scripting' started by IntelligentDesign, Sep 2, 2014.

  1. IntelligentDesign

    IntelligentDesign

    Joined:
    Jun 13, 2014
    Posts:
    51
    Hey all, I'm working on recreating an archaeological site in 3D for a museum exhibit and was wondering if there's any way to attach a JSON file as a component to a game object. My idea is that when a user clicks on an object a GUI panel should come up which will display information on the artifact (ie material, year uncovered, etc.) that is stored in a JSON file.

    I should note that the format doesn't have to be JSON, it's just that I happen to prefer a human readable format since most of the academics who will make edits to the scene in the future don't have a ton of programming experience.

    Thanks!
     
  2. fryedrycestyle

    fryedrycestyle

    Joined:
    Jun 8, 2012
    Posts:
    19
    I know there are a few scripts for parsing JSON files on Unify, have you tried any of those? For that matter, is that what you're looking for? A way to read in a JSON script on an object and use it in some way?

    Here's a link to one of the JSON scripts I'm talking about:
    http://wiki.unity3d.com/index.php/SimpleJSON
     
  3. IntelligentDesign

    IntelligentDesign

    Joined:
    Jun 13, 2014
    Posts:
    51
    Essentially, yes. I'd like to attach a JSON file to an object the same way you'd attach a script,then when the user clicks on the object parse the JSON file to produce a GUI label, textarea, etc with the relevant information.
     
  4. IntelligentDesign

    IntelligentDesign

    Joined:
    Jun 13, 2014
    Posts:
    51
    Just bumping
     
  5. ganiyusikiru

    ganiyusikiru

    Joined:
    Jan 12, 2020
    Posts:
    5
    Didi the suggested solution worked for you, IntelligentDesign? I need to do a similar thing now.
     
  6. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    I'd suggest making a new post with more details about your use case. You'll get more helpful responses (that are more relevant in 2020), and IntelligentDesign is unlikely to check the forums anytime soon to respond....