i am having a problem of tagging the cube to the script
if it does not work i can loed the next level after all the cubes have been taken
#pragma strict
var levelend = false;
var maxpoints : float = 12;
function Update () {
if (Cubes.score >= maxpoints) {
Application.LoadLevel (“level2”);
}
}
heres the script
Nobody can help you until you explain what Cubes is.
i justed posted it right there
The script you posted shows how you are using Cubes but doesn’t show what Cubes is, or what exactly is inside it.
We need to see it in order to know if it is a struct or a class, if score is a static variable, etc.
ohhh
do u know the rolling ball project
i am working on that so now all what i need is a script that takes me from one level to the other
the cubes are the stuff that we peck up
No, you showed something referencing Cubes, not what it is. And clearly the script doesn’t know what it is either. Hence “Unknown Identifier : Cubes” Your script doesn’t know what it is so you can’t use it. You need to either identify it, find it, link to it, or make it static before you can use it.
No, and I doubt many forum members have the project installed and ready to reference so we’ll need to you post the script that declares Cubes.
using UnityEngine;
using System.Collections;
public class aroundwego : MonoBehaviour
{
// Update is called once per frame
void Update ()
{
transform.Rotate(new Vector3(15, 30, 45)* Time.deltaTime);
}
}
Cubes isn’t declared anywhere in that script.
Also, please use code tags: Using Code Tags Properly
ahmedalheday:
The error: BCE0005: Unknown identifier: ‘Cubes’. is letting you know that you are using and indentifier that is unknown and that this identifier is called “Cubes”.
You are asking the computer to do something with this line:
if (Cubes.score >= maxpoints)
You are asking the computer:
If the score on the Cubes item is greater than maxpoints… then “do something”, in this case, load a new level.
But you have not told the computer what “Cubes” is.
If you were in a Cafe, and someone came up to you and asked:
“Hey, I would like a coffee and a samophlange, please.”
… you would say:
“What’s a samophlange?”
This person has used two identifiers: “Coffee” and “Samophlange”. You know what coffee is. You don’t know what a samophange is, so he must tell you.
The computer doesn’t know what “Cubes” means. You must tell the computer.
We can’t tell you what “Cubes” means. You must tell us.
We can guess?
It looks like it’s the name of a GameObject that holds a property or value called “score”?
If this is true you need to create a reference that is connected to the item “Cubes”.
If my guess is correct, at the top of the script you need to create a public reference to the Component Type or Script Name of Cubes that holds the score value.
If you have a script called Cubes.js on a GameObject, you would need a line like:
public var cubes : Cubes;
… this is public (so it can be accessed), var (indicating this is a variable), cubes (with a lowercase c for the name), a colon (for syntax) and Cubes (with an uppercase c, matching the name of your script, which is the “Type”), followed by a semi-colon (ending the line).
You need to drag a reference to the GameObject with the Cubes.js script on it into the public slot on the GameObject with the code in your post.
There are other minor issues, but we can go into these later.
If this doesn’t make sense, then I’d suggest stepping back and watching more of the learning lessons, and reading the introduction sections of the manual again:
Agree, you need to add more detailed information if you want to get any real help