Forum rules - please read before posting.

Save object (remove/delete) state issue

I'm struggling with saving the state of an removed object. I have an object, picked it up - remove hotspot, add to inventory and remove object, everything works fine.

Now i will save the state. Inventory will be saved automatically, add rememberHotspot-script to the hotspot. Which remember script do i have to add to the object i want to remove?

I tried rememberVisability (but i guess this is not right, cause i destroy the object) - a constant Id is given, i see also the disk-icon on the object. Do i have to put the prefab of every object i want to remove/delete in the asset/resources/ folder? - I did that also, same result.

What i do wrong?

PS: I can make the object invisible but if the object has a collieder (e.g. a book on a table)  i can not reach the underlying hotspot (table) at the position the book was, the collieder seems to stay.

Comments

  • Hm for me this seems to be a bug. Cause when i remove the book and then load an old saveGames, the book is not there. Only when i start the scene new.. Does that mean once an object is removed it's not longer available, even if i load an other saveGame? This can not be right.
  • This should be in Technical Q&A.  It's not a bug - you need to add the RememberTransform script.  Check Save scene presence?, Retain in prefab?, and also make the object a prefab placed in a Resources asset folder.  This is in the manual under section 9.2.
  • Ok, thx!  i didn't find out to attach the rememberTransform script to it. - What about making the object invisible, which makes it a lot easier to handle. The collieder of the object seems to stay, is that correct, cause it is attached to the object?

  • What do you mean?  Is it a child object?
  • I think by Setting the object invisible, it will not effect the collieder attached to the object right? The problem here is, if i set the object invisible (by grabbing it into the inventory) the collieder will still exists. So my underyling hotspot will not work for that spot. Is there a solution for that or do i have to remove/destroy those objects for such cases?
  • You could either remove them from the scene, or simply move it far out of the way.  You can use the Object: Transform Action to move an object by a relative amount (e.g. downwards by 1000 units).  By attaching the RememberTransform script to it, you'd be able to record it's position.
  • There must be more to that console error - have you opened up the Console window to get the full error message?

    NPCs are assumed to only have one "main" sprite, which will play back up/down etc animations based on the direction parameter - not to enable/disable child sprites.  Now while your method may work in-game, bear in mind that the save system requires you to do things the recommended way for it to work.

    While the 2D Demo makes use of Sprites Unity rather than Sprites Unity Complex, the player prefab still demonstrates the recommended way to animate a character moving in multiple directions.
  • I don't understand what you're asking - how to set up your character properly, or how to save this one?

    If you're looking to save this character, I would recommend writing a custom RememberScript that saves / loads which rig should be showing.  A tutorial on this can be found here.
  • edited May 2015
    The "standard" way to set up a character with Sprites Unity Complex is
    covered in the manual's section 3.9, and doesn't involve swapping out
    the visibility of individual rigs for each direction.

    If that's
    what you're doing, though, you may not need any new Remember scripts -
    you could try instead writing a script that reads off the Mecanim
    controller's "Direction" integer, and handles the visibility of all rigs
    at once, within an Update function.  The RememberNPC script alone will
    handle the saving of the NPC's facing direction - and the Update
    function should be able to make sure loading a game causes the correct
    rig shows without the need for a custom Remember script.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.