### Unity Missing Dependencies List Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/ent-unpriv-install Shows an example of a list of missing dependencies generated by the Unity Installer. It includes the dependency name, download location, and the path to the local installer executable. ```text Dependency: Visual C++ 2010 runtime (x64) Download location: https://www.microsoft.com/en-ca/download/details.aspx?id=26999 Local Installer: C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\MissingDependencies\vcredist_x64_2010.exe Dependency: Visual C++ 2013 runtime (x64) Download location: https://www.microsoft.com/en-ca/download/details.aspx?id=40784 Local Installer: C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\MissingDependencies\vcredist_x64_2013.exe Dependency: Visual C++ 2015 runtime (x64) Download location: https://www.microsoft.com/en-ca/download/details.aspx?id=48145 Local Installer: C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\MissingDependencies\vcredist_x64_2015.exe ``` -------------------------------- ### Sample services-config.json for standard user installs Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/ent-unpriv-install A complete example of the services-config.json file that enables standard user installations and specifies a shared installation directory for Unity Editor binaries. ```json { "hubDisableElevate": true, "machineWideSecondaryInstallLocation": "C:\\UnityEditors" } ``` -------------------------------- ### Unity Android Player Settings Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/android-getting-started Reference documentation for Android Player settings in Unity. These settings control various player-specific options for the final game build. ```APIDOC Player Settings (Android): - Description: Settings that let you set various player-specific options for the final game built by Unity. - Related: Android Player settings, PlayerSettingsAndroid class, Glossary#PlayerSettings. - Configuration: Includes options for build settings, publishing settings, and device-specific configurations. ``` -------------------------------- ### UPM Git Installation Prerequisites Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/upm-ui-giturl Lists the essential software and configuration requirements needed before installing UPM packages from Git URLs. This includes Git client versions and environment variable setup. ```APIDOC Prerequisites for Git URL Installation: - Git Client: Minimum version 2.14.0 installed on the computer. - Windows: Git executable path must be added to the system's PATH environment variable. - Git LFS Client: Required if the target repository tracks files using Git Large File Storage (LFS). Note: Git dependencies are retrieved directly from the repository and may not adhere to standard package registry quality or versioning guarantees. ``` -------------------------------- ### Unity Android Keystore Management Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/android-getting-started Information on using the Android Keystore Manager to set up keystores required for signing an Android application. This ensures the authenticity and integrity of your app. ```APIDOC Android Keystores: - Description: An Android system that lets you store cryptographic key entries for enhanced device security. - Purpose: Required to sign an Android application. - Management: Use the Android Keystore Manager to set up keystores. - Related: PlayerSettingsAndroid.html#projectkeystore, Glossary#AndroidKeystore. ``` -------------------------------- ### Install Unity Editor and Components via Installer Files Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/install-unity-with-installers Provides the procedural steps for installing Unity Editor and additional components using installer files. This includes accessing the archive, selecting versions, downloading, and running the installers. ```APIDOC Installation Process: 1. Access the [Unity download archive](https://unity.com/releases/editor/archive) to select Unity Editor release versions. - For early access, check [Unity Beta Program](https://unity.com/releases/editor/beta). 2. Use filter controls to list desired Unity versions. 3. In the **Downloads** column, select **See all** for the target Unity version. - This displays **Manual installs** and **Component installers** sections. 4. In **Manual installs** > **Operating Systems**, select the Unity Editor installer for your OS. - For other components (e.g., platform build support), go to **Component installers**, expand the OS section, and select required components. - The installer file download begins. Save the file and note its location. 5. Navigate to the downloaded installer file using your file manager. - Note: Downloaded installer files can be used for command-line installations on other computers. 6. Run the installer file and follow the **Introduction** and **License** prompts. 7. Choose the installation folder for Unity Editor. The default location can be changed. - When installing components, select the root folder of the Unity Editor installation to add them to. 8. Complete the remaining installation steps. **Note**: Some platforms may require additional dependencies alongside platform build support. Refer to [Platforms development](PlatformSpecific.html) for details. ``` -------------------------------- ### Unity UI Toolkit Text Settings Asset Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-get-started-with-text Details the creation and configuration of a UITK Text Settings asset, which manages text settings for a UI panel. This includes setting up resource folders for font assets and style sheets. ```Editor Setup 1. Create a runtime UI (refer to 'Get started with Runtime UI'). 2. In the `Assets` folder, create a `Resources` folder. 3. Right-click in the `Assets/UI Toolkit` folder, select **Create** > **UI Toolkit** > **Text Settings** to create `UITK Text Settings.asset`. 4. In the `Resources` folder, create two sub-folders: `Fonts & Materials` and `Text Style Sheets`. ``` -------------------------------- ### Install Unity from the Command Line Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/install-unity-with-installers Mentions the capability to use downloaded Unity installer files for installation via the command line, although specific commands are not detailed in this section. ```APIDOC Command Line Installation: - The downloaded installer file can be used to install Unity Editor on other computers using the command line. ``` -------------------------------- ### Install Unity Editor from Command Line Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/GettingStartedInstallingUnity Instructions for installing the Unity Editor and its components using installer files via the command line. This method is useful for automated deployments or installing on multiple machines. ```APIDOC Command Line Installation: Use installer files generated by the Unity Download Assistant or available on the Unity download archive. Example (Conceptual): --install --components "Editor,Android,WebGL" --root "C:\Unity" --uninstall --components "Editor" Refer to Unity's official documentation for specific command-line arguments and syntax. ``` -------------------------------- ### Create and Configure Text StyleSheet Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-get-started-with-text Steps to create a custom text style sheet asset in Unity and define opening and closing tags for rich text formatting. ```Unity Configuration Name: ExampleStyle Opening Tags: * Closing Tags: * ``` -------------------------------- ### Configure Parent Container Properties Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIB-getting-started Sets up the main container for the UI layout, defining its orientation and size. ```USS /* In the Inspector panel for the parent VisualElement */ /* Flexbox properties */ flex-direction: row; flex-grow: 0; /* Size properties */ height: 350px; ``` -------------------------------- ### C# Script for ExampleObject Data Source Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-get-started-runtime-binding Defines a `ScriptableObject` asset named `ExampleObject` with a public string property `simpleLabel`. This script serves as the data source for UI Toolkit runtime data binding, allowing its properties to be linked to UI elements. ```C# using Unity.Properties; using UnityEngine; using UnityEngine.UIElements; #if UNITY_EDITOR using UnityEditor; #endif [CreateAssetMenu] public class ExampleObject : ScriptableObject { [Header("Simple binding")] public string simpleLabel = "Hello World!"; } ``` -------------------------------- ### Unity visionOS XR Setup and Configuration Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/visionOS Guides users through installing necessary Unity modules and packages for visionOS development, and configuring the XR Plug-in Manager for different app modes (Windowed, Volume, Immersive Space, Fully Immersive Space). ```APIDOC Unity visionOS XR Setup: 1. **Install visionOS Module:** * Use the Unity Hub to install the visionOS module for Unity Editor. * Requirement: Unity 2022.3.5f1+. 2. **Install Required Packages (based on App Type): * **Windowed Apps Only:** No additional packages required beyond the visionOS module. * **Fully Immersive (VR) Apps:** * `com.unity.xr.visionos` * **Immersive (MR) Apps:** * `com.unity.xr.visionos` * `com.unity.polyspatial.visionos` * `com.unity.polyspatial.xr` * **Installation Source:** Refer to "Install PolySpatial and visionOS support" for detailed instructions. 3. **Configure App Mode in Project Settings:** * Navigate to: **Project Settings > XR Plug-in Manager > Apple visionOS** * Select **App Mode**: * `Mixed Reality - Volume or Immersive Space`: For Immersive (MR) apps. * `Virtual Reality - Fully Immersive Space`: For Fully Immersive (VR) apps. **Note:** Failure to install the correct packages will limit app functionality to Windowed apps. ``` -------------------------------- ### Unity C# Example for AudioSource.Play Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/AudioSource.Play A C# script demonstrating the usage of the AudioSource.Play method in Unity. It shows how to get the AudioSource component, play a clip on start, and includes GUI buttons for pausing and unpausing the audio. ```csharp using UnityEngine; // The Audio Source component has an AudioClip option. The audio // played in this example comes from AudioClip and is called audioData. [RequireComponent(typeof(AudioSource))] public class ExampleScript : MonoBehaviour { AudioSource audioData; void Start() { audioData = GetComponent(); audioData.Play(0); Debug.Log("started"); } void OnGUI() { if (GUI.Button(new Rect(10, 70, 150, 30), "Pause")) { audioData.Pause(); Debug.Log("Pause: " + audioData.time); } if (GUI.Button(new Rect(10, 170, 150, 30), "Continue")) { audioData.UnPause(); } } } ``` -------------------------------- ### Unity Accelerator Command Line Arguments Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/accelerator-install-installer This section details command-line arguments for running the Unity Accelerator installer. It covers general help options and specific parameters for unattended installations. ```APIDOC Installer Command Line Arguments: --help Displays available command line options for the installer. --storagedir Sets the directory for the Accelerator to store files and configurations. --mode unattended Use for automated installations that don’t need to query anything. This uses default values, or values from other option flags provided. macOS Specific: To run the installer on macOS, mount the disk image (.dmg) and execute the binary located in the installer app's directory at Contents/macOS/installbuilder.sh. ``` -------------------------------- ### Example Audio Plugins Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/AudioMixerNativeAudioPlugin Provides access to example DSP plug-ins, including those with and without GUI customization. These examples serve as practical references for developing your own audio plug-ins. ```APIDOC Example plug-ins: - Example DSP plug-ins with and without GUI customization. - Practical references for developing custom audio plug-ins. ``` -------------------------------- ### Simplify Animation Playback with AnimationPlayableUtilities Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/Playables-Examples Shows a simplified approach to playing an animation clip using `AnimationPlayableUtilities.PlayClip`. This method abstracts away much of the manual graph setup, requiring an Animator component. ```C# using UnityEngine; using UnityEngine.Playables; using UnityEngine.Animations; [RequireComponent(typeof(Animator))] public class PlayAnimationUtilitiesSample : MonoBehaviour { public AnimationClip clip; PlayableGraph playableGraph; void Start() { AnimationPlayableUtilities.PlayClip(GetComponent(), clip, out playableGraph); } void OnDisable() { // Destroys all Playables and Outputs created by the graph. playableGraph.Destroy(); } } ``` -------------------------------- ### UI Builder Topics and Workflow Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIBuilder This section outlines key topics and workflows for using UI Builder, including interface overview, getting started, structuring elements, templating, styling, and testing. ```APIDOC UI Builder Workflow Topics: 1. UI Builder Interface Overview: - Description: Understand the layout and components of the UI Builder editor. - Related: UI Toolkit, UI Elements. 2. Get Started with UI Builder: - Description: Learn the basic workflow for creating UI through an example. - Related: UI Toolkit, UXML. 3. Work with Elements: - Description: Learn how to structure UI controls and elements within your project. - Related: UXML, UI Elements. 4. Use UXML Instances as Templates: - Description: Understand how to use existing UXML Documents as templates for new UXML Documents. - Related: UXML. 5. Style UI with UI Builder: - Description: Create and manage USS styles, use USS selectors and variables, and position elements. - Related: USS, CSS. 6. Assign USS Variables in UI Builder: - Description: Learn how to assign and remove USS variables for dynamic styling. - Related: USS, CSS Variables. 7. Test UI: - Description: Debug styles and test UI functionality directly within the UI Builder environment. - Related: UI Toolkit, Debugging. ``` -------------------------------- ### Unity Windows Installer Command Line Arguments Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/InstallingUnity Provides essential command-line arguments for silent installation and directory specification when deploying Unity on Windows. These arguments control the installation process without user interaction. ```APIDOC Unity Windows Installer Arguments: Argument: /S Description: Performs a silent installation, running without any user interaction. Argument: /D=PATH Description: Sets the default installation directory. Must be used with the silent installation option (/S). The default folder is `C:\Program Files (x86)\Unity` (32-bit) or `C:\Program Files\Unity` (64-bit). Note: Specify the default installation directory path as the last argument. Do not enclose the path in quotes, even if it contains spaces. ``` -------------------------------- ### Create Root Element with Flex Grow and Centering Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIB-getting-started This snippet outlines the steps to create a root visual element in Unity's UI Builder, set its flex-grow property to cover the screen, and center child elements. It also covers setting a background color. ```APIDOC UI Builder Workflow: 1. **Create New UXML Document**: - Navigate: **File** > **New** in the UI Builder window. - Name the document (e.g., `MainView.uxml`) and save it. 2. **Add Root Visual Element**: - Drag **VisualElement** from the **Library** panel to the **Hierarchy** panel. 3. **Configure Root Element Properties (Inspector Panel)**: - Select the root element in the **Hierarchy**. - **Flex Properties**: - Set **Flex** > **Grow** to `1` (sets `flex-grow: 1;`). This makes the element occupy all available space. - **Alignment Properties**: - Set **Align Items** to `Center` (sets `align-items: center;`). - Set **Justify Content** to `Center` (sets `justify-content: center;`). These properties center child elements within the root. - **Background Properties**: - Set **Background** > **Color** to `#732526` (sets `background-color: rgb(115, 37, 38);`). Ensure Alpha is set to `255` for opacity. ``` -------------------------------- ### Unity Hub Command-Line Interface Reference Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/GettingStartedInstallingUnity Provides access to Unity Hub's command-line interface (CLI) for managing Unity Editor installations, projects, and other aspects of the Unity experience. Refer to the official documentation for detailed commands and usage. ```APIDOC Hub CLI: Refer to official Unity Hub documentation for detailed commands and usage. - Manages Unity Editor installations - Manages Unity projects - Manages Unity accounts and licenses Example Usage (Conceptual): unityhub --install --modules , unityhub --list-editors unityhub --remove ``` -------------------------------- ### Install Unity Component via Installer Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/InstallingUnity Installs a specific Unity component, such as Android Support, using the system's installer command. This command is typically run on macOS. ```shell sudo installer [-dumplog] -package UnitySetup-Android-Support-for-Editor-6000.0.24f1.pkg -target / ``` -------------------------------- ### Install Unity Components on Windows (Silent) Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/InstallingUnity Installs additional Unity components, such as platform build support, silently using their respective installer files and command-line arguments. The target directory should be the Unity root folder. ```batch UnitySetup-Android-Support-for-Editor-6000.0.24f1.exe /S /D=C:\Program Files\Unity 6000.0.24f1 ``` -------------------------------- ### Unity Editor Default Installation Locations Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/install-unity-with-installers Details the default installation directories for the Unity Editor on macOS and Windows operating systems after installation. ```APIDOC Default Installation Locations: - macOS: `/Applications/Unity` - Windows: `C:\\Program Files\\Unity ` ``` -------------------------------- ### Configure Character Details Container Properties Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIB-getting-started Sets up the container for character details, defining alignment, sizing, padding, and background color. ```USS /* In the Inspector panel for the character details VisualElement */ /* Alignment properties */ align-items: flex-end; justify-content: space-between; /* Child element alignment and sizing */ /* For the inner VisualElement */ flex-grow: 0; width: 276px; /* Inner element alignment */ align-items: center; justify-content: center; /* Spacing properties */ padding: 8px; /* Appearance properties */ background-color: #AA5939; ``` -------------------------------- ### UI Toolkit Getting Started Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIToolkits UI Toolkit is Unity's latest UI system, designed for optimized performance across platforms and inspired by standard web technologies. Use UI Toolkit to create extensions for the Unity Editor, and to create runtime UI for games and applications. ```APIDOC UI Toolkit Documentation: https://docs.unity3d.com/Manual/UIElements.html Get started with UI Toolkit: https://learn.unity.com/ Description: Documentation and workflow guides for Unity's modern UI system, UI Toolkit, which leverages UXML and USS for UI creation and styling, similar to web development. ``` -------------------------------- ### Runtime UI ListView Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-uxml-examples Demonstrates using ListView to create a simple character selection screen for runtime UI. This example shows how to integrate UI Toolkit lists into a live game environment. ```C# /* C# code for runtime UI ListView example not provided in source text. */ /* Refer to UIE-HowTo-CreateRuntimeUI.html for details. */ ``` -------------------------------- ### Dynamic Font Atlas Generation Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-get-started-with-text Explains how entering text in a UI field dynamically generates the font atlas for dynamic font assets, allowing visualization of new characters. ```Unity Runtime Enable Rich Text: true ``` -------------------------------- ### Install Unity Editor on macOS Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/InstallingUnity Installs the Unity Editor on macOS using the standard `installer` command with a `.pkg` file. This command requires administrator privileges and specifies the target volume for installation. ```shell sudo installer [-dumplog] -package Unity.pkg -target / ``` -------------------------------- ### Install Package with Unity Scripting API Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/upm-api This C# example shows how to add a package to a Unity project using the PackageManager.Client.Add method. It demonstrates specifying a package name, handling the asynchronous request, and logging the success or failure status. ```C# using System; using UnityEditor; using UnityEditor.PackageManager.Requests; using UnityEditor.PackageManager; using UnityEngine; namespace Unity.Editor.Example { static class AddPackageExample { static AddRequest Request; [MenuItem("Window/Add Package Example")] static void Add() { // Add a package to the project Request = Client.Add("com.unity.textmeshpro"); EditorApplication.update += Progress; } static void Progress() { if (Request.IsCompleted) { if (Request.Status == StatusCode.Success) Debug.Log("Installed: " + Request.Result.packageId); else if (Request.Status >= StatusCode.Failure) Debug.Log(Request.Error.message); EditorApplication.update -= Progress; } } } } ``` -------------------------------- ### Install Unity Editor on Windows (Silent) Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/InstallingUnity Installs the Unity Editor silently to a specified folder using the installer executable and command-line arguments. This is useful for automated deployments. ```batch UnitySetup64.exe /S /D=E:\Development\Unity ``` -------------------------------- ### Example: Using Shader.Find in Unity Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/Shader.Find Demonstrates how to use Shader.Find to get a shader and create a material with it in Unity. This example shows creating a material with the "Transparent/Diffuse" shader and assigning it to a renderer. ```C# using UnityEngine; public class Example : MonoBehaviour { // Create a material from code void Start() { // Create a material with transparent diffuse shader Material material = new Material(Shader.Find("Transparent/Diffuse")); material.color = Color.green; // assign the material to the renderer GetComponent().material = material; } } ``` -------------------------------- ### Unity Lightmapping Setup Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/Lightmapping Instructions for setting up Unity scenes and lights for lightmap baking, including accessing the Lighting window and configuring scene objects. ```APIDOC Unity Editor Menu: Window > Rendering > Lighting - Opens the Lighting window for lightmap baking configuration. Mesh Import Settings: Generate Lightmap UVs - Enable this setting in Mesh import settings to ensure proper UVs for lightmapping. Lightmapping Settings: Lightmap Resolution - Adjust this value to control the resolution of generated lightmaps. Renderer Requirements for Lightmaps: - Must have a Mesh Renderer or Terrain component. - Must be marked as Contribute GI (Global Illumination). - Must use a built-in Unity Material or a shader that supports lightmaps, or a shader in the Built-In Render Pipeline with a Meta Pass. Light Explorer: Window > Rendering > Light Explorer - Access to adjust settings for Lights in the scene. ``` -------------------------------- ### Create Static Font Asset Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-get-started-with-text Steps to create a static font asset in Unity. This involves selecting a font file, configuring its import settings, creating an SDF font asset, setting the Atlas Population Mode to Static, and generating the atlas for custom characters. ```Unity 1. Download Lato font package. 2. Place Lato-Regular.ttf in Assets folder. 3. Inspector for Lato-Regular.ttf: - Include Font Data: enabled - Character: Dynamic 4. Right-click Lato-Regular.ttf -> Create > Text Core > Font Asset > SDF. 5. Inspector for Lato-Regular SDF.asset: - Atlas Population Mode: Static 6. Click Update Atlas Texture. 7. Font Asset Creator window: - Character Set: Custom Characters - Custom Characters List: TBhinostua* 8. Click Generate Font Atlas. 9. Save changes. 10. Place Lato-Regular SDF.asset in Assets\Resources\Fonts & Materials. 11. Open SimpleRuntimeUi.uxml. 12. Button control Inspector > Text > Font Asset > Lato-Regular SDF. ``` -------------------------------- ### Comprehensive LongField C# Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-uxml-element-LongField An example demonstrating common LongField functionalities: getting a field from UXML, assigning values, creating a new field, disabling it, applying styles, and mirroring values between fields. ```csharp /// // Get a reference to the field from UXML and assign a value to it. var uxmlField = container.Q("the-uxml-field"); uxmlField.value = 42; // Create a new field, disable it, and give it a style class. var csharpField = new LongField("C# Field"); csharpField.SetEnabled(false); csharpField.AddToClassList("some-styled-field"); csharpField.value = uxmlField.value; container.Add(csharpField); // Mirror the value of the UXML field into the C# field. uxmlField.RegisterCallback>((evt) => { csharpField.value = evt.newValue; }); /// ``` -------------------------------- ### Unity C# Behaviour Enabled Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/Behaviour-enabled Demonstrates enabling a UI element (pause menu) in Unity using C#. The example sets the `enabled` property of a `pauseMenu` (an Image component) to `true` within the `Start` method. It requires the `UnityEngine` and `UnityEngine.UI` namespaces. ```C# using UnityEngine; using System.Collections; using UnityEngine.UI; // Required when Using UI elements. public class Example : MonoBehaviour { public Image pauseMenu; public void Start() { //Enables the pause menu UI. pauseMenu.enabled = true; } } ``` -------------------------------- ### Create Custom Editor Window with UI Toolkit Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-simple-ui-toolkit-workflow Steps to create a custom Editor window in Unity using the UI Toolkit. This involves generating a C# script and a UXML file via the Editor Window Creator, and then opening the window from the Unity Editor menu. ```unity-editor-menu Window > UI Toolkit > SimpleCustomEditor ``` ```unity-editor-file-creation Assets/Editor/SimpleCustomEditor.cs Assets/Editor/SimpleCustomEditor.uxml ``` -------------------------------- ### Unity ProfilerRecorder C# Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/Unity.Profiling.ProfilerRecorder Demonstrates how to use Unity's ProfilerRecorder to capture and display performance metrics such as system memory, GC memory, and main thread timing. It shows how to start, stop, and access recorder data, including handling unmanaged resources with IDisposable. ```C# using System.Collections.Generic; using System.Text; using Unity.Profiling; using UnityEngine; public class ExampleScript : MonoBehaviour { string statsText; ProfilerRecorder systemMemoryRecorder; ProfilerRecorder gcMemoryRecorder; ProfilerRecorder mainThreadTimeRecorder; static double GetRecorderFrameAverage(ProfilerRecorder recorder) { var samplesCount = recorder.Capacity; if (samplesCount == 0) return 0; double r = 0; unsafe { var samples = stackalloc ProfilerRecorderSample[samplesCount]; recorder.CopyTo(samples, samplesCount); for (var i = 0; i < samplesCount; ++i) r += samples[i].Value; r /= samplesCount; } return r; } void OnEnable() { systemMemoryRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "System Used Memory"); gcMemoryRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "GC Reserved Memory"); mainThreadTimeRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "Main Thread", 15); } void OnDisable() { systemMemoryRecorder.Dispose(); gcMemoryRecorder.Dispose(); mainThreadTimeRecorder.Dispose(); } void Update() { var sb = new StringBuilder(500); sb.AppendLine($"Frame Time: {GetRecorderFrameAverage(mainThreadTimeRecorder) * (1e-6f):F1} ms"); sb.AppendLine($"GC Memory: {gcMemoryRecorder.LastValue / (1024 * 1024)} MB"); sb.AppendLine($"System Memory: {systemMemoryRecorder.LastValue / (1024 * 1024)} MB"); statsText = sb.ToString(); } void OnGUI() { GUI.TextArea(new Rect(10, 30, 250, 50), statsText); } } ``` -------------------------------- ### Tabbed Menu with Label Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-uxml-examples Demonstrates creating a tabbed menu interface for runtime applications using the Label control in Unity's UI Toolkit. This example shows how to group and navigate content. ```C# /* C# code for tabbed menu with Label example not provided in source text. */ /* Refer to UIE-create-tabbed-menu-for-runtime.html for details. */ ``` -------------------------------- ### Example: Get Components In Children Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/Component.GetComponentsInChildren Demonstrates how to use GetComponentsInChildren to find all HingeJoint components on the same GameObject or its children, and modify a property on them. ```C# using UnityEngine; public class GetComponentsInChildrenExample : MonoBehaviour { public Component[] hingeJoints; void Start() { hingeJoints = GetComponentsInChildren(); foreach (HingeJoint joint in hingeJoints) joint.useSpring = false; } } ``` -------------------------------- ### Create and Apply USS Border Class Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIB-getting-started Defines a reusable USS class for border styling and applies it to UI elements. ```USS /* In the StyleSheet panel, create a new USS file (e.g., MainView.uss) */ /* Define the .border class */ .border { border-color: #311A11; border-width: 4px; border-radius: 15px; } /* Apply the class to elements in the UI Builder */ /* Drag '.border' from StyleSheet to the target VisualElement */ /* Or apply via Inspector > Class List */ ``` -------------------------------- ### Common UPM Git Installation Errors Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/upm-ui-giturl Provides a list of common error messages encountered during UPM package installation from Git URLs, along with links to troubleshooting pages for specific issues. ```APIDOC Common Error Messages: - No 'Git' executable was found: Indicates the Git client is not installed or not accessible via the system's PATH. - Git-lfs: command not found: Suggests the Git LFS client is not installed or not in the PATH. - Repository not found: Typically means the provided Git URL is incorrect or the repository is inaccessible. - Couldn’t read Username: terminal prompts disabled: Occurs when authentication is required but terminal prompts are disabled. ``` -------------------------------- ### Relative and Absolute Positioning C# Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-uxml-examples Demonstrates how to use relative and absolute positioning techniques in C# to lay out UI elements within Unity's UI Toolkit. This example helps understand spatial arrangement and hierarchy. ```C# /* C# code for relative and absolute positioning example not provided in source text. */ /* Refer to UIE-relative-absolute-positioning-example.html for details. */ ``` -------------------------------- ### Unity Android Development Topics Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/android-sdksetup Key topics and resources for Android development within Unity, covering dependency management, version compatibility, customization, and tool references. ```APIDOC Related Android Development Topics in Unity: - Install dependencies: Guides on installing required Android development tools. - Supported dependency versions: Information on Unity's compatibility with specific Android SDK, NDK, and JDK versions. - Customize dependencies: Instructions for using custom versions of Android dependencies. - Android External Tools reference: Documentation for Android-specific settings within Unity's External Tools. - Set up the Android SDK Target API: Configuration for the Android SDK Target API level for Unity projects. ``` -------------------------------- ### Create Dedicated Server Build via Command Line Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/dedicated-server-build This example shows how to initiate a Dedicated Server build using the Unity command line interface by specifying the `-buildTarget` and the `-standaloneBuildSubtarget Server` arguments. ```bash -buildTarget Linux64 -standaloneBuildSubtarget Server ``` -------------------------------- ### Build AssetBundles and List Output Files (C# Example) Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/BuildPipeline.BuildAssetBundles Demonstrates building AssetBundles using BuildPipeline.BuildAssetBundles with a BuildAssetBundlesParameters object and then lists the generated output files. This example shows how to programmatically define bundles and their assets. ```C# using System.IO; using UnityEngine; using UnityEditor; public class BuildAssetBundlesOutputFileExample { [MenuItem("Example/AssetBundle Output File Example")] static void BuildAndPrintOutputFiles() { var bundleDefinitions = new AssetBundleBuild[] { new AssetBundleBuild { assetBundleName = "mybundle", assetNames = new string[] { "Assets/Scenes/Scene1.unity" } } }; string buildOutputDirectory = "build"; Directory.CreateDirectory(buildOutputDirectory); BuildAssetBundlesParameters buildInput = new() { outputPath = buildOutputDirectory, bundleDefinitions = bundleDefinitions }; AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(buildInput); if (manifest != null) { var outputFiles = Directory.EnumerateFiles(buildOutputDirectory, "*", SearchOption.TopDirectoryOnly); //Expected output (on Windows): // Output of the build: // build\build // build\build.manifest // build\mybundle // build\mybundle.manifest Debug.Log("Output of the build:\n\t" + string.Join("\n\t", outputFiles)); } } } ``` -------------------------------- ### Unity C# Example: Set Layer Culling Distances Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/Camera-layerCullDistances Demonstrates how to set per-layer culling distances for a Unity Camera component using a float array. This example shows how to get the Camera component, create a 32-element float array, assign a distance to a specific layer (layer 10), and apply it to the camera's `layerCullDistances` property. ```C# using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Start() { Camera camera = GetComponent(); float[] distances = new float[32]; distances[10] = 15; camera.layerCullDistances = distances; } } ``` -------------------------------- ### Using Unity Components Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/unity-components Explains the practical steps and methods for using components in Unity projects. ```APIDOC Topic: Use Components Description: How to use components. ``` -------------------------------- ### Windows OpenSSH Agent Setup (PowerShell) Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/upm-errors Ensures the ssh-agent service starts automatically and launches the agent process. This is crucial for managing SSH keys on Windows. ```PowerShell # Set the ssh-agent service to start automatically and manually start it now Get-Service ssh-agent | Set-Service -StartupType Automatic # Run the ssh-agent process to start the ssh-agent service ssh-agent ``` -------------------------------- ### Convert to URP or HDRP Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/render-pipelines-set-up Guides for converting Unity projects from the Built-In Render Pipeline to URP or HDRP. These involve using specific tools provided by Unity. ```APIDOC URP Render Pipeline Converter: Description: Tool to convert projects from Built-In Render Pipeline to URP. Reference: urp/features/rp-converter.html HDRP Pipeline Wizard: Description: Tool to convert projects from Built-In Render Pipeline to HDRP. Reference: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition%4017.0/manual/Render-Pipeline-Wizard.html ``` -------------------------------- ### Instantiate UXML with C# Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-UXML Provides an example of how to instantiate a UXML file using C# code in Unity. This allows for programmatic control over UI element creation and management. ```C# // Example of instantiating UXML with C# // This is a conceptual representation based on the description. using UnityEngine; using UnityEngine.UIElements; public class UxmlInstantiator : MonoBehaviour { public UIDocument uiDocument; public VisualTreeAsset myUxmlAsset; void Awake() { // Ensure a UIDocument is attached to this GameObject if (uiDocument == null) { uiDocument = GetComponent(); } // Instantiate the UXML asset and add it to the root visual element if (myUxmlAsset != null && uiDocument != null) { VisualElement instantiatedUxml = myUxmlAsset.Instantiate(); uiDocument.rootVisualElement.Add(instantiatedUxml); } } } ``` -------------------------------- ### Get All Asset Bundle Names Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/AssetDatabase.GetAllAssetBundleNames Demonstrates how to use AssetDatabase.GetAllAssetBundleNames() in Unity to retrieve and log all asset bundle names. This method is part of the UnityEditor namespace. ```C# using UnityEditor; using UnityEngine; public class GetAssetBundleNames { [MenuItem("Assets/Get Asset Bundle names")] static void GetNames() { var names = AssetDatabase.GetAllAssetBundleNames(); foreach (string name in names) Debug.Log("Asset Bundle: " + name); } } ``` -------------------------------- ### Git LFS Installation Check Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/upm-errors Command to verify if Git LFS is installed and accessible on your system. A successful output confirms Git LFS is ready for use. ```Git git lfs --version ``` ```Git Output Example git-lfs/2.8.0 (GitHub; darwin amd64; go 1.12.7) ``` -------------------------------- ### Drag-and-Drop List/TreeView Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-uxml-examples Shows how to implement drag-and-drop functionality for list and tree views between different windows using ListView, TreeView, and MultiColumnListView. ```C# /* C# code for drag-and-drop list/treeview example not provided in source text. */ /* Refer to UIE-create-drag-and-drop-list-treeview-between-windows.html for details. */ ``` -------------------------------- ### Enable standard user Unity installation Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/ent-unpriv-install Configures Unity Hub to allow standard users to install Unity Editors without elevated privileges by setting the 'hubDisableElevate' key to true within the services-config.json file. ```json { "hubDisableElevate": true } ``` -------------------------------- ### Unity Profiler C# Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/Profiling.Profiler.BeginSample A C# example demonstrating how to use `Profiler.BeginSample` and `Profiler.EndSample` to measure the execution time of a specific code block within Unity. ```C# using UnityEngine; using System.Collections; using UnityEngine.Profiling; public class ExampleClass : MonoBehaviour { void Example() { Profiler.BeginSample("MyPieceOfCode"); // Code to measure... Profiler.EndSample(); } } ``` -------------------------------- ### ListView and TreeView Examples Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-uxml-examples Provides examples for creating list and tree views using Unity's UI Toolkit. It covers ListView, TreeView, MultiColumnListView, and MultiColumnTreeView for displaying hierarchical or tabular data. ```C# /* C# code for ListView and TreeView examples not provided in source text. */ /* Refer to UIE-ListView-TreeView.html for details. */ ``` -------------------------------- ### Install XR Plug-in Management Package Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/xr-configure-providers Steps to install the XR Plug-in Management package via the Unity Editor's Project Settings window. This is a prerequisite for managing XR providers. ```APIDOC Access Project Settings: Menu: Edit > Project Settings Install XR Plug-in Management: 1. Select 'XR Plug-in Management' from the list of settings areas. 2. If necessary, click 'Install XR Plug-in Management'. Note: The XR Plug-in Management package can be installed directly from the Project Settings window. ``` -------------------------------- ### Configure Character List Container Properties Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIB-getting-started Sets up the container for the character list, including its name, size, spacing, background, and border styles. ```USS /* In the Inspector panel for the ListView element */ /* Naming */ name: CharacterList; /* Size properties */ width: 230px; /* Spacing properties */ margin-right: 6px; /* Appearance properties */ background-color: #6E3925; border-color: #311A11; border-width: 4px; border-radius: 15px; ``` -------------------------------- ### Native Audio Plugin SDK Project Locations Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/AudioNativePluginExamples Provides the file paths to the project solutions for native audio plugins, categorized by Integrated Development Environment (IDE). These paths allow developers to access and compile the example plug-in code. ```text IDE: Visual Studio Location: NativeAudioPlugins-master\NativeCode\VisualStudio\AudioPluginDemo.sln (Plug-in project) ``` ```text IDE: Visual Studio Location: NativeAudioPlugins-master\GUICode\AudioPluginDemoGUI\AudioPluginDemoGUI.sln (GUI project) ``` ```text IDE: XCode Location: NativeAudioPlugins-master\NativeCode\Xcode\AudioPluginDemo.xcodeproj ``` ```text IDE: UWP Location: NativeAudioPlugins-master\NativeCode\UWP\AudioPluginDemo.sln ``` -------------------------------- ### C# Style Guide for Unity Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/best-practice-guides Learn best practices for writing clean, scalable C# code in Unity. Covers naming conventions, formatting, and commenting to improve code readability and maintainability. ```APIDOC C# Style Guide: Purpose: To establish consistent coding standards for C# within Unity projects. Key Areas: - Naming Conventions: PascalCase for classes, methods, properties; camelCase for local variables and parameters. - Formatting: Consistent indentation, brace placement, and spacing. - Commenting: Clear and concise comments for complex logic, public APIs, and important decisions. Benefits: Improved readability, easier collaboration, reduced bugs, and enhanced maintainability. Example (Conceptual): // Method to calculate player score public int CalculatePlayerScore(int baseScore, int bonusPoints) { int totalScore = baseScore + bonusPoints; return totalScore; } ``` -------------------------------- ### Rigidbody MovePosition Example Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/ScriptReference/Rigidbody.MovePosition A C# script demonstrating how to use Rigidbody.MovePosition to move a Rigidbody component based on user input. It fetches the Rigidbody in Start and applies movement in FixedUpdate. ```C# using UnityEngine; public class Example : MonoBehaviour { Rigidbody m_Rigidbody; public float m_Speed = 5f; void Start() { //Fetch the Rigidbody from the GameObject with this script attached m_Rigidbody = GetComponent(); } void FixedUpdate() { //Store user input as a movement vector Vector3 m_Input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); //Apply the movement vector to the current position, which is //multiplied by deltaTime and speed for a smooth MovePosition m_Rigidbody.MovePosition(transform.position + m_Input * Time.fixedDeltaTime * m_Speed); } } ``` -------------------------------- ### TransitionExample UXML Structure Source: https://docs.unity3d.com/6000.0/Documentation/Manual/index.html/Manual/UIE-transition-event-example Defines the visual structure of the UI for the transition example using UXML. It includes buttons, visual elements for color changes, and labels to display event information. ```UXML