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
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?
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.
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.
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.