Skip to content

Instantly share code, notes, and snippets.

@pixelryan
Created October 2, 2018 06:19
Show Gist options
  • Save pixelryan/55d919af1dc260889e70d67c4c633203 to your computer and use it in GitHub Desktop.
Save pixelryan/55d919af1dc260889e70d67c4c633203 to your computer and use it in GitHub Desktop.
Pick a random dolly path for your Cinemachine camera. Just attach this to your camera and drag all the paths you want to choose from!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class RandomPathPicker : MonoBehaviour {
public CinemachinePathBase [] possiblePaths;
void Start () {
int randomPathNumber = Random.Range(0, possiblePaths.Length);
CinemachineDollyCart cartScriptRef = GetComponent<CinemachineDollyCart>();
cartScriptRef.m_Path = possiblePaths[randomPathNumber];
}
// Update is called once per frame
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment