hey guys, i beleive im having an issue with dynamic typing... but i'm not savvy enough to work out the issue?
Player.transform.GetComponent("PlayerControl").RegainHealthCount = 0;
MaxHealth = Player.GetComponent("PlayerControl").Health; //Setting the maximum health value
i have other calls simular to the top one and i use;
(myObject.GetComponent(MeshFilter) as MeshFilter).mesh;
..too make it static... but with the RegainHealthCOunt.. it causes a permission error? BCE0120
and i have no idea how to change the max health = ect to work?..
If its a simple thing, im sorry, im still learning and will helpily read up on what it is, just if i could be pointed in the right direction would be awesome.
Hey guys... well... i worked out it wasn't a dynamic typing issue.. well it would of been without hte change... BUT... i found a more effcient way of dealing with it, without constantly calling for the script...
var name: SriptName;
function DoSomething () {
name.Health += 20;
}
works a treat.
ALSO!... the permission error BCE0120... MAKE SURE THE VARIABLE YOUR TRYING TO CHANGE ISN'T A Private variable!!! my bad! lol
hope this helps someone!
Matty
BUT this hasn't yet solved the issue with;
MaxHealth = Player.GetComponent("PlayerControl").Health; //Setting the maximum health value
...any ideas?
UPDATE
Alright!.. update!... the;
MaxHealth = Player.GetComponent("PlayerControl").Health; //Setting the maximum health value
Wasn't the issue, it was the calls from within the script...
so i converted this; `Player.GetComponent("PlayerControl").Health > 0`
to this; `Player.GetComponent.().Health > 0`
worked perfect... don't know why though? why what is the difference between these two?