So I’m trying to move a chain made of links to the location they start at but I cant get it to work. I have a list of game objects at the start I make a list of transforms from the game objects in the second list. I then call a method that equals the transform of each object on the list to its transform at the start. I did some debugging and the transform positions are the same in the debug window but for some reason the objects are not moving / resetting to their original position. Thanks in advance for anyone that can help.
[SerializeField] List<GameObject> rightChainList;
[SerializeField] List<Transform> rightChainStartPosList;
private void Start()
{
foreach (GameObject chain in rightChainList)
{
rightChainStartPosList.Add(chain.transform);
}
}
private void MoveChainsToStartPosition()
{
int startPosIndex = 0;
foreach (GameObject chain in rightChainList)
{
chain.transform.localPosition = rightChainStartPosList[startPosIndex].transform.localPosition;
chain.transform.localRotation = rightChainStartPosList[startPosIndex].transform.localRotation;
chain.gameObject.SetActive(false);
startPosIndex++;
}
}