Unity provides standard spline asset, use BGCurve only if Unity spline misses some feature

API Reference (Curve)

This page is API reference for a curve class (BansheeGz.BGSpline.Curve.BGCurve)


Method/Property Returns Description
Points BGCurvePointI[] Returns all points
PointsCount int Returns the total number of points
[int index] BGCurvePointI Get a point by its index
IndexOf(BGCurvePointI point) int Returns point's index if found or -1 if not found
AddPoint(BGCurvePoint point) BGCurvePointI add a point to the end of the curve
AddPoint(BGCurvePoint point, int index) BGCurvePointI add a point at specified index
AddPoints(BGCurvePoint[] points) void add several points to the end of the curve
AddPoints(BGCurvePoint[] points, int index) void add several points at specified index
Delete(BGCurvePointI point) void delete a point
Delete(int index) void delete a point at specified index
Delete(BGCurvePointI[] points) void delete several points
Swap(int index1, int index2) void swap 2 points
Reverse() void Reverses all points orders and keeping curve intact
Clear() void Remove all poitns


Method/Property Returns Description
Fields BGCurvePointField[] Returns all fields
FieldsCount int Returns the number of fields
AddField(string name, BGCurvePointField.TypeEnum type) BGCurvePointField Add a field with specified type
DeleteField(BGCurvePointField field) void Delete a field
GetField(string name) BGCurvePointField Get a field by its name
HasField(string name) bool Returns true if field with specified name exists


Method/Property Returns Description
SnapType SnapTypeEnum Curve's snapping mode. Off- snapping mode is off. Points- points are snapped to nearby geometry. Curve- points and approximation points are snapped to nearby geometry (approximation points are the points, created by a math component to split curve's section to small straight lines)
SnapDistance float Max distance for snapping
SnapToBackFaces bool Should snapping take back faces into account
SnapLayerMask LayerMask Unity's layer mask for snapping
SnapMonitoring bool Should curve monitor surrounding environment every frame. This is super costly in terms of performance
SnapAxis SnapAxisEnum Which axis is used for snapping (X,Y,Z)
SnapTriggerInteraction QueryTriggerInteraction Should snapping take triggers into account


Method/Property Returns Description
Closed bool if the curve is closed (e.g. there is a section between last and first points)
Mode2D Mode2DEnum if the curve is in 2D mode. Off- curve is in 3D mode. XY, XZ, YZ - curve is in 2D mode for specified plane. (XY- is the most useful mode for standard 2D mode in Unity)
PointsMode PointsModeEnum Identifies which class is used for points and how points are stored and behaves. Inlined- points are stored as inlined C# class (BGCurvePoint). Components- points are stored as Unity's components (BGCurvePointComponent, extended from MonoBehaviour). GameObjectsNoTransform- Points are stored as separate components(BGCurvePointGO, extended from MonoBehaviour) attached to their own GameObjects. Unity's transform is not used. GameObjectsTransform-Points are stored as separate components(BGCurvePointGO, extended from MonoBehaviour) attached to their own GameObjects. Unity's transform position is used as point position. Rotation and Scale affects controls positions.
EventMode EventModeEnum How events are fired. Update- events are fired once per frame in Update method. LateUpdate-events are fired once per frame in LateUpdate. Use it if you are using animations. NoEvents-events are suppressed