Search the error code and draw on the knowledge.
Error BCE0018
Ok if you were to go to my other question error BCE0019 ,(http://answers.unity3d.com/questions/1082700/error-bce0019-4.html) , i was able to get that fixed, but now i got a new error.
Error: Assets/Animations/Part 3 - Animations_Arms/PlayerGUI.js(13,24): BCE0018: The name 'staminaBarDisplay' does not denote a valid type ('not found'). Did you mean 'System.Security.Policy.SiteMembershipCondition'?
Code:
#pragma strict
private var hasAxe : boolean = false;
private var canSwing : boolean = true;
private var isSwinging : boolean = false;
var swingTimer : float = 0.7;
private var controller : CharacterController;
private var playerGUI : PlayerGUI;
function Start()
{
hasAxe = true;
controller = GameObject.Find("First Person Controller").GetComponent(CharacterController);
playerGUI = GameObject.Find("First Person Controller").GetComponent(PlayerGUI);
}
function Update()
{
//If we aren't moving and if we aren't swinging, then we idle!
if(controller.velocity.magnitude <= 0 && isSwinging == false)
{
GetComponent.<Animation>().Play("Idle");
GetComponent.<Animation>()["Idle"].wrapMode = WrapMode.Loop;
GetComponent.<Animation>()["Idle"].speed = 0.2;
}
//If we're holding shift and moving, then sprint!
if(controller.velocity.magnitude > 0 && Input.GetKey(KeyCode.LeftShift))
{
GetComponent.<Animation>().Play("Sprint");
GetComponent.<Animation>()["Sprint"].wrapMode = WrapMode.Loop;
}
//WOODCUTTING SECTION
if(hasAxe == true && canSwing == true)
{
if(Input.GetMouseButtonDown(0))
{
//Stamina reduction applied to the PlayerGUI script
playerGUI.staminaBarDisplay -= 0.1;
//Swinging animation
GetComponent.<Animation>().Play("Swing");
GetComponent.<Animation>()["Swing"].speed = 2;
isSwinging = true;
canSwing = false;
}
}
if(canSwing == false)
{
swingTimer -= Time.deltaTime;
}
if(swingTimer <= 0)
{
swingTimer = 1;
canSwing = true;
isSwinging = false;
}
}
What is wrong?
The line numbering and error info doesnt match up.
Error codes are there so you can put the information straight into a search and you will find many answers to help you.
For each error code there is always the same thing that is wrong so your answer wont be any different, but you may have to make a little effort to work out how it applies to you. You learn something this way, which is kind of essential to your endeavours.