Skip to content

Instantly share code, notes, and snippets.

@aras-p
Created December 13, 2022 10:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aras-p/632326ebd7fbad94932eb456e4687752 to your computer and use it in GitHub Desktop.
UnityEngine C# API A..C array parameters
// just going through Data/Managed/UnityEngine.xml in Unity 2023.1.0a22, letters A to C,
// searching for "[]" finds these public APIs that take arrays as parameters. Then next to
// them I looked whether they have a List<> or NativeArray<> variants. Some do have List<>,
// very few have native array. Most of them would be good candidates to take a Span<T>,
// in some cases that might reduce the need for also having "an integer offset and number of items"
// arguments that some (minority) of them do.
//
// This is only A..C so far, or maybe like 10% of the UnityEngine.xml API. UnityEditor.xml probably
// has a ton of similar ones :)
AI.NavMeshPath.GetCornersNonAlloc: Vector3[]
AnimationCurve.ctor: Keyframe[]
Animations.MuscleHandle.GetMuscleHandles: MuscleHandle[]
AssetBundle.CreateFromMemory: byte[]
AssetBundle.CreateFromMemoryImmediate: byte[]
AssetBundle.LoadFromMemory: byte[]
AssetBundle.LoadFromMemoryAsync: byte[]
AudioClip.GetData: float[]
AudioClip.SetData: float[]
AudioListener.GetOutputData: float[]
AudioListener.GetSpectrumData: float[]
AudioSource.GetOutputData: float[]
AudioSource.GetSpectrumData: float[]
Camera.CalculateFrustumCorners: Vector3[]
Camera.GetAllCameras: Camera[]
CanvasRenderer.SetVerices: UIVertex[]
Collider2D.Cast: RaycastHit2D[], List<RaycastHit2D>
Collider2D.GetContacts: ContactPoint2D[], List<ContactPoint2D>
Collider2D.Overlap: Collider2D[]
Collider2D.Raycast: RaycastHit2D[], List<RaycastHit2D>
Collision.GetContacts: ContactPoint[], List<ContactPoint>
Collision2D.GetContacts: ContactPoint[], List<ContactPoint>
CompositeCollider2D.GetPath: Vector2[]
ComputeShader.SetFloats: float[]
ComputeShader.SetInts: int[]
ComputeShader.SetMatrixArray: Matrix4x4[]
ComputeShader.SetVectorArray: Vector4[]
Cubemap, CubemapArray, Texture2D, Texture2DArray: .SetPixeldata: T[], NativeArray<T>
CullingGroup.EraseSwapBack: T[]
CullingGroup.QueryIndices: int[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment