[SOLVED]Weirdness with SetActiveRecursively

Hi There,

I am having the following pbm :

I have a script on a parent GO that activate/deactivate it’s child GO with SetActiveRecursively when collision happens. That children GO is animated : it moves forward a straight line at a controled speed on z axis while shooting at the player, on a loop. As special effects I have an explosion prefab that gets instantiated upon collision, and a fireball prefab instantiated every 1 second (the shooting at player).

So everything works fine for the first collision but after that the explosion prefab doesn’t work anymore and the animation speed is not matching the variable, but the fireball still works.

The parent GO JS script

private var ParentObject : GameObject;
private var botadvanced : GameObject;

private var botdamaged : BotDamage;

var hideTime : float = 1.0;



function Start() 
{
	gameObject.SetActiveRecursively(true);
	
	botdamaged = FindObjectOfType(BotDamage);	
	ParentObject = gameObject.FindWithTag ("botparent"); 
	botadvanced = gameObject.FindWithTag ("enemy"); 
	
}



function HideShowBot() 
{
			
            
            botadvanced.SetActiveRecursively(false);
            
            yield new WaitForSeconds(hideTime);
            
           	botadvanced.SetActiveRecursively(true);
           	
          	
}

function BotEnding()
{
			
            
            botadvanced.SetActiveRecursively(false);          
            
	
}

The child GO JS script that deals with damage

// 
BotDamage.js


static var Count : int = 0;

var hitPoints : int;

var hitcount : int;

var hitclip : AudioClip;
//var target : Transform;

var explosionPrefab : Transform;

// sound clips:
var struckSound : AudioClip;

private var sk : ScoreKeeperKBNew01;
private var dgo : DeactivationGO;

private var dead = false;


function Start()
{	
	sk = FindObjectOfType(ScoreKeeperKBNew01);
	dgo = FindObjectOfType(DeactivationGO); 			
}	


function OnCollisionEnter(collision:Collision){
			
	if(collision.gameObject.tag == "boomerang"){
		ApplyDamage(hitcount);
		Count++;
		AddBonus();
		sk.Score( this );
		SendMessage("ApplyDamageBot");
		}
}
	
	

function ApplyDamage (damage : int)
{
	// we've been hit, so play the 'struck' sound. This should be a metallic 'clang'.
	if (audio  struckSound)
		audio.PlayOneShot(struckSound);

	if (hitPoints <= 0)
		return;

	hitPoints -= damage;
	if (hitPoints <= 0)
	{
		Die();
		dead = true;
		
	}
}

function Die ()
{	
		// create an effect to let the player know he beat the enemy
	Instantiate(explosionPrefab, transform.position, transform.rotation);
	dgo.HideShowBot();
	
	}

function AddBonus ()
{
	if (hitPoints == 0)		
	
	Count++;
	sk.Score( this );
}

May someone put me on the right track to solve this one as it is mindbuggling for a noob like me.
Thks in advance

Never mind. I got the solution.

For those interested, here is the ParentGO script which now works fine :
I just removed the HideShowBot() function call from the child script to the parentGO script in an Update with a condition plus adjusting some lost variables within the function itself. Et voilà !!

// DeactivationGO.js


private var ParentObject : GameObject;
private var botadvanced : GameObject;

private var botdamaged : BotDamage;
private var animSpeed : BotBoltPoliceZZ;

var hideTime : float = 1.0;



function Start() 
{
	gameObject.SetActiveRecursively(true);             	
	
	animSpeed = FindObjectOfType(BotBoltPoliceZZ);
	botdamaged = FindObjectOfType(BotDamage);	
	ParentObject = gameObject.FindWithTag ("botparent"); 
	botadvanced = gameObject.FindWithTag ("enemy"); 
	
}

function Update() 
{
	 if(botdamaged.hitPoints <= 0)
	 	
	 HideShowBot();	
	 
}


function HideShowBot() 
{
		    
		   	//yield new WaitForSeconds(0.2);	           
            botadvanced.SetActiveRecursively(false);            
            yield new WaitForSeconds(hideTime);            
           	botadvanced.SetActiveRecursively(true);
           	botdamaged.hitPoints = 3;
           	animSpeed.runSpeed = 2;
           	
           	
}

function BotEnding()
{
			
            
            botadvanced.SetActiveRecursively(false);          
            
	
}
[code]