API Reference
Note
Although per frame functions are provided you should refrain from using them unless you really need them. Too much code running per frame can cause garbage collection which will cause periodic stutter. Some code being ran is fine but do prefer built in Unity Tools components when they’re available.
Reference Variables
Reference variables are included in every script to access basic data about the script.
gameObject: The game object that is holding the script.
transform: A reference to the transform of the game object that is holding the script. For ships, this is the ship controllers transform.
scriptName: The file name of the script that’s being run.
Ship Specific Variables
body: The ships rigidbody.
ship: The ship controller itself. This is where you can access all information you’ll ever need about a ship.
Static Calls
These allow you to direct access various parts of the Unity and BallisticNG code base. You access them by using the names as are. So for instance if I want to access Unity’s Mathf Lerp function, I will call Mathf.Lerp()
Mathf
Physics
RenderTexture
RenderSettings
Object
GameObject
Color
Color32
Camera
Vector2
Vector2Int
Vector3
Vector3Int
Vector4
Quaternion
Matrix4x4
Texture2D
Sprite
Material
Time
TrackData
Exposed BallisticNG API. Click here for offical documentation
Use TrackData.Instance to access the current running instance of the track data object, which is where you can access everything.
RaceManager
Exposed BallisticNG API. Click here for offical documentation
Use RaceManager.Instance to access the current running instance of the race manager object, which is where you can access everything.
You can also use RaceManager.CurrentGamemode to get access to the loaded gamemode. The returned gamemode will always be the parent class, so if you want to access variables for a specific gamemode you will need to use reflection (see API below) to access those.
Ships
Exposed BallisticNG API. Click here for offical documentation
Race
Exposed BallisticNG API. Click here for offical documentation
NgAudio
Exposed BallisticNG API. Click here for offical documentation
To get an audio clip you will need to use the GetAudioClip method that takes the internal and custom sound strings manually. The static string arrays have two entries (1st is internal, 2nd is custom).
NgIn
Exposed BallisticNG API. Click here for offical documentation
This is the game’s abstracted input class, where you can poll inputs for the game’s actions.
Layers
Exposed BallisticNG API. Click here for offical documentation
LayersIDs
Exposed BallisticNG API. Click here for offical documentation
PickupRegistry
Exposed BallisticNG API. Click here for offical documentation
VirtualEnv
Exposed BallisticNG API. Click here for offical documentation
VirtualPaletteSettings
Exposed BallisticNG API. Click here for offical documentation
VirtualColors
Exposed BallisticNG API. Click here for offical documentation
Api
Dedicated API class for working in LUA.
GamePaused()
Returns if the game is paused or not.
IsSplitscreen()
Returns whether the game is currently running with splitscreen multiplayer enabled.
IsVerticalSplitscreen()
Returns whether the game is currently running with splitscreen multiplayer enabled with the vertical option enabled.
GetType(obj)
Allows you to return the type of an object. This is only for when you’re working with non Python types. You probably won’t need this.
GetInstanceField(obj, fieldName)
Note
This uses reflection and is slow. Use it sparingly.
Attempts to find a field on an object instance and returns its value. This can be used to return values from inherited data types that arn’t exposed to the Lua API but have parents that are, such as gamemodes.
obj: The object to search in.
fieldName: The name of the field to search for.
GetField(obj, fieldName)
Note
This uses reflection and is slow. Use it sparingly.
Attempts to find a static field on an object and returns its value.
obj: The object to search in.
fieldName: The name of the field to search for.
GetInstanceProperty(obj, propName)
Note
This uses reflection and is slow. Use it sparingly.
Attempts to find a property on an object instance and returns its value. This can be used to return values from inherited data types that arn’t exposed to the Lua API but have parents that are, such as gamemodes.
obj: The object to search in.
propName: The name of the property to search for.
GetProperty(obj, propName)
Note
This uses reflection and is slow. Use it sparingly.
Attempts to find a static property on an object and returns its value.
obj: The object to search in.
propName: The name of the property to search for.
AddComponent(gameObject, type)
Adds a component to a game object.
gameObject: The game object to add the component to.
type: The name of the component to add to the object. Valid types are MeshFilter, MeshRenderer, Light, Camera, LineRenderer, TrailRenderer, ParticleSystem, Rigidbody, BoxCollider, SphereCollider, CapsuleCollider, MeshCollider and TrackPad
GetComponent(gameObject, type)
Gets a component attached a game object.
gameObject: The game object to get the component from.
type: The name of the component to get from the object. Valid types are MeshFilter, MeshRenderer, Light, Camera, LineRenderer, TrailRenderer, ParticleSystem, Rigidbody, BoxCollider, SphereCollider, CapsuleCollider, MeshCollider and TrackPad
Easing
Provides easing functions for interpolation. There are a lot so this is only an outline. All of these take a from, to and T parameter, for instance Lerp(from, to, t)
Lerp
QuadIn
QuadOut
QuadInOut
QuadOutIn
CubicIn
CubicOut
CubicInOut
CubicOutIn
QuartIn
QuatOut
QuatInOut
QuatOutIn
QuintIn
QuintOut
QuintInOut
QuintOutIn
SineIn
SineOut
SineInOut
SineOutIn
ExpoIn
ExpoOut
ExpotInOut
ExpoOutInt
CircIn
CircOut
CircInOut
CircOutIn
ElasticIn
ElasticOut
ElasticInOut
ElasticOutIn
BackIn
BackOut
BackInOut
BackOutIn
BounceIn
BounceOut
BounceInOut
BounceOutIn