Can't add script behaviour TMP_CoroutineTween. The script needs to be derived from MonoBehaviour. I need help with this script.
I have been doing some jimmyvegas unity tutorials on youtube. he has one for a space ship game for android and ios devices, its basically an endless runner, I have made 3 sections of the endless level i want to randomise, so the game never ends, the problem is jimmy uses monodevelop, and i cant find a working version of it so im using visual studio, i created the script exactly how jimmy did and whats supposed to happen is i add a cube select trigger on box collider and throw the script into that cube, i will put the script below this message, and when you hit that cube the next random section appears. when I put it on the cube it sais this error message. "Can't add script behaviour TMP_CoroutineTween. The script needs to be derived from MonoBehaviour" when looking on line ppl say you have to add a monobehaviour class to the script, but I am doing my script in java as per the tutorial and everyones answers is for C#. I dont know how to write this in Java is it var MonoBehaviour?
Im a newbie I am just beginning Im one episode away from completing the game jimmy teaches you how to create, im at a crossroads because i cant work out whats wrong, it sais it doesnt like NextAxis and TheXAxis and NewAxis. But there is no way to change it, all visual suggest is to change it from TheXAxis, NextAxis or NewAxis to Var NewXAxis : float = newFunction();
Im pretty sure that wont randomise the sections with just newFunction surely it needs to know what Axis its on to randomise the next section.
The script is below and the link to the video tutorial which has the bit Im stuck on is in a link below that he starts writing the script at about 3 and a half mins in, but if you watch the first 3 mins you will get the jist of what the script is supposed to do, Any help would be greatly appreciated. I have worked out all other errors but i cant get my head around this one, and no one has this same problem as monodevelop still worked when this tutorial was created.
Script:
var Section01 : GameObject; var Section02 : GameObject; var Section03 : GameObject;
var NewXAxis : float = NextAxis.TheXAxis; var GenSec : int; var NewSec : GameObject; var NextPosition : Vector3 = Vector3(NextAxis.TheXAxis, 25.9, 16.7916);
function OnTriggerEnter (col : Collider) { NextPosition = Vector3(NextAxis.TheXAxis, 25.9, 16.7916); GenSec = Random.Range(1, 4); NewXAxis = NextAxis.TheXAxis;
if (GenSec == 1) {
NewSec = Section01;
}
if (GenSec == 2) {
NewSec = Section02;
}
if (GenSec == 3) {
NewSec = Section03;
}
Instantiate(NewSec, NextPosition, Quaternion.identity);
NextAxis.TheXAxis += 500;
}
Link to jimmys tutorial episode 12 : https://www.youtube.com/watch?v=BTg-JHLnFno∈dex=12&list=PLZ1b66Z1KFKiLGbRHcVltFitp0gL1inbo
any help would be great,
thanks
John