Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Feedback Unity Freezes when TryRemoveReferencePoint (AR Foundation)

Discussion in 'AR' started by Tarrag, May 29, 2019.

  1. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    Each time I racyast and touch I can create a new ARReferencePoint.

    But if I add to remove the previously added ARReferencePoint, Unity freezes indefinitely.

    I am using ARFoundation samples without changes except for XRRemoting.

    I first add ARRefPoint:
    ARRefPoint_.png
    Then I create a new RefPoint and remove the previous one: At line TryRemoveReferencePoint Unity freezes:
    debug_.png

    I also tried moving TryRemoveReferencePoint inside and outside the raycast condition and at the end of Update() with a bool but in all cases Unity freezes with no error messages on console to look into.

    Anyone has any tips or having this same issue?

    Thanks a bunch for your help !
    (Tested on Unity 2019.1.1f1, ARFoundation 1.1.0 preview.6, lwrp 5.6.1, XRRemoting 0.0.1 preview .10)



    Sample code:

    sample code using ARRemote:
    if (m_SessionOrigin.Raycast(ray, s_Hits, TrackableType.PlaneWithinPolygon))
    if (spawnedObject == null)
    {
    spawnedObject = Instantiate(m_PlacedPrefab, hitPose.position, Quaternion.identity);
    spawnedObject.transform.SetParent(m_CurrentRefPoint.transform);
    Debug.Log("Instantiated");
    }
    else
    {
    spawnedObject.transform.position = m_CurrentRefPoint.transform.position;
    spawnedObject.transform.SetParent(m_CurrentRefPoint.transform);
    Debug.Log("Current Ref Point: " + m_CurrentRefPoint + " Removing RefPoint:" + prevRefPoint);
    m_ARRefPointMgr.TryRemoveReferencePoint(prevRefPoint);
    }
    prevRefPoint = m_CurrentRefPoint;
     
    Last edited: Jun 7, 2019
unityunity