public BaseProjectile GetProjectile(string projectileTemplate) { foreach (BaseProjectile projectile in projectileList) { if (projectile.IsSameType(projectileTemplate) && projectile.IsFree()) { projectile.Use(); return(projectile); } } GameObject newGameObject = Instantiate(Resources.Load("Prefabs/" + projectileTemplate) as GameObject); BaseProjectile newProjectile = newGameObject.GetComponent <BaseProjectile>(); projectileList.Add(newProjectile); newProjectile.Use(); return(newProjectile); }