Skip to content
beafraid edited this page Apr 16, 2024 · 6 revisions

Introduction

This SDK can export two types of items: Scene or Model. You can switch between these types using the Type field in the Item Manager window. Each type of item can contain Asset Files, which will be detailed later. While an application can load only one scene item at a time, it can load multiple model items simultaneously.

Item Type Content
Scene Scene, Assets
Model Assets

Scene Items

Scene items consist of a main scene and associated Asset Files. They allow you to create unique environments for users. For example, consider the Ocean item. The main scene represents a vast ocean, while the Asset Files include objects (such as boats and treasure chests) that replace desktop icons, decorative items (like ducks), and dynamic background elements (such as seagulls and schools of fish based on flocking algorithms):

image

Notes:

  • In this type of item, the Asset Files are typically closely related to the main scene (e.g., objects floating in the ocean) or use custom code components. If the Asset Files are generic materials, it's recommended to package them separately in a model item so that more scenes can utilize them.

Model Items

Model items contain only Asset Files. They usually consist of a collection of resources from the same series (such as building modules, environmental effects, or vehicles). These resources can be used by users in different scenes. For instance, the Low Poly Building Modules item is based on the free Unity Asset Store package Low Poly Buildings - Full Pack, it provides building structures, roads, and vehicles needed for constructing a city:

image

Main Scene for Scene Items

If an item's type is a scene, you need to add a main scene to package it correctly. Click the Create Scene button in the Item Manager window to open the scene template selection window titled Select Template.... Here, you'll find commonly used item template scenes. Select an appropriate template on the left and click the Create button. A new Entry.unity scene file and related assets will be cloned and stored in the [Item Root Directory]/Scenes folder.

image

Once the main scene is created, you can reopen it by clicking the Edit Scene button in the Item Manager window. In the Hierarchy window, you'll see the following two scenes:

image

Entry Scene

This scene serves as the main scene for the item and includes environmental setup and various logic code.

image

Game Objects and Components

This scene may contain the following game objects. Objects marked with [Required] must be included in the scene (or components must be attached to the game objects), while those marked with [Optional] are provided by default and can be customized if needed:

AliveDesktop [Required]: The main controller for this scene. It includes the following components:

  • AD_AliveDesktop [Required]: Marks this object as the AliveDesktop singleton.

ShellController [Required]: The controller for Shell Items. It has the following components:

  • AD_DefaultShellController (or a subclass of IAD_ShellController) [Required]: Customizes the rules for generating Shell Items (e.g., generation area, interval).

DecorationController [Required]: The controller for Decoration Items. It has the following components:

  • AD_DefaultDecorationController (or a subclass of IAD_DecorationController) [Required]: Customizes the rules for generating Decoration Items (e.g., generation area, interval).

EnvironmentController [Optional]: Manages environment settings. It has the following components:

  • AD_DefaultEnvironmentController (or a subclass of IAD_EnvironmentController) [Required]: Customizes environment settings (such as lighting, skyboxes, or reflections).

PostProcessingController [Optional]: Manages post-processing effects (PostProcessing). It has the following components:

  • AD_DefaultPostProcessingController (or a subclass of IAD_PostProcessingController) [Required]: Customizes post-processing settings.

XRController [Optional]: Manages XR settings. It has the following components:

  • AD_DefaultXRController (or a subclass of IAD_XRController) [Required]: Customizes initial teleport points, XR movement modes, and caching of the last position when leaving.

PD Group [Optional]: If you want to provide configurable/stored data to users (such as the aforementioned PostProcessing configuration file), you need to add child objects with specified PersistentData components under this object. Each component should have a unique key:

image

AliveDesktopHub_Simulator Scene

This scene simulates the runtime environment, allowing you to test certain features without packaging an item:

image

Notes:

  • If you can't find this scene, you can open it by clicking the Alive Desktop/Add Simulator Scene button in the top menu.
  • The scene resources are stored by default in a read-only Package folder. You need to first import or update the relevant Simulator resources in the PackageManager window to open it successfully.
  • The simulator supports PC/VR mode, which can be toggled using the Alive Desktop/Set Platform Mode option in the top menu.
  • In PC mode, the XR Device Simulator module from XRI provides keyboard and mouse simulation for VR input. You can expand the XR Device Simulator UI in the lower-left corner to view operation hints:

image

Next, let's explore the important game objects in this scene. Feel free to skip this section if you find it boring:

SystemManager Group (Handles system data and events)

  • SystemAudioManager: Samples system audio, mainly for audio visualization. This object has an AudioSource component that allows you to set different audio sources for debugging. To play/pause audio during runtime, click the ToggleUI on the right side of this object in the Hierarchy window.

SettingManager Group (Handling User Settings)

  • CommonSettingManager: Manages common settings for the program. When the program is running, if you modify relevant fields in the AD_CommonSettingManagerSimulator component, the program will send corresponding events.
  • ModManager Group (Handling Program Data and Events)
  • EnvironmentManager: Manages environment settings.
  • PostProcessingManager: Manages PostProcessing settings.
  • SceneManager: Manages scene transitions.
  • XRManager: Manages XR settings and status.
  • InputManager: Manages various input sources.
  • ShellManager: Manages Shell controllers.
  • DecorationManager: Manages Decoration controllers.

AssistantManager

This group of objects primarily provides debugging functionality, and related configuration information is stored in the Assets/Resources/Threeyes/SteamworksEditorSetting.asset file:

image

Asset Files

Asset files consist of various files, such as Prefabs, models, textures, audio, etc.

Shell/Decoration Objects

The following two types of Prefab objects are quite special, as they are mainly used for user editing:

  • Shell Items: These objects replace desktop icons (such as files, folders, shortcuts) and can display corresponding icon information using text, textures, etc. For example, in the image below, the sailboat model replaces the This PC icon on the desktop. The boat name corresponds to the icon's name, and the sail pattern corresponds to the icon's preview image. Users can enter edit mode to modify its content:

image

  • Decoration Items: These objects are not bound to desktop icons. Users can add, delete, or edit them at runtime to enrich the scene content. In the scene below, chairs, televisions, clocks, etc., are all decoration items placed by users during runtime:

image

Follow the following process to create Shell/Decoration Objects.

Initializing Prefabs

Firstly, objects need to be modeled and placed according to rules:

  • The root object's scale should be 1, matching the real-world size (where 1 Unity unit corresponds to 1 meter in the real world).
  • The root object's pivot point should be at the bottom of the object, with its local X/Y/Z axes corresponding to the object's right/up/front directions (based on the Unity coordinate system). For the convenience of viewing, based on the placeable area of objects, they can be placed in the modeling scene as follows (note their anchor orientation and local rotation values):
    • Objects are mainly placed on the ground: image
    • Objects mainly attach to walls: image
    • Objects mainly attach to the ceiling: image

After the object is made, it needs to be turned into Prefab, and then select the Prefab in the Project window and click an appropriate option in the top menu Alive Desktop/[Shell/Decoration]/Init/.... The SDK will add the necessary components:

image

The following components are mandatory to include; otherwise, issues related to serialization may occur:

  • AD_DefaultShellItem/AD_DefaultDecorationItem: Marks this object as a Shell/Decoration item.
  • RuntimeSerializable_GameObject: Manages overall serialization data for the object.
  • RuntimeSerializable_Transform: Manages serialization data for the Transform component.

Based on interactivity, they can also be categorized as:

  • Static Objects: These provide basic decorative functionality and are not interactive. Examples include wall modules, trees, etc.
  • Interactable Objects: These can receive player input (such as grabbing, switching, driving) or interact with environmental objects (such as being sucked by a socket). In the GIF below, the toy car is an interactable object. Users can drive it or attach it to a specified position:

image

Note:

  • Nested prefabs (i.e., prefabs that contain other prefabs within them) after packaging may experience order misalignment issues during initialization. Therefore, it is recommended to, after completing the editing process, enter the preview mode of the root prefab, right-click on all its child prefabs, and choose the Prefab/[Unpack/Unpack Completely] menu option to dismantle their prefab status (which can later be reconnected using the Prefab/Reconnect Prefab... function if modifications are needed).

AD_SOXXXPrefabInfo

The AD_SOXXXPrefabInfo type of ScriptableObject file is used to store metadata for Shell/Decoration Items, including the Prefab reference, title, and preview image:

image

To create an AD_SOXXXPrefabInfo file, select the corresponding Shell/Decoration object Prefab in the Project window. Then, click an appropriate option in the top menu Alive Desktop/[Shell/Decoration]/PrefabInfo/Create. The SDK will automatically generate a file based on the names, preview images, and other data from all selected Prefabs in the [Parent Folder]/PrefabInfo directory:

image

AD_SOXXXPrefabInfoGroup

The AD_SOXXXPrefabInfoGroup type of ScriptableObject file can store multiple AD_SOXXXPrefabInfo instances. It allows you to group similar Shell/Decoration Items together as a collection. For example, in the image below, it represents an audio visualization object collection:

image

To create an AD_SOXXXPrefabInfoGroup file, right-click in the Project window's blank area and choose Create/Alive Desktop/PrefabInfo. Select either the ShellItemGroup or DecorationItemGroup option. The SDK will generate the corresponding file. In the Inspector window, you can set the Title and the AD_SOXXXPrefabInfo ListData for the created group. You can also right-click on the component in the Inspector window and choose InitUsingCurFolder. The SDK will automatically search for all AD_SOXXXPrefabInfo files in the folder where this file is located and add them to the ListData field.

Here's several methods to create or update an AD_SOXXXPrefabInfoGroup file:

  • Select the corresponding AD_SOXXXPrefabInfo files in the Project window, and click on the top menu Alive Desktop/[Shell/Decoration]/PrefabInfo/Group Selected. The SDK will then generate the corresponding file. After selecting the generated file, you can set its title and the list of AD_SOXXXPrefabInfo items (ListData) in the Inspector window.
  • Right-click in an empty area within the Project window, choose Create/Alive Desktop/PrefabInfo/[ShellItemGroup/DecorationItemGroup]. The SDK will generate the corresponding file.
  • If you have already created an AD_SOXXXPrefabInfoGroup file, select it in the Project window, and right-click on the component in the Inspector window, then choose the InitUsingCurFolder option. The SDK will automatically search for all AD_SOXXXPrefabInfo instances within the folder where the file is located and update the ListData field accordingly.

The relationship between these file types is as follows:

flowchart LR;
    AD_SOXXXPrefabInfoGroup-->AD_SOXXXPrefabInfo1-->Prefab1;
    AD_SOXXXPrefabInfoGroup-->AD_SOXXXPrefabInfo2-->Prefab2;
Loading

Notes:

  • At runtime, the program scans all AD_SOXXXPrefabInfoGroup resources in the Item package to list the corresponding Shell/Decoration Items.
  • Each Item package can contain multiple AD_SOXXXPrefabInfoGroup files.
Clone this wiki locally