Unity gives me an error where it says I have 2 dots “…” written instead of one. But I don’t find this anywhere in my script, could it be how I declared the vector 3? Here is the script:
//adds a random rotation to newly placed objects
var rotation: float = Random.Range(objectsMinRotation, objectsMaxRotation);
obj.transform.rotation = Quaternion.Euler(Vector3.forward * rotation); //this is the offending line that causes the ".." token
EDIT: To make it easier here is the offending line (near the end of the script I put up)
var availableObjects: GameObject[]; //sets the size of available objects we can put in
var objects: GameObject[]; //puts in our objects such as coins and lasers
var objectsMinDistance: float = 5.0f; //the minimum distance they can spawn ahead of the player
var objectsMaxDistance: float = 10.0f; //the maximum distance they can spawn ahead of the player
var objectsMinY: float = -1.4f; //sets the objects (lasers/coins) y value between a min and max
var objectsMaxY: float = 1.4f;
var objectsMinRotation: float = -45.0f; //sets the objects (lasers/coins) rotation range value between a min and max
var objectsMaxRotation: float = 45.0f;
function AddObject(lastObjectX: float)
{
//randomly indexes the very first object (either laser or coins) on game start to spawn
var randomIndex: int = Random.Range(0, availableObjects.Length);
//instantiates the gameobject on the scene
var obj: GameObject;
obj = Instantiate(availableObjects[randomIndex]);
//Sets the object’s position, using a random interval and a random height. This is controlled by script parameters.
var objectPositionX: float = lastObjectX + Random.Range(objectsMinDistance, objectsMaxDistance);
var randomY: float = Random.Range(objectsMinY, objectsMaxY);
var obj.transform.position = Vector3(objectPositionX,randomY,0);
//adds a random rotation to newly placed objects
var rotation: float = Random.Range(objectsMinRotation, objectsMaxRotation);
obj.transform.rotation = Quaternion.Euler(Vector3.forward * rotation);
//Adds the newly created object to the objects list for tracking and ultimately, removal (when it leaves the screen).
objects.Add(obj);
}