I normally use like the following
public GameObject placedPrefab;
Instantiate(PlacePrefab, hitPose.position, hitPose.rotation);
or
Why do we do like the following way using get and set?
public GameObject PlacePrefab
{
get
{
return placedPrefab;
}
set
{
placedPrefab = value;
}
}
if(arRaycastManager.Raycast(touchPosition,hits,UnityEngine.XR.ARSubsystems.TrackableType.PlaneWithinPolygon))
{
var hitPose = hits[0].pose;
Instantiate(PlacePrefab, hitPose.position, hitPose.rotation);
}
Which is the correct way.First method is easy.The second method we are making the GameObject private to hide the GameObject.Is that the use of the above code?