Remember to have "Keep in build" checked in the Architect Curve menu for the Architect Curve you want to add deformations to! Else it wont work because the Architect curve component is stripped during the build process.
using System.Collections.Generic;
using UnityEngine;
using CurveArchitect.Objects;
using CurveArchitect.Utilities;
public class CreateDeformations : MonoBehaviour
{
public ArchitectCurve ac;
public List<GameObject> prefabs;
void Start()
{
//If we start at (0,0,0) the first deformation/follower created will not update correctly.
Vector3 position = new Vector3(0, 0, 0.001f);
foreach (GameObject p in prefabs)
{
//Create prefab for Deformation or Follower
GameObject prefab = Instantiate(p);
//Create deformation on prefab. Use HelperArchitectCurveObject.CreateFollower(ac, prefab, position); if you want to create followers instead.
ArchitectCurveObject aco = HelperArchitectCurveObject.CreateDeformation(ac, prefab, position);
//If you use primitive colliders do this. MeshColliders will be created during the CreateDeformation process.
if(aco.type == ArchitectCurveObject.Type.CURVE_DEFORMER)
HelperArchitectCurveObject.TryAttachPrimitiveColliders(aco);
position.z += 1;
}
}
}