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

בחלונית Hierarchy, בוחרים את האובייקט ARCore Extensions.
בשדה ARCore Extensions Config בחלונית Inspector, לוחצים על לחצן היעד
ומתחברים לנכס ARCoreExtensionsConfig.
ניהול סשנים ב-AR
ב-AR Foundation בגרסאות 2.1 ו-3.1, השמדת אובייקט המשחק ARSession תגרום להשמדת הסשן הבסיסי של ARCore.
החל מגרסה 4.0 של AR Foundation, צריך להשתמש בפונקציות LoaderUtility
כדי להשמיד ולייצר תת-מערכות במקום זאת. מדריך להעברה מ-AR Foundation 3.x ל-4.x
השלבים הבאים
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-02-28 (שעון UTC).
[null,null,["עדכון אחרון: 2025-02-28 (שעון 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"]]