Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Serialize GameObject

Discussion in 'Scripting' started by Showoffz, Apr 25, 2016.

  1. Showoffz

    Showoffz

    Joined:
    Feb 12, 2016
    Posts:
    8
    Hello

    I have looked through numerous serialize threads and all of them want a way to serialize complex structures / whole scene states or something similar. But all I am looking is a way to same a GameObject created with OBJLoader created by AARO04130. Is there a simple way to save that GameObject into a new file so that the old .obj file is not needed anymore and later load it?

    Basically I have some default prefab models that can be used by the user. But I want to add a way that a user can load new models. Right now when user creates a room with different models all the models are saved into string[]

    (Original name:{0};"+"name:{1};position:{2};rotation:{3};color:{4};scale:{5};TAG:{6}")

    And later loaded with

    tempObj =(GameObject)Resources.Load(pathResource + orgName);

    But is there a way to get that GameObject that was loaded from a OBJ and make it so that i can save it's info the same way I do with prefabs? Or do I have to create a new save and load script for them?