Change: `public GameObject projectile`
variable type from GameObject to projectile_Controls:
`public projectile_Controls projectile`
This way, you can access public variables like: `projectile.decay`
instead of: `projectile.GetComponent().decay`.
Then, when accessing the pooled objects, you can do:
// TEST CHANGING FLOAT "DECAY" IN POOLED OBJECTS SCRIPT
if (Time.time > 1.5f) {
foreach (projectile_Controls pc in pool) {
pc.decay = 0.1f;
}
}
// END TEST
Sorry if any syntax is wrong. I only use JavaScript...
↧