Forum rules - please read before posting.

[Feature Request] RememberTransform remember object instances.

Hello! sorry to bother again. 

I am using the RememberTransform for my VR pickups (with the "Save Scene presence" on), but had some issues. When held, the items are parented to a persistent object (which also carries the hand models), so if you switch scenes the system remembers the last place the object was at (while held), so when you return, a duplicate item appears there on the floor. It also records the scale while the object is parented, so it returns an incorrect scale (picture a plate of food big enough to cover a cave's entrance, lol). The option "remember parent" didn't seem to help. But, I got it to work by telling my Pickup scripts to add or remove the RememberTranform script depending on whether the item is held or not (thus preventing any saving from occurring when switching scenes if an object is still held). That makes it work perfectly (the base prefab does need to have the RememberTransform script already there for some reason). 

But, one issue remains... I have a few consumable items which can have multiple instances (matchsticks and oilcans to refuel/turn on a torch). If you leave a scene, and you've dropped several of these in the scene, once you return, only the very first item reappears. I tried to force the pickup script to give a new constantID to the item's constantId scripts but I guess the issue lies in the loading/spawning of the items.  

Would it be possible to have the RememberTransform script mark duplicates as "instances", which can then simply be instantiated from the same original prefab path? There could be a "CanHaveInstances" toggle in the RememberTransform script to allow this behaviour. Or, is there anything I can add or modify, in the meantime, to allow this? Or is there some other way to do this I'm not aware of?

Anyway, any advice will be greatly appreciated.

Comments

  • I don't recommend adding Remember components at runtime: it'll mean that they assign new ID numbers each time, and can also cause confusion when loading scene data that doesn't exist.

    It may be that a custom Remember script is necessary, so that a separate "isBeingHeld" boolean can be saved and affect the item accordingly when loaded.

    Custom Remember scripts can normally be added by simply creating a new subclass of "Remember", but the RememberTransform is different because AC needs to do some "internal" work to bring back such components that no longer exist in the scene.

    The Remember system also has a prerequisite that each object in the scene has a unique ID - which AC makes use of when deciding if an object needs bringing back or not.  Essentially, it'll search the scene for an object with the same ID, and only spawn a new one if no such object is found.

    Changing this prerequisite would have knock-on problems with other Remember components that may be attached.  I'll have to delve in and see how feasible allowing for this behaviour can be.
  • Please do. I guess it currently works for me because when I add a new remember script I make sure to assign the constant ID (and since all my items already have a constant ID script I just take it from there). My first thought WAS to make a custom remember script but I quickly noticed AC does the instantiation separately (searching for all RememberTransforms), so making a custom one was out of the question (I would basically have to redo the serialization and instantiation anyway). For now I'll keep it like this, it seems to work fine for some reason, if need be I can create a custom way to remember scene presence, but I was hoping to just use the native RememberTransform since it works so well already.

    Cheers!
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.
Do NOT follow this link or you will be banned from the site!