I have Energy Bar toolkit. It's a product i got.
it has variable currentValue for setting the current bar amount. It's in the inspector so you can set it manually by typing desired value.
But for some reason, when i try to change it through scripting it doesn't work at all
In My class i have this:
public class Player{
EnergyBar b;
OnCollisionExit( Collision collider){
if( collider is of tag "BOMB" ){
//player gets hit
b.currentValue -= 5;
//or i do it through a method
b.setcurrentValue( -5 );
}
}
}
Then in the INspector for my Player object which is loaded to the viewport. i select it and then in it's inspector tab it has an Energy field..and i drag the EnergyBar gameobject onto it.
It should work but it doesn't.
When my player collides with and explosion object, the Energybar does not decrease
↧