- Home /
This question was
closed Oct 25, 2014 at 09:37 PM by
robertbu for the following reason:
Duplicate Question
Question by
swatproject · Oct 25, 2014 at 09:34 PM ·
errorinstantiatebuilding
i get errors but i have no idea why
i get erreers such as these:
Assets/Scripts/Crafting/Building/CampfireBuild.js(38,105): UCE0001: ';' expected. Insert a semicolon at the end.
Assets/Scripts/Crafting/Building/CampfireBuild.js(38,104): BCE0043: Unexpected token: ,.
here is my script:
#pragma strict
var campfirePrefab : Transform;
var player : GameObject;
private var canBuild : boolean = true;
function start()
{
renderer.material.color = Color.green;
renderer.material.color.a = 0.5;
}
function OnTriggerEnter(col : Collider)
{
if(col.gameObject.tag == "Terrain" || col.gameObject.tag == "Tree")
{
renderer.material.color = Color.red;
renderer.material.color.a = 0.5;
canBuild = false;
}
}
function OnTriggerExit(col : Collider)
{
if(col.gameObject.tag == "Terrain" || col.gameObject.tag == "Tree")
{
renderer.material.color = Color.green;
renderer.material.color.a = 0.5;
canBuild = true;
}
}
function update()
{
if(Input.GetKeyDown("b") && canBuild == true)
{
Instantiate(campfirePrefab, player.transform.position + player.transform.forward * 2.0),Quaternion.Euler(270,200,200);
player.GetComponent(Crafting).campFire.SetActive(false);
}
}
Comment
Instantiate(campfirePrefab, player.transform.position + player.transform.forward * 2.0,Quaternion.Euler(270,200,200);
Looks to me like you also need to add a closing parenthesis .. as well as the fix robertbu posted.
Regards,
Follow this Question
Related Questions
My game wont start after i click a button 1 Answer
Script not using other script #C 2 Answers
GetComponent(Script) Error(Won't detect script) 0 Answers
my object isnt instantiating in the right place 2 Answers
unity 3.4 having trouble with islanddemo 0 Answers