void Start () { // Cache camera mainCamera = Camera.main; // Parent the particle system to the main camera particles.particleSystemTransform.parent = mainCamera.transform; particles.shurikenParticleSystem.simulationSpace = ParticleSystemSimulationSpace.Local; // Create a new spline and set it up spline = new GameObject("Viewport Spline", typeof(PlaygroundSpline)).GetComponent<PlaygroundSpline>(); spline.Loop = true; spline.Reset (); spline.SetControlPointMode(0, BezierControlPointMode.Free); spline.SetControlPointMode(1, BezierControlPointMode.Free); // Add three additional nodes (a basic spline will contain two initial nodes) spline.AddNode(); spline.AddNode(); spline.AddNode(); // Set the nodes to match the viewport currentScreenX = Screen.width; currentScreenY = Screen.height; SetViewportNodes(); // Assign the spline to the particle system particles.splines.Add (spline); // Make sure we're using the spline as source particles.source = SOURCEC.Spline; prevScreenOffset = screenOffset; }