- Home /
Android / iPhone deployment..
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.
Thank you all.
Answer by ina · Mar 16, 2011 at 04:47 AM
Try GetComponent.<MeshFilter>().mesh
etc
Player.transform.GetComponent.().RegainHealthCount = 0;
i tried this, i get that same permission error?
though... i switched to Windows platform.. and that permission error arrises there AND mobile platforms? thats new
the code you gave wasnt the problem, it was the fact i set the variable as Private... my bad!... so this would have worked.. BUT.. would be like my previous versions, constantly calling the script...
Answer by Matthew 5 · Mar 18, 2011 at 12:57 AM
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.<PlayerControl>().Health > 0
worked perfect... don't know why though? why what is the difference between these two?
matty.
Your answer
Follow this Question
Related Questions
How can i set up a 2d game for iphone/android. 2 Answers
Sending Mobile Email via Unity 2 Answers
Massive Touch Lag on mobile devices? 3 Answers
Detecting Touch on Iphone and Android 1 Answer
AWS .NET SDK on iPhone 1 Answer