hey, i need to get a component from a script that is supposed to deploy a turret when there is no turrets left, so i thought, for the script to know how many there are and when they die i need the get component to change variables, so i begun with the one just for it to count how many there are i tried this:
(deploy is the function to deploy it and Deployer is the object they will be deployed from)
im getting 2 errors, one tells me to put a semicolon right after GetComponent, and the other tells me the closing parenthesis its an unexpected token. so any help is much appreciated, sorry for any spelling mistakes
asked Oct 21 '12 at 03:15 AM
Try using SendMessage, its a lot easier and cleaner. Something like:
Then every script attached to the gameObject with the Deployer function will be called. Just create the function and inside it add your code to instantiate the turret when you run out of them.
answered Oct 21 '12 at 03:39 AM