Hello community,
I have the following problem (BCE044 in line 3 and 26) with an .obj-sequencer script I copied from here: mesh sequence playback in Unity -(simple DK2 demo ... - Meta Community Forums - 150539
I went through a lot of pages here about that error code but since I’m no coder (sorry) I don’t really get what’s wrong with the code. I tried to mess with the ; and ) and such, but no luck as of yet- which drives me mad. I’m using Unity 5.6. Thank you for any piece of advice!
The script:
#pragma strict
var Meshes : GameObject; //load your mesh sequence into this array
var PlaybackSpeed : float = 1.0f; //adjust speed to increase/decrease framerate (note: lower value increases playback speed)
var NextFrame : int = 0; //set the frame that you want to start with here
var PingPong : boolean = false; //ping pong playback mode
private var CycleTimer : float = 0.0f; //resets after reaching value of playback speed
private var LastFrame : GameObject ; //the next mesh to turn off
private var CurrentFrame : GameObject ; //the next mesh to turn on
private var ReverseCycle : boolean = false; //turned on when sequence is at the last frame and ping pong is enabled
function Start () {
DisableAllFrames();
CurrentFrame = Meshes[NextFrame];
CurrentFrame.gameObject.active = true;
}
function Update () {
CycleTimer += Time.deltaTime;
if (CycleTimer >= PlaybackSpeed)
{
CycleTimer = 0;
LastFrame = CurrentFrame;
DisableLastFrame();
CurrentFrame = Meshes[NextFrame];
CurrentFrame.gameObject.active = true;
if(NextFrame+1 == Meshes.Length && ReverseCycle == false)
{
if (PingPong == true)
{
ReverseCycle = true;
NextFrame = NextFrame-1;
NextFrame --;
}
else NextFrame = 0;
}
if(ReverseCycle == true)
{
NextFrame = NextFrame-1;
NextFrame --;
if(NextFrame < 0)
{
ReverseCycle = false;
NextFrame = 0;
}
}
else NextFrame ++;
}
}
function DisableAllFrames()
{
for (var NextMesh : GameObject in Meshes)
{
NextMesh.gameObject.active = false;
}
}
function DisableLastFrame()
{
if(LastFrame !=null)
{
LastFrame.gameObject.active = false;
}
}