The name 'LevelUpSystem' does not denote a valid type ('not found').
Here is the script
#pragma strict
private var levelUpScript : LevelUpSystem;
function Start ()
{
levelUpScript = GameObject.Find("First Person Controller").GetComponent(LevelUpSystem);
}
function OnTriggerEnter (Col : Collider)
{
if(Col.tag == "Player")
{
Destroy(gameObject);
levelUpScript.currentXP += 10;
}
}
Answer by Landern · Aug 25, 2015 at 04:45 PM
Do you have a file called LevelUpSystem.js? Are you mixing c# and JavaScript/UnityScript?
You really should use generics with GetComponent so it returns the expected Type and not type of Component.
levelUpScript = GameObject.Find("First Person Controller").GetComponent.<LevelUpSystem>();
We are missing some information to help you with this.
Answer by CristiBala24 · Aug 25, 2015 at 05:06 PM
@Landern Hi!I am not rlly into scripting and stuffs like that and i got this script from youtube.I've tried your ideea and unfortunetly didnt work.If you know a way i could learn scripting i would rlly appreciate if you tell me :D.
Without more information i can't help you, LevelUpSystem should exist, it's an object that contains properties, methods, perhaps more or less. Regardless it's very hard to trouble shoot this with the original script and no idea if you have the other classes/script files for the types being used.
You may want to start with the Unity3D learning page: http://unity3d.com/learn
Your answer
Follow this Question
Related Questions
Replicate entire script series, all entailed objects and variables 0 Answers
Player movement help 1 Answer
change a created transform in a script from another one 1 Answer
Help with this code 1 Answer