Search Unity

Save network instantiated objects for persistence across server restarts

Discussion in 'Scripting' started by Vedrit, Feb 11, 2016.

  1. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    Hi all!
    I have a scenario where players will be instantiating objects and changing objects within the prefab, as well as values in scripts attached to various objects in the prefab, and I'm needing a way to save these instantiations and changes server-side in such a way that the hierarchy and script changes are loaded properly when the server starts and scenes are loaded.
    I've considered loading all the data to the database, but I don't know how I'd preserve hierarchy that way, so I figure a dedicated file would be the best way to go.
    I don't really know where to start on this, so any help would be appreciated!

    Just in case this is relevant: I'm using a combination of Unity Network and SmartFoxServer
     
  2. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    I read that Serialization may be the route to go, but how do I write that information to a file, and do I reverse it? Go from a file to instantiate objects for the network with the proper variables
     
  3. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    I'm also having trouble getting ScrollView to work properly. I'm trying to instantiate a prefab UI for each item in a list, but the ScrollView either doesn't scale or the insantiated elements are way out of view.
     
  4. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    I got the scrollview to work (Simple fix, now that I know), but I'm still lost when it comes to instantiated object persistence