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

Saving a player made object.

Discussion in 'Scripting' started by mumbot, May 23, 2016.

  1. mumbot

    mumbot

    Joined:
    Oct 19, 2012
    Posts:
    86
    Hey all iv started working on a personal project where the player is able to place blocks together. At the moment i have some blocks that allow you to move your creation and others that are just for visual looks. Now i know how to save and load these player made objects by giving that block an ID and saving the Vector and Quaternion of each block how ever some when a block is placed it becomes a child object of the block you last clicked. I need to know how i can also keep the blocks with the same parent after it loads. Otherwise blocks that allow you to rotate other blocks do not work correctly.
     
  2. Errorsatz

    Errorsatz

    Joined:
    Aug 8, 2012
    Posts:
    555
    Since the blocks have an id, add a parent field with the id of the parent block (if any) when saving them?
     
  3. mumbot

    mumbot

    Joined:
    Oct 19, 2012
    Posts:
    86
    Yeah hahaha. I was thinking that just after making the topic. I guess i got a little a head of my self when i made the topic. But thats exactly what iv done and all seems to work fine now.