/** * <summary>Gets the position of the Hotspot's icon</summary> * <param = "inLocalSpace">If True, the position returned will be relative to the centre of the Hotspot's transform, rather than the scene's origin</param> * <returns>The position of the Hotspot's icon</returns> */ public Vector3 GetIconPosition(bool inLocalSpace = false) { Vector3 worldPoint = transform.position; if (centrePoint != null) { if (inLocalSpace) { return(centrePoint.position - transform.position); } return(centrePoint.position); } if (_collider != null) { if (_collider is BoxCollider) { BoxCollider boxCollider = (BoxCollider)_collider; worldPoint += boxCollider.center; } else if (_collider is CapsuleCollider) { CapsuleCollider capsuleCollider = (CapsuleCollider)_collider; worldPoint += capsuleCollider.center; } } else if (_collider2D != null) { if (_collider2D is BoxCollider2D) { BoxCollider2D boxCollider = (BoxCollider2D)_collider2D; worldPoint += UnityVersionHandler.Get2DHotspotOffset(boxCollider, transform); } } if (inLocalSpace) { return(worldPoint - transform.position); } return(worldPoint); }