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. Dismiss Notice

Question Hide/Show 3D objects loaded using Addressables

Discussion in 'Addressables' started by Ar_begginer, Apr 23, 2021.

  1. Ar_begginer

    Ar_begginer

    Joined:
    Feb 7, 2021
    Posts:
    3
    I'm using Addressables to load objects into my AR app. But now I want to have option to use toggle to select which child of object is going to be shown or hidden. I know there is option to do this when objects are already in hierarchy but is it possible to do this when it's loaded from cloud?

    Code (CSharp):
    1. protected override void OnEndManipulation(TapGesture gesture)
    2.     {
    3.         if (gesture.WasCancelled)
    4.             return;
    5.         if (gesture.TargetObject != null || IsPointerOverUI(gesture))
    6.             return;
    7.         if (GestureTransformationUtility.Raycast(gesture.startPosition, _hits, UnityEngine.XR.ARSubsystems.TrackableType.PlaneWithinPolygon))
    8.         {
    9.             placedObj = Instantiate(DataHandler.Instance.GetFurniture(), pose.position, pose.rotation);
    10.  
    11.             var anchorObject = new GameObject("PlacementAnchor");
    12.             anchorObject.transform.position = pose.position;
    13.             anchorObject.transform.rotation = pose.rotation;
    14.             placedObj.transform.parent = anchorObject.transform;
    15.         }
    16.  
    17.  
    18.     }
     
  2. tonialatalo

    tonialatalo

    Joined:
    Apr 23, 2015
    Posts:
    60
    Yes it's possible, also what you load from Addressables ends up in the hierachy - or at least I suppose you load it that way, otherwise it would not show. Then you can manipulate them normally.