Skip to main content

Unity API

Scripts can use a broad, filtered part of the Unity API. The API Reference lists every allowed member, generated from the same list the compiler uses.

AreaWhat you can use
ObjectsGameObject (SetActive, activeSelf, name, tag, GetComponent<T>() family), Transform (position, rotation, scale, local values, directions, Rotate, Translate, LookAt, point/direction conversions, children, SetParent inside your world), Component, Behaviour.enabled
Maths and timeMathf, Random, Vector2/3/4, Quaternion, Color, Time
PhysicsRigidbody (velocity, forces, kinematic, gravity), Collider (enabled, isTrigger)
Look and soundRenderer, Material (colours, floats, vectors), Light, AudioSource / AudioClip, Animator parameters, ParticleSystem
UITMP_Text, UI Text, Image, RawImage, Slider, Toggle, Selectable.interactable
Textcommon string methods; ToString and Parse for int, float, double, bool
LoggingDebug.Log, Debug.LogWarning, Debug.LogError

Not available​

Files, web requests, GameObject.Find, scene loading, PlayerPrefs, cameras, Instantiate / Destroy and anything that reaches outside your world. Using them is a compile error that names the member.

Staying inside your world​

  • transform.root is your world's root, and SetParent only accepts parents inside your world.
  • GetComponent and friends only see objects in your world.
  • Material changes affect your world's materials only.