I suppose it can have very simple solution but I could not find .
I have prefab. I spawn two instance of it inb the scene.
They have hotspot and can be picked into inventory and ofcourse would be removed from the scene.
But when i use Remember transform Only one apears to be in its place and the other one is forgotten.
I was trying to uncheck |Remember Transform but it seems impossible so i thought my logic and understanding is wrong.
sorry for too much of questions.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I must add that i do not add the Prefab by using AC add in action list . since i wanted to spawn my prefab object using an animation event, i took advantage of a simple script and i can assume my code can not sync with AC Constant IDs as it should! this is the code i use:
`using UnityEngine;
public class BallDropController : MonoBehavi0ur
{
public GameObject ballPrefab; // prefab to instantiate
public Transform dropPoint1; // The first drop point
public Transform dropPoint2; // The second drop point
}
`
If you're instantiating an object through script, call its RememberTransform's OnSpawn function afterwards.
Thanks Here is what i came up with.
first of all
I did not spawned prefab through AC workflow since i could not find a way to trigger them being spawned by animation event( I also added a cutscene component and used enimation event Run action or Process Action but could not get the resul.I wanted to spawn the balls at a specific frame of an animated hose.
Inspector description:
On the Ball prefab:
Constant ID Retain Prefab is unchecked.
Remember Hotspot(since each ball has a Hotspot Child in prefab which works with Set Interaction Parameters: "Reference scene instance" forRemo0ve.
Remember Transform: Global ,
Save scene presence: checked
Retain in Prefab is Locked/checked.
inside scene and to have method for animation event i have this
`using UnityEngine;
using AC;
public class BallDropController : MonoBehaviour
{
public GameObject ballPrefab; // The ball prefab to instantiate
public Transform dropPoint1; // The first drop point for the ball
public Transform dropPoint2; // The second drop point for the ball
}
`
as you see to register the object with Adventure Creator i used rememberTransform.OnSpawn(); and hopefuly assigned a new ID to newly spawned. but then i can not unlock the Remember transform in the Inspector. so it seems only one transform is rememberd the one with the original prefab or the first constant id which probably matches with it?!!!
so still i get only one of the balls in the scene if i switch scene before i pick them.
I can also get around just cheat in a smipler way but i thought maybe i can just do it in a more clean way.
RememberTransform derives from ConstantID - don't add/modify it beyond that.