Skip to guide
Rainbow Lab/Documentation

Vine Foundry

Runtime API

csharp
using UnityEngine;
using VineFoundry;

public class GrowVine : MonoBehaviour
{
    public VinePlant vine;

    void Start()
    {
        vine.seed = 42;
        vine.length = 6f;
        vine.Generate();
        vine.SetGrowth(0.65f);
    }
}
  • Generate() searches supports and returns whether a route was found. Failed generation clears the previous route.
  • SetGrowth(float) and SetAge(float) update visible geometry without searching supports.
  • RestartGrowth() restarts the growth animation.
  • RefreshAppearance() applies mesh-affecting fields changed through code.
  • RefreshShaderProperties() applies shader-only changes, such as wind and snow.
  • RefreshLeafCollisions() invalidates prepared landing paths after environment changes.
  • PrepareLeafCollisionsNow() prepares current landing paths synchronously; avoid using it on many dense vines in one frame.
  • SettleFallenLeaves() completes the current independent fall stage.
  • Nodes, ReachedSurfaces, PathDistance and SurfaceQueries expose route diagnostics.
  • GeneratedMesh, GeneratedRenderer, GeneratedLODGroup, GetLODMesh(0..3), GetLODLeafCount(level), GetLODTriangles(level) and GetLODStemTriangles(level) expose generated results.

The component owns generated meshes and renderers. Use baking for persistent assets. Setting fields through code does not automatically regenerate; call the relevant method after editing them.