ARCore positioning Objects and setting rotation

Hey everyone, for an Android application I want to implement AR Image Detection and if the image is detected I need STABLE positioning and rotation. Right now its super buggy.
I have on my prefabs anchors and in my scene the anchor manager. When the image gets detected the prefab is there but everytime with a different rotation.

Here is my code:

private void Awake()
    {
        _arTrackedImageManager = GetComponent<ARTrackedImageManager>();
        foreach (GameObject arObject in arObjectsToPlace)
        {

            GameObject newARObject = Instantiate(arObject, Vector3.zero, Quaternion.identity);
               newARObject.name = arObject.name;
            newARObject.SetActive(false);
  
            spawnedARObjects.Add(newARObject.name, newARObject);

        }
    }

    private void Start()
    {
        animated = false;
        UpdateFlowStateBtn.SetActive(false);
    }

    public void OnEnable()
    {
        //subscribe to event of image detected
        _arTrackedImageManager.trackedImagesChanged += OnImageChanged;
    }

    public void OnDisable()
    {
        _arTrackedImageManager.trackedImagesChanged -= OnImageChanged;
    }


    public void OnImageChanged(ARTrackedImagesChangedEventArgs eventArgs)
    {

        foreach (ARTrackedImage trackedImage in eventArgs.added)
        {

            UpdateARImage(trackedImage);
        }

        foreach (ARTrackedImage trackedImage in eventArgs.updated)
        {
            UpdateARImage(trackedImage);
        }

        foreach (ARTrackedImage trackedImage in eventArgs.removed)
        {
            spawnedARObjects[trackedImage.name].SetActive(false);
        }

    }

    private void UpdateARImage(ARTrackedImage trackedImage)
    {
        AssignGameObject(trackedImage.referenceImage.name, trackedImage.transform.localPosition, trackedImage.transform.rotation);
    }



    private void AssignGameObject(string name, Vector3 newPosition, Quaternion rotationImage)
    {


        if (arObjectsToPlace != null)
        {

          

            spawnedARObjects[name].transform.position = newPosition;

            spawnedARObjects[name].transform.rotation = rotationImage;
           

            if (!spawnedARObjects[name].activeSelf) spawnedARObjects[name].SetActive(true);
            if (!animated)
            {
            
                StartCoroutine(AnimationARObject(spawnedARObjects[name]));
            }
        }



    }


    private IEnumerator AnimationARObject(GameObject AROb)
    {
        yield return new WaitForSeconds(0.1f);

        if (AROb.name == "ARFahndungsFoto")
        {
            AROb.LeanScale(scaleFactor * .8f, 2f).setEaseOutCubic().setOnComplete(ShowBtnUpdateFlow);
            //AROb.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
        }
        else if (AROb.name == "ARZelt")
        {
            AROb.LeanScale(Vector3.one * .8f, 2f).setEaseOutCubic().setOnComplete(ShowARZeltUI);

        }

        else if (AROb.name == "ARTonband")
        {
            AROb.LeanScale(scaleFactor, 2f).setEaseOutCubic().setOnComplete(ShowARTonBand);
        }
        animated = true;
    }

Thanks in advance. Appreciate it

Repeating my reply to your post from the other thread :

One thing to note that has come up a few times on the forums: Your lighting conditions matter greatly for any kind of tracking, especially on ARCore. Android devices currently don’t have access to LIDAR like ARKit tracking does. So make sure the area you are working / testing in is well-lit or the images may have trouble being tracked/recognized.

You may also want to look at using the arcoreimg to validate how recognizable your images are.

A good reference for the ARCore image tracking specific quirks is the ARCore Augmented Images docs.

Also, looking at your script, you’re assigning the localPosition/localRotation to the position field of your UI object.

Instead try parenting your UI objects to the spawned trackable and manipulate your UI object’s local transform values instead.

Hey can you evaluate that a bit more please, what do you mean with parenting it to the spawned trackable? How would I do that?