id
stringlengths
15
22
source
stringclasses
2 values
category
stringclasses
12 values
instruction
stringlengths
22
180
response
stringlengths
100
46.1k
system
stringclasses
5 values
local_man_f3565ac6c19f
unity_docs
rendering
Explain 'Create and assign a material' in Unity.
To create a new material asset in your project, from the main menu or the Project View context menu, select Assets > Create > Material . To assign a shader to the material asset, in the Inspector window use the Shader drop-down menu. ## Assign a material asset to a GameObject To render a GameObject using a material: ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_592f892f1d2a
unity_docs
editor
Show me a Unity C# example demonstrating `Build.IPostprocessBuildWithReport.OnPostprocessBuild`.
, such as the target platform and output path. Description Implement this function to receive a callback after the build is complete. This callback is invoked during Player builds, but not during AssetBundle builds. If the build stops early, due to a failure or cancellation, then the callback is not invoked. ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_6397a9283b91
unity_docs
math
What is `Mathf.Sqrt` in Unity? Explain its purpose and usage.
Mathf.Sqrt Declaration public static float Sqrt (float f ); Description Returns square root of f . ```csharp using UnityEngine; using System.Collections;public class ExampleClass : MonoBehaviour { // The formula made famous by Pythagoras, also used internally by // Vector3.Distance and several other standa...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_fc61215ffc99
unity_docs
rendering
What is `Renderer.localToWorldMatrix` in Unity? Explain its purpose and usage.
Renderer.localToWorldMatrix public Matrix4x4 localToWorldMatrix ; Description Matrix that transforms a point from local space into world space (Read Only). Use this matrix for shader parameters and calculations related to rendering instead of Transform.localToWorldMatrix . The matrix from the Transform compo...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_fc7ed723c3de
unity_docs
rendering
What is `Camera.AddCommandBuffer` in Unity? Explain its purpose and usage.
Camera.AddCommandBuffer Declaration public void AddCommandBuffer ( Rendering.CameraEvent evt , Rendering.CommandBuffer buffer ); Parameters Parameter Description evt When to execute the command buffer during rendering. buffer The buffer to execute. Description Add a command buffer to be executed at ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_869c8b366e87
unity_docs
editor
What is `EditorGUILayout.BeginHorizontal` in Unity? Explain its purpose and usage.
EditorGUILayout.BeginHorizontal Declaration public static Rect BeginHorizontal (params GUILayoutOption[] options ); Declaration public static Rect BeginHorizontal ( GUIStyle style , params GUILayoutOption[] options ); Parameters Parameter Description style Optional GUIStyle . options An optiona...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_666aac60e692
unity_docs
rendering
What is `ParticleSystem.ShapeModule.useMeshMaterialIndex` in Unity? Explain its purpose and usage.
ParticleSystem.ShapeModule.useMeshMaterialIndex public bool useMeshMaterialIndex ; Description Emit particles from a single Material, or the whole Mesh. Additional resources: ParticleSystem.ShapeModule.shapeType .
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_fd5b84cac17d
unity_docs
rendering
Explain 'Respond to events with custom controls' in Unity.
If you’re implementing custom controls , you can respond to UI Toolkit events in the following ways: Register an event callback Override the HandleEventBubbleUp or HandleEventTrickleDown virtual methods Your response to events depends on the situation. The following are the differences between callbacks and virtual met...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_9ef53204d693
unity_docs
rendering
What is `CameraClearFlags` in Unity? Explain its purpose and usage.
CameraClearFlags enumeration Description Values for Camera.clearFlags, determining what to clear when rendering a Camera . Additional resources: camera component . Properties Property Description Skybox Clear with the skybox. SolidColor Clear with a background color. Depth Clear only the depth buffer. Not...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_360ba9c66edb
unity_docs
ui
In Unity's 'Extending IMGUI', what is 'Elaborate Compound Controls' and how does it work?
You can get very creative with Compound Controls. They can be arranged and grouped in any way you like. The following example creates a re-usable RGB Slider. ```csharp // RGB Slider Compound Control using UnityEngine; using System.Collections; public class GUITest : MonoBehaviour { public Color myColor; void On...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_15dab5026e56
unity_docs
scripting
What is `Rendering.RenderPipelineManager.endFrameRendering` in Unity? Explain its purpose and usage.
RenderPipelineManager.endFrameRendering Description Delegate that you can use to invoke custom code at the end of RenderPipeline.Render . This delegate is replaced by RenderPipelineManager.endContextRendering . It is supported and documented for backwards compatibility only. When Unity calls RenderPipeline.EndFr...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_10411334f877
unity_docs
editor
Show me a Unity C# example demonstrating `iOS.Xcode.PBXProject.AddFrameworksBuildPhase`.
The GUID of the target, such as the one returned by TargetGuidByName . Returns string Returns the GUID of the new phase. Description Creates a new frameworks build phase for given target. If the frameworks build phase is already configured for the target, the function returns the existing phase. The new phase...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_5988aa66917f
unity_docs
scripting
What is `Playables.PlayableGraph.SetTimeUpdateMode` in Unity? Explain its purpose and usage.
PlayableGraph.SetTimeUpdateMode Declaration public void SetTimeUpdateMode ( Playables.DirectorUpdateMode value ); Parameters Parameter Description value The new DirectorUpdateMode . Description Changes how time is incremented when playing back.
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_2a52164554fb
unity_docs
editor
Show me a Unity C# example demonstrating `TestTools.Coverage.enabled`.
Coverage.enabled public static bool enabled ; Returns bool Returns true if code coverage is enabled; otherwise, returns false. Description Enables or disables code coverage. Note that Code Coverage can affect the performance. ```csharp // Create a new C# script called CodeCoverageMenuItem and place it und...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_22e70ea48b67
unity_docs
rendering
In Unity's 'Introduction to mipmap streaming', what is 'How mipmap streaming works' and how does it work?
For each texture in the camera view, Unity automatically calculates and loads mipmap levels only up to a specific level, instead of loading all of them. This means that Unity only transfers some mipmap levels per texture from disk to the CPU and the GPU. Unity loads mipmap levels at the highest resolution possible, but...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_5531b988ac91
unity_docs
rendering
What is `Rendering.RendererUtils.RendererListDesc.rendererConfiguration` in Unity? Explain its purpose and usage.
RendererListDesc.rendererConfiguration public Rendering.PerObjectData rendererConfiguration ; Description The renderer configuration for the RendererList. For more information, see PerObjectData .
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_c740704781f0
unity_docs
rendering
What is `Windows.WebCam.PhotoCapture.StartPhotoModeAsync` in Unity? Explain its purpose and usage.
PhotoCapture.StartPhotoModeAsync Declaration public void StartPhotoModeAsync ( Windows.WebCam.CameraParameters setupParams , Windows.WebCam.PhotoCapture.OnPhotoModeStartedCallback onPhotoModeStartedCallback ); Parameters Parameter Description setupParams The various settings that should be applied to the...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_e186c08e3ecb
unity_docs
rendering
What is `ComputeBufferType.Raw` in Unity? Explain its purpose and usage.
ComputeBufferType.Raw Description Raw ComputeBuffer type (byte address buffer). In HLSL shaders, this maps to ByteAddressBuffer or RWByteAddressBuffer . Underlying DX11 format for shader access is typeless R32. See Microsoft's HLSL documentation on ByteAddressBuffer and RWByteAddressBuffer . Additional reso...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_ef4720b288c5
unity_docs
rendering
What is `AssetPostprocessor.OnPostprocessTexture2DArray` in Unity? Explain its purpose and usage.
AssetPostprocessor.OnPostprocessTexture(Texture2DArray) Description Add this function to a subclass to get a notification when a texture2DArray has completed importing just before Unity compresses it. You can't choose a compression format at this point. If you want to change compression format based on filename or...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_78088f8582d4
unity_docs
editor
In Unity's 'Add tests to a package', what is 'Location of test files' and how does it work?
You can add your test files to the Tests folder of your package in the Editor and Runtime subfolders. For example, a simple package with tests might look something like this: ``` <package-root> ├── package.json ├── Editor │ ├── <company-name>.<package-name>.Editor.asmdef │ └── EditorExample.cs ├── Runtime │ ├── <...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_c563fbc23b03
unity_docs
scripting
Show me a Unity C# example demonstrating `GameObject.activeInHierarchy`.
object and all parent objects. A GameObject is not active in the scene hierarchy if GameObject.activeSelf is false for a parent object, even if GameObject.activeSelf is true for the object itself. GameObject.activeInHierarchy changing to false triggers MonoBehaviour.OnDisable for attached scripts. GameObj...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_81d8edbb80ba
unity_docs
animation
What is `Tilemaps.Tilemap.GetAnimationTime` in Unity? Explain its purpose and usage.
Tilemap.GetAnimationTime Declaration public float GetAnimationTime ( Vector3Int position ); Parameters Parameter Description position Grid cell position. Returns float Returns the running animation time in seconds. Description Retrieves the current running animation time for a Tile at the given posi...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
gh_4537818d0785_doc_10
github
scripting
What does `OnDisable` do in this Unity script? Explain its purpose and signature.
Performs general teardown for the interactable and disconnects the scale reset event. Signature: ```csharp protected override void OnDisable() ```
You are a senior Unity engineer. Answer questions about Unity scripting, XR/VR development, and game systems with working code examples.
gh_02e8dd62f2b3_doc_6
github
scripting
What does `SetActiveNewEntry` do in this Unity script? Explain its purpose and signature.
Activates the 'new entry' editor for a specified control.Context of the editable entry. Signature: ```csharp public static void SetActiveNewEntry(IEditableOrderedDictionaryContext context) ```
You are a senior Unity engineer. Answer questions about Unity scripting, XR/VR development, and game systems with working code examples.
local_sr_967ff0aa2ab6
unity_docs
editor
What is `AssetDatabase.GetAssetPathsFromAssetBundle` in Unity? Explain its purpose and usage.
AssetDatabase.GetAssetPathsFromAssetBundle Declaration public static string[] GetAssetPathsFromAssetBundle (string assetBundleName ); Parameters Parameter Description assetBundleName The name of the AssetBundle. Description Returns an array containing the paths of all assets marked with the specified Asset...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_e31b6cb06703
unity_docs
rendering
What are the parameters of `Graphics.DrawProcedural` in Unity?
Description This function is now obsolete. For non-indexed rendering, use Graphics.RenderPrimitives instead. For indexed rendering, use Graphics.RenderPrimitivesIndexed . Draws procedural geometry on the GPU. This function is now obsolete. For non-indexed rendering, use RenderPrimitives instead. For indexed rendering, ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_30127e412ab4
unity_docs
rendering
In Unity's 'Introduction to importing assets', what is 'Modifying asset files' and how does it work?
When you modify a file in Unity, Unity doesn’t modify your original source file. Instead, the import process reads your source file, and creates a representation of your asset internally, which matches your chosen import settings . If you modify the import settings for an asset, or make a change to the source file in t...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_c56c2eebad08
unity_docs
math
What is `AndroidJNI.CallDoubleMethod` in Unity? Explain its purpose and usage.
AndroidJNI.CallDoubleMethod Declaration public static double CallDoubleMethod (IntPtr obj , IntPtr methodID , jvalue[] args ); Description Calls a Java instance method defined by methodID , optionally passing an array of arguments ( args ) to the method. Additional resources: Java Native Interface Specific...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_8e0ceda0986f
unity_docs
scripting
Explain 'Check or find a rendering event' in Unity.
The Event Hierarchy panel in the Frame Debugger window displays the sequence of rendering events that constitute the frame. The panel organizes the events into a hierarchy so you can see where each event originates from. To view information about an event, select the event in the Event Hierarchy. When you select an eve...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_319bfa62061c
unity_docs
editor
Show me a Unity C# example demonstrating `EditorPrefs.DeleteKey`.
EditorPrefs.DeleteKey Declaration public static void DeleteKey (string key ); Description Removes key and its corresponding value from the preferences. Removes a user entered editor preference, if it doesnt exists it prints a message. ```csharp // Removes a user entered editor preference. // If it does not ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_0a1c6a50a750
unity_docs
scripting
What is `UIElements.BaseTreeViewController.GetRootItemIds` in Unity? Explain its purpose and usage.
BaseTreeViewController.GetRootItemIds Declaration public IEnumerable<int> GetRootItemIds (); Returns IEnumerable<int> The root item IDs. Description Returns the root items of the tree, by IDs.
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_01209d9e6b3c
unity_docs
scripting
What is `VersionControl.Task.resultCode` in Unity? Explain its purpose and usage.
Task.resultCode public int resultCode ; Description Some task return result codes, these are stored here. Depending on the task the result code will map to either an AssetDeleteResult, AssetMoveResult or SubmitResult.
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_8a20e08e1168
unity_docs
scripting
Show me a Unity C# example demonstrating `RigidbodyConstraints.None`.
RigidbodyConstraints.None Description No constraints. ```csharp //This example shows how RigidbodyConstraints is used to freeze the position and rotation of a Rigidbody in the z axis at start-up. //It also shows what happens when these constraints are removed, when you press the space key //Attach this to a GameObj...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_0bda30b72158
unity_docs
performance
What is `Unity.Jobs.JobHandle.CompleteAll` in Unity? Explain its purpose and usage.
JobHandle.CompleteAll Declaration public static void CompleteAll (ref Unity.Jobs.JobHandle job0 , ref Unity.Jobs.JobHandle job1 ); Declaration public static void CompleteAll (ref Unity.Jobs.JobHandle job0 , ref Unity.Jobs.JobHandle job1 , ref Unity.Jobs.JobHandle job2 ); Declaration public stat...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_ee4bd9543114
unity_docs
editor
What is `SceneManagement.OpenSceneMode` in Unity? Explain its purpose and usage.
OpenSceneMode enumeration Description Used when opening a Scene in the Editor to specify how a Scene should be opened. Additional resources: EditorSceneManager.OpenScene . Properties Property Description Single Closes all current open Scenes and loads a Scene. Additive Adds a Scene to the current open Scenes...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
gh_7db3c8d362c7
github
scripting
Write a Unity C# script called Angular Font Height Button
```csharp using UnityEngine.UIElements; namespace UIToolkitXRAdapter.AngularResizing.FontHeightOnlyTextElements { public sealed class AngularFontHeightButton : Button, IAngularFontHeightTextElement<AngularFontHeightButton> { // ReSharper disable once MemberCanBePrivate.Global // ReSharper dis...
You are an experienced Unity developer specializing in C# scripting, XR/VR development, and performance optimization.
local_sr_cedbde178bcb
unity_docs
editor
What is `PlayerSettings.SetPreloadedAssets` in Unity? Explain its purpose and usage.
PlayerSettings.SetPreloadedAssets Declaration public static void SetPreloadedAssets (Object[] assets ); Description Assigns the assets that will be loaded at start up in the player and be kept alive until the player terminates. This example shows how a ScriptableObject can be used to store data that can be ac...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_ed2208eac71c
unity_docs
input
What is `PointerType` in Unity? Explain its purpose and usage.
PointerType enumeration Description Pointer types. Properties Property Description Mouse The pointer type for mouse events. Touch The pointer type for touch events. Pen The pointer type for pen events.
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_4c2d3958902f
unity_docs
rendering
What is `MeshPreview.RenderStaticPreview` in Unity? Explain its purpose and usage.
MeshPreview.RenderStaticPreview Declaration public Texture2D RenderStaticPreview (int width , int height ); Parameters Parameter Description width The width to render the texture. height The height to render the texture. Returns Texture2D Returns a rendered texture of the current mesh with default s...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_a6c7d93505d9
unity_docs
rendering
Explain 'Set the culling mode in a shader' in Unity.
Culling is the process of determining what not to draw. Culling improves rendering efficiency, by not wasting GPU time drawing things that would not be visible in the final image. By default, the GPU performs back-face culling; this means that it does not draw polygons that face away from the viewer. In general, the mo...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_a09c1afbbd56
unity_docs
scripting
What is `RuntimePlatform.Android` in Unity? Explain its purpose and usage.
RuntimePlatform.Android Description In the player on Android devices. Additional resources: RuntimePlatform , Platform dependent compilation . ```csharp using UnityEngine;public class Example : MonoBehaviour { void Start() { if (Application.platform == RuntimePlatform.Android) { Debug.Log("Do something spec...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_df28f0c75274
unity_docs
scripting
Show me a Unity C# example demonstrating `RuntimePlatform.PS4`.
RuntimePlatform.PS4 Description In the player on the Playstation 4. Additional resources: RuntimePlatform , Platform dependent compilation . ```csharp using UnityEngine;public class Example : MonoBehaviour { void Start() { if (Application.platform == RuntimePlatform.PS4) { Debug.Log("Do something special he...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_b04026ec6784
unity_docs
rendering
What is `SpeedTreeImporter.defaultBillboardShader` in Unity? Explain its purpose and usage.
SpeedTreeImporter.defaultBillboardShader public Shader defaultBillboardShader ; Description Returns the default SpeedTree billboard shader for the active render pipeline, or null if the asset is a SpeedTree v8 asset.
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_ff4d36028ece
unity_docs
physics
What is `ArticulationBody.maxJointVelocity` in Unity? Explain its purpose and usage.
ArticulationBody.maxJointVelocity public float maxJointVelocity ; Description The maximum joint velocity of the articulation body joint in reduced coordinates. This value is applied to the body before the simulation step. This means that after the simulation frame the velocity might exceed the set maximum. To ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_1e2d8e22a444
unity_docs
performance
What is `Profiling.RawFrameDataView.GetSampleStartTimeMs` in Unity? Explain its purpose and usage.
RawFrameDataView.GetSampleStartTimeMs Declaration public double GetSampleStartTimeMs (int sampleIndex ); Parameters Parameter Description sampleIndex Index of the Profiler sample. Returns double Returns sample start time in milliseconds. Description Gets the start time of the sample. The amount of ti...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_6eefa0426bd2
unity_docs
rendering
What is `LightTransport.ReferenceContext.CreateBuffer` in Unity? Explain its purpose and usage.
ReferenceContext.CreateBuffer Declaration public LightTransport.BufferID CreateBuffer (ulong count , ulong stride ); Parameters Parameter Description count Number of elements in the buffer. stride Stride of the buffer in bytes. Returns BufferID ID of the newly created buffer. Description Create ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
gh_2c0fba70b993_doc_3
github
scripting
What does `InitInternal` do in this Unity script? Explain its purpose and signature.
Identical to , but non-virtual, so slightly faster. Signature: ```csharp internal void InitInternal(TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, T...
You are a knowledgeable Unity developer. Explain Unity concepts clearly and provide practical, tested code examples.
local_sr_7e840944fed9
unity_docs
scripting
What is `Unity.Properties.PropertyContainer.IsPathValid` in Unity? Explain its purpose and usage.
PropertyContainer.IsPathValid Declaration public static bool IsPathValid (TContainer container , string path ); Parameters Parameter Description container The container tree to search. path The property path to resolve. Returns bool true if a property can be found at path. Description Returns tr...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
gh_35f8fb3212ea_doc_4
github
scripting
What does `OnSelect` do in this Unity script? Explain its purpose and signature.
Override select behavior to prevent unwanted "selected" state by default.The selected state can interfere with button behavior in VR/XR contexts. Signature: ```csharp public override void OnSelect(BaseEventData eventData) ```
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_e2e0f40a78d6
unity_docs
scripting
What is `UIElements.Columns.Contains` in Unity? Explain its purpose and usage.
Columns.Contains Declaration public bool Contains (string name ); Parameters Parameter Description name The name of the column to look for. Returns bool Whether a column with the given name exists or not. Description Whether the columns contain the specified name.
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_7ad48fe4c180
unity_docs
rendering
In Unity's 'Create a quad mesh via script', what is 'Normals' and how does it work?
A Mesh with vertices and triangles is visible in the Scene, but Unity does not shade it correctly because it has no normals yet. The normals for this example are simple because they are all identical. Every normal points in the negative z-axis direction in the quad’s local space. When you add the normals, Unity correct...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_d614c78519a7
unity_docs
scripting
What is `SerializedProperty.ulongValue` in Unity? Explain its purpose and usage.
SerializedProperty.ulongValue public ulong ulongValue ; Description Value of an integer property as an unsigned long. Contains a valid value when propertyType is SerializedPropertyType.Integer . Suitable for accessing values when numericType is SerializedPropertyNumericType.UInt64 , and also supports sma...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_944144e20c9e
unity_docs
rendering
In Unity's 'How Unity compiles branching shaders', what is 'Dynamic branching' and how does it work?
To use dynamic branching, use #pragma dynamic_branch to declare keywords. For example: ``` #pragma dynamic_branch RED GREEN ... if (RED) { // Output red } else if (GREEN) { // Output green } ``` At compile time, Unity converts each keyword into a uniform integer variable in the compiled shader code, which can have ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_a156eddd74d4
unity_docs
scripting
Show me a Unity C# example demonstrating `GameObject.FindWithTag`.
ust be declared in the tag manager before using them. A UnityException is thrown if the tag does not exist or if an empty string or null is supplied as the tag parameter. Note: This method returns the first GameObject it finds with the specified tag. If a scene contains multiple active GameObjects with the speci...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_6d6842f52cae
unity_docs
rendering
In Unity's 'Transparent Vertex-Lit', what is 'Vertex-Lit Properties' and how does it work?
Note. Unity 5 introduced the Standard Shader which replaces this shader. This shader is Vertex-Lit , which is one of the simplest shaders. All lights shining on it are rendered in a single pass and calculated at vertices only. Because it is vertex-lit, it won’t display any pixel-based rendering effects, such as light c...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_ef0258a2a256
unity_docs
editor
What is `EditorGUILayout.IntField` in Unity? Explain its purpose and usage.
EditorGUILayout.IntField Declaration public static int IntField (int value , params GUILayoutOption[] options ); Declaration public static int IntField (int value , GUIStyle style , params GUILayoutOption[] options ); Declaration public static int IntField (string label , int value , params GUILayou...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_07bd47ba34a8
unity_docs
editor
What is `PlayerSettings.Android.defaultWindowWidth` in Unity? Explain its purpose and usage.
PlayerSettings.Android.defaultWindowWidth public static int defaultWindowWidth ; Description The default horizontal size of the Android Player window in pixels. On Android phones and tablets that support multiple windows, this controls the width of the window when in the popup window mode. ```csharp using Uni...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
gh_10d2b6d409c1
github
scripting
Write a Unity C# MonoBehaviour script called Character Behaviour
```csharp using UnityEngine; [RequireComponent(typeof(Character))] abstract class CharacterBehaviour : MonoBehaviour { public Character character => _character; protected Character _character; public virtual void OnCharacterCreate(Character character, CharacterInitializer initializer) { _chara...
You are a senior Unity engineer. Answer questions about Unity scripting, XR/VR development, and game systems with working code examples.
local_sr_4e0844b9314c
unity_docs
math
What is `UIElements.Painter2D.ArcTo` in Unity? Explain its purpose and usage.
Painter2D.ArcTo Declaration public void ArcTo ( Vector2 p1 , Vector2 p2 , float radius ); Parameters Parameter Description p1 The first control point of the arc. p2 The final point of the arc. radius The radius of the arc. Description Adds an arc to the current sub-path to the provided position u...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_d9f58ea4a036
unity_docs
audio
What is `AudioSource.minDistance` in Unity? Explain its purpose and usage.
AudioSource.minDistance public float minDistance ; Description Within the Min distance the AudioSource will cease to grow louder in volume. Outside the min distance the volume starts to attenuate.
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_97487b484b41
unity_docs
rendering
Explain 'DOTS Instancing shader functions reference for URP' in Unity.
Alongside the access macros, Unity provides shader functions that load the values of constants directly from the draw command data. Shaders that Unity provides use these functions. Unity provides the following shader functions: Shader function Description LoadDOTSInstancedData_RenderingLayer Returns the renderingLayerM...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_1446eae0cd1f
unity_docs
physics
What is `Rigidbody.excludeLayers` in Unity? Explain its purpose and usage.
Rigidbody.excludeLayers public LayerMask excludeLayers ; Description The additional layers that all Collider s attached to this Rigidbody should exclude when deciding if the Collider can come into contact with another Collider . The Layer Collision Matrix defines which layers can and cannot contact oth...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_d8d1323ede5b
unity_docs
scripting
What is `Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.GetAllowReadOrWriteAccess` in Unity? Explain its purpose and usage.
AtomicSafetyHandle.GetAllowReadOrWriteAccess Declaration public static bool GetAllowReadOrWriteAccess ( Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle ); Parameters Parameter Description handle The AtomicSafetyHandle to check. Returns bool True if the AtomicSafetyHandle is configured to a...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_63ec46cda3d1
unity_docs
scripting
Show me a Unity C# example demonstrating `Event.button`.
Event.button public int button ; Description Which mouse button was pressed. 0 means left mouse button, 1 means right mouse button, 2 means middle mouse button. Used in EventType.MouseDown and EventType.MouseUp events. ```csharp using UnityEngine;public class Example : MonoBehaviour { // Detect which mous...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_76330d4b3d80
unity_docs
scripting
What is `QualitySettings.ForEach` in Unity? Explain its purpose and usage.
QualitySettings.ForEach Declaration public static void ForEach ( Unity.Android.Gradle.Manifest.Action callback ); Declaration public static void ForEach (Action<int,string> callback ); Parameters Parameter Description callback The callback to execute for each level. Description Executes the given A...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_ee9ba70c08e5
unity_docs
rendering
In Unity's 'Set up multiple scenes', what is 'Loaded scene More menu (⋮)' and how does it work?
You can interact with and edit a loaded scene in several ways. Setting Description Set Active Scene Sets the scene as the target for new GameObjects created through scripts . For more information, see SceneManager.SetActiveScene . Save Scene Saves the scene that you selected. Save Scene As Opens your file browser so yo...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_24964b19b45a
unity_docs
performance
Explain 'Customizing the Profiler' in Unity.
Add custom profiling information to your code and create custom Profiler modules to visualize the data. Topic Description Create custom Profiler modules Build custom Profiler modules to display performance data and visualizations for your project’s specific needs. Adding profiling information to your code Instrument yo...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_b01286eb47f2
unity_docs
rendering
Explain 'Supported asset type reference' in Unity.
Unity supports many different types of assets and most common image file types. It uses asset importers to process and convert external files into assets you can use in your project. Unity supports the following kinds of files: 3D model files : Unity supports standard and proprietary model file formats. Internally, Uni...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_db2107f81acb
unity_docs
rendering
Give me an overview of the `RenderTextureDescriptor` class in Unity.
RenderTextureDescriptor struct in UnityEngine / Implemented in: UnityEngine.CoreModule Description This struct contains all the information required to create a RenderTexture. It can be copied, cached, and reused to easily create RenderTextures that all share the same properties. Avoid using the default construc...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_d84f4b741770
unity_docs
scripting
What is `Gyroscope.attitude` in Unity? Explain its purpose and usage.
Gyroscope.attitude public Quaternion attitude ; Description Returns the attitude (ie, orientation in space) of the device. ```csharp using UnityEngine;public class Example : MonoBehaviour { // Rotate the object to match the device's orientation // in space. void Update() { transform.rotation = Input.gyro...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_80b8cdd88e2d
unity_docs
scripting
What is `Unity.Hierarchy.HierarchySearchFilterOperator` in Unity? Explain its purpose and usage.
HierarchySearchFilterOperator enumeration Description Represents options for search filter operators. A colon (:) is the "contains" operator. A "-" is a "not" operator. Properties Property Description Equal Checks if a filter value is equal to the right-hand operand. Contains Checks if a filter value ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_e2fcf2f8aea3
unity_docs
editor
What is `SearchService.SearchEngineScope` in Unity? Explain its purpose and usage.
SearchEngineScope enumeration Description An enumeration that contains the available search engine scopes. A search engine scope identifies where a search comes from. This is useful when implementing a single entry point for the base engine functions: ```csharp using System; using System.Collections.Generic; usin...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_25435e466fd5
unity_docs
scripting
What is `LowLevel.PlayerLoopSystem.updateFunction` in Unity? Explain its purpose and usage.
PlayerLoopSystem.updateFunction public IntPtr updateFunction ; Description A native engine system. To get a valid value for this, you must copy it from one of the PlayerLoopSystems returned by GetDefaultPlayerLoop.
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_b1f7b08bd5e9
unity_docs
rendering
What is `Texture2D.SetPixel` in Unity? Explain its purpose and usage.
Texture2D.SetPixel Declaration public void SetPixel (int x , int y , Color color , int mipLevel = 0); Parameters Parameter Description x The x coordinate of the pixel to set. The range is 0 through (texture width - 1). y The y coordinate of the pixel to set. The range is 0 through (texture height...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_9d557d16e365
unity_docs
rendering
What is `EditorWindow.autoRepaintOnSceneChange` in Unity? Explain its purpose and usage.
EditorWindow.autoRepaintOnSceneChange public bool autoRepaintOnSceneChange ; Description Enable this property to automatically repaint the window when the SceneView is modified. Editor Window that renders what the main camera is "seeing". ```csharp // Simple script that lets you render the main camera in an ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_42bf87a03005
unity_docs
scripting
What is `AndroidJNI.SetStaticSByteField` in Unity? Explain its purpose and usage.
AndroidJNI.SetStaticSByteField Declaration public static void SetStaticSByteField (IntPtr clazz , IntPtr fieldID , sbyte val ); Description Sets the value of a static field in the specified object. Additional resources: Java Native Interface Specification (Oracle)
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_f4c73328d7b5
unity_docs
scripting
What are the parameters of `Camera.WorldToViewportPoint` in Unity?
Description Transforms position from world space into viewport space. Viewport space is normalized and relative to the camera. The bottom-left of the camera is (0,0); the top-right is (1,1). The z position is in world units from the camera. ```csharp // Finds out whether target is on the left or right side of the scree...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_ceb4fa11b88c
unity_docs
scripting
What is `GeometryUtility.TestPlanesAABB` in Unity? Explain its purpose and usage.
GeometryUtility.TestPlanesAABB Declaration public static bool TestPlanesAABB (Plane[] planes , Bounds bounds ); Description Returns true if bounds are inside the plane array. Will return true if the bounding box is inside the planes or intersects any of the planes. The TestPlanesAABB function uses the Plane...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_f2ce714bd2fb
unity_docs
scripting
Show me a Unity C# example demonstrating `Rigidbody.OnCollisionEnter`.
mation about contact points, impact velocity etc. If you don't use collisionInfo in the function, leave out the collisionInfo parameter as this avoids unneccessary calculations. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to di...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_6fe99c52ca4f
unity_docs
rendering
In Unity's 'Reflection Probe Inspector window reference', what is 'Cubemap Capture Settings' and how does it work?
Property Description Resolution The resolution of the captured reflection image. HDR Should High Dynamic Range rendering be enabled for the cubemap? This also determines whether probe data is saved in OpenEXR or PNG format. Shadow Distance Distance at which shadows are drawn when rendering the probe. Clear Flags Option...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_17f0e68e4026
unity_docs
scripting
What is `Undo.willFlushUndoRecord` in Unity? Explain its purpose and usage.
Undo.willFlushUndoRecord public static Undo.WillFlushUndoRecord willFlushUndoRecord ; Description Invoked before the Undo system performs a flush. Additional resources: FlushUndoRecordObjects .
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_db2f6d7e4197
unity_docs
editor
Show me a Unity C# example demonstrating `iOS.Xcode.PBXProject`.
PBXProject class in UnityEditor.iOS.Xcode Description Represents an Xcode project (pbxproj file). ```csharp using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using UnityEditor; using UnityEditor.Callbacks; using UnityEditor.iOS.Xcode;public class Sample_PBXProject { ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_2e1c89cb1a14
unity_docs
editor
What are the parameters of `iOS.Xcode.PBXProject.GetCopyFilesBuildPhaseByTarget` in Unity?
Returns string Returns the GUID of the matching phase or null if it does not exist. Description Returns the GUID of matching copy files build phase for the given target. The parameters of existing copy files build phase are matched to the arguments of this function and the GUID of the phase is returned only if a matchi...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_de9ff0194a5b
unity_docs
physics
What is `CharacterController.OnControllerColliderHit` in Unity? Explain its purpose and usage.
CharacterController.OnControllerColliderHit(ControllerColliderHit) Description OnControllerColliderHit is called when the controller hits a collider while performing a Move. This can be used to push objects when they collide with the character. ```csharp using UnityEngine;public class Example : MonoBehaviour { /...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_69dc491e198e
unity_docs
scripting
What is `Actions.ContextMenuUtility.AddClipboardEntriesTo` in Unity? Explain its purpose and usage.
ContextMenuUtility.AddClipboardEntriesTo Declaration public static void AddClipboardEntriesTo ( UIElements.DropdownMenu menu ); Declaration public static void AddClipboardEntriesTo ( UIElements.DropdownMenu menu , bool cutEnabled , bool copyEnabled , bool pasteEnabled , bool duplicateEnabled , bool dele...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_b85bcf1809bc
unity_docs
animation
What is `Playables.PlayableBinding.outputTargetType` in Unity? Explain its purpose and usage.
PlayableBinding.outputTargetType public Type outputTargetType ; Description The type of target required by the PlayableOutput for this PlayableBinding. For example, the AnimationPlayableBinding.Create method returns a PlayableBinding where the outputTargetType is typeof(Animator). If the binding represents ...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_5e297fee3f5a
unity_docs
rendering
In Unity's 'Error and loading shaders', what is 'The loading shader' and how does it work?
Unity renders an object with the loading shader to indicate that Unity is compiling the shader variant needed to display that object. Unity shows the loading shader in the Unity Editor when asynchronous shader compilation is enabled, or in a development build when Shader Live Link support is enabled. The loading shader...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_7a960240a615
unity_docs
physics
Show me a Unity C# example demonstrating `RaycastHit.textureCoord`.
he collision location. A ray is fired into the Scene. The textureCoord is the location where the ray has hit a collider. RaycastHit._textureCoord is a texture coordinate when a hit occurs. A Vector2 zero is returned if no mesh collider is present in the GameObject . This property can be accessed off the main...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_039f283cea27
unity_docs
rendering
What is `Tilemaps.TilemapRenderer.DetectChunkCullingBounds` in Unity? Explain its purpose and usage.
DetectChunkCullingBounds enumeration Description Returns whether the TilemapRenderer automatically detects the bounds to extend chunk culling by. Properties Property Description Auto The TilemapRenderer will automatically detect the bounds of extension by inspecting the Sprite/s used in the Tilemap. Manual T...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_0404f533236d
unity_docs
scripting
What is `Accessibility.AccessibilityNode.frame` in Unity? Explain its purpose and usage.
AccessibilityNode.frame public Rect frame ; Description The Rect represents the position in screen coordinates of the node in the UI. This can be set directly but it is recommended that frameGetter is set instead, so that the value can be recalculated when necessary. If AccessibilityHierarchy.RefreshN...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
gh_0bd14c82be16
github
scripting
Write a Unity C# MonoBehaviour script called Persistent Singleton
```csharp using UnityEngine; namespace BcoffeeDev.Patterns { public class PersistentSingleton<T> : MonoBehaviour where T : MonoBehaviour { private static T _instance; public static T Instance { get { if (_instance != null) ...
You are a knowledgeable Unity developer. Explain Unity concepts clearly and provide practical, tested code examples.
local_sr_8dbe17e37244
unity_docs
performance
What is `Unity.Profiling.LowLevel.Unsafe.ProfilerUnsafeUtility.GetCategoryDescription` in Unity? Explain its purpose and usage.
ProfilerUnsafeUtility.GetCategoryDescription Declaration public static Unity.Profiling.LowLevel.Unsafe.ProfilerCategoryDescription GetCategoryDescription (ushort categoryId ); Parameters Parameter Description categoryId Profiler category identifier. Returns ProfilerCategoryDescription Returns descripti...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_ca8f8b3a94e0
unity_docs
xr
What is `Playables.PlayableTraversalMode` in Unity? Explain its purpose and usage.
PlayableTraversalMode enumeration Description Traversal mode for Playable s. Properties Property Description Mix Causes the Playable to prepare and process it's inputs when demanded by an output. Passthrough Causes the Playable to act as a passthrough for PrepareFrame and ProcessFrame. If the PlayableOutput b...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_15ad7bb806f8
unity_docs
rendering
Explain 'Comparison of UI systems in Unity' in Unity.
UI Toolkit is intended to become the recommended UI system for you to develop UI in your projects. However, in its current release, UI Toolkit does not have some features that uGUI (Unity UI) and IMGUI (Immediate Mode GUI) support. uGUI and IMGUI are more appropriate for certain use cases, and are required to support l...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_12300c5a45c4
unity_docs
rendering
In Unity's 'Quality settings tab reference', what is 'Quality levels matrix' and how does it work?
Property Description Levels Lists the quality levels in the project, and the platforms they apply to when Unity builds your project. To make a quality level active in the Editor and the configuration section, select it to highlight it. To apply a quality level to a build platform, enable the checkbox under the platform...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_e146db3a9fc7
unity_docs
editor
What are the parameters of `AssetDatabase.ImportPackage` in Unity?
Description Imports the package at packagePath into the current project. ```csharp using UnityEditor; using UnityEngine;public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/Import Package Example")] static void ImportPackageExample() { var texturePackageNames = new[] {"groun...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_920ea381a44e
unity_docs
rendering
What is `TerrainHeightmapSyncControl` in Unity? Explain its purpose and usage.
TerrainHeightmapSyncControl enumeration Description Controls what Terrain heightmap data to synchronize when there are changes to the heightmap texture. Additional resources: TerrainData.CopyActiveRenderTextureToHeightmap , TerrainData.DirtyHeightmapRegion , TerrainData.SyncHeightmap . Properties Property De...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_e62daf302351
unity_docs
scripting
What is `ParticleSystem.ForceOverLifetimeModule.x` in Unity? Explain its purpose and usage.
ParticleSystem.ForceOverLifetimeModule.x public ParticleSystem.MinMaxCurve x ; Description The curve that defines particle forces in the x-axis. Additional resources: MinMaxCurve . ```csharp using UnityEngine; using System.Collections;[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : M...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_man_6bf0d0d6e150
unity_docs
physics
Show me a Unity code example for 'OnCollision events'.
n two colliders cease contact. For collision events, at least one of the objects involved must have a dynamic physics body (that is, a Rigidbody or ArticulationBody that has Is Kinematic disabled). If both GameObjects in a collision are kinematic physics bodies, the collision does not call OnCollision functions. The fo...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.
local_sr_db3175a0f21f
unity_docs
scripting
Show me a Unity C# example demonstrating `RenderSettings.fogDensity`.
RenderSettings.fogDensity public static float fogDensity ; Description The density of the exponential fog. Fog density is used by Exponential and ExponentialSquared modes. ```csharp using UnityEngine; using System.Collections;public class ExampleClass : MonoBehaviour { void Example() { // Set the fog de...
You are a Unity game development assistant. Help developers understand Unity APIs, best practices, and solve implementation challenges.