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
  4. Dismiss Notice

Populate Scriptable Objects with PHP Data

Discussion in 'General Discussion' started by jae026, Aug 31, 2020.

  1. jae026

    jae026

    Joined:
    Oct 29, 2016
    Posts:
    57
    Afternoon, I was just wondering if anyone has had any experience using scriptable objects to hold php data. I want to have a controller pull the data and populate the fields in the scriptable object and any object holding that object would have it's data populated using what is in the SO.
     
  2. James-ARX

    James-ARX

    Joined:
    Aug 31, 2020
    Posts:
    2
    Interested
     
  3. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
  4. billykater

    billykater

    Joined:
    Mar 12, 2011
    Posts:
    327
    I would suggest to return json formatted data from your server.

    After you downloaded the data using WWWForm/UnityWebRequest or the old WWW (if you absolutely must) you can just use JsonUtility.FromJsonOverwrite to automatically populate any data unity can serialize without writing any further code.
     
    James-ARX likes this.
  5. James-ARX

    James-ARX

    Joined:
    Aug 31, 2020
    Posts:
    2
    Thatnks, I did not know that. I am still fairly new to working with server side data.