הגדרה של סשן ב-ARCore באמצעות תוספי ARCore ל-Unity
מגדירים סשן ARCore כדי ליצור חוויות AR לאפליקציה.
מהו סשן?
כל תהליכי ה-AR, כמו מעקב תנועה, הבנה סביבתית והערכת תאורה, מתרחשים בתוך סשן ARCore. ARSession
הוא נקודת הכניסה הראשית ל-ARCore API. המערכת מנהלת את מצב מערכת ה-AR ומטפלת במחזור החיים של הסשן, וכך מאפשרת לאפליקציה ליצור, להגדיר, להתחיל או להפסיק סשן. הדבר החשוב ביותר הוא שהיא מאפשרת לאפליקציה לקבל פריימים שמאפשרים גישה לתמונה מהמצלמה ולתנוחת המכשיר.
אפשר להשתמש בסשן כדי להגדיר את התכונות הבאות:
הגדרה של תוספי AR Foundation ו-ARCore
צריך להגדיר את AR Foundation כדי שתוכלו להשתמש בתוספים של ARCore. הוראות להגדרת סצנת ה-AR מפורטות במסמכי התיעוד של AR Foundation.
צריך להגדיר את התוספים של ARCore לפני שאפשר להגדיר סשן ARCore. אם עדיין לא עשיתם זאת, תוכלו לקרוא את מאמרי ההגדרה של תוספי ARCore.
יצירת הגדרות סשן חדשות ב-ARCore.
ב-Unity, יוצרים הגדרת סשן חדשה על ידי ניווט אל Assets >
Create > XR > ARCore Extensions Config.
הגדרת ברירת המחדל נראית כך:

בחלונית Hierarchy בוחרים את האובייקט ARCore Extensions.
בשדה ARCore Extensions Config בחלונית Inspector, לוחצים על לחצן היעד
ומתחברים לנכס ARCoreExtensionsConfig.
ניהול סשנים ב-AR
השמדה של אובייקט המשחק ARSession ב-AR Foundation תשמיד את סשן ה-ARCore הבסיסי.
החל מגרסה 4.0 של AR Foundation, צריך להשתמש בפונקציות LoaderUtility
כדי להשמיד ולייצר תת-מערכות במקום זאת. כאן תוכלו לקרוא את המדריך להעברה מ-AR Foundation 3.x ל-4.x.
השלבים הבאים
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-11-09 (שעון UTC).
[null,null,["עדכון אחרון: 2024-11-09 (שעון UTC)."],[[["An ARCore session manages all AR processes like motion tracking and environmental understanding, and is accessed through the `ARSession` object."],["Before configuring an ARCore session, ensure both AR Foundation and ARCore Extensions are properly set up in your Unity project."],["You can configure extension features within the ARCoreExtensionsConfig asset, which allows you to customize session behavior."],["Starting with AR Foundation 4.0, session management is handled through `LoaderUtility` functions instead of destroying the `ARSession` game object."],["After configuring your session, explore the provided quickstart guides for Android and iOS to begin building AR experiences with ARCore Extensions."]]],["An ARCore session is essential for AR processes like motion tracking and lighting estimation. `ARSession` manages the AR system state, including session creation and configuration, and enables access to camera images and device pose. Before configuring the ARCore session, AR Foundation and ARCore Extensions must be set up. You need to create an `ARCore Extensions Config` asset in Unity and connect it to the `ARCore Extensions` object. Session management is done using `LoaderUtility` functions in newer versions of AR Foundation.\n"]]