playMaker

Author Topic: Playerprefs Get\Set Gameobject  (Read 2860 times)

Rhyuzaky

  • Playmaker Newbie
  • *
  • Posts: 32
Playerprefs Get\Set Gameobject
« on: September 13, 2015, 10:55:13 AM »
I need a playerprefs, or something to save a GameObject as prefab or the way the playerprefs does, will be that it is possible to do this?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Playerprefs Get\Set Gameobject
« Reply #1 on: September 13, 2015, 11:30:26 AM »
Playerprefs can only save basic variable data like float, int, bool, etc... For custom structures like GameObject's you need a serializing solution. (Someone correct me if there is a way to serialize GameObjects into playerprefs, i ended up doing it manually as an xml file)

I believe this is what Easy Save does, as well as other similar tools. I haven't used Easy Save myself, but from what I hear it seems to solve people's basic data saving issues altogether.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Rhyuzaky

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Playerprefs Get\Set Gameobject
« Reply #2 on: September 24, 2015, 07:32:54 AM »
Is there any way to save it as a prefab or variable without the use of assets?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Playerprefs Get\Set Gameobject
« Reply #3 on: September 24, 2015, 07:50:55 AM »
I don't think so. Serializing can get messy so typically it's favored as a separate script to handle all of the complexities, then communicate with it via actions that are much simpler.

There's already a lot of different tools available for this task, so its best to take advantage of them when possible.

Or do you mean something else? Serializing it into a file is only necessary if you want it to survive changes between game sessions, but isnt needed if have a prefab that should be the same every time the game loads.
« Last Edit: September 24, 2015, 07:54:12 AM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Rhyuzaky

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Playerprefs Get\Set Gameobject
« Reply #4 on: September 24, 2015, 04:39:43 PM »
In this case, there is any way to save it as prefab to when changing scene, or restart the game and load the save, the object continues her?