Fallout death script

Hi, I am new to Unity, just trying to find my way around, and following the 3DPlatformtutorial. It’s great. Have progressed to Page 37, the Fallout Script, which I thought I had cracked, but when Lerpz falls off the game world, he does return to the Respawn platform but with the following error message.

MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.

SpringFollowCamera.LateUpdate ()   (at Assets/Scripts/Camera/SpringFollowCamera.js:40)

I have tried to figure this out, but am new to scripting, so may well have missed something stupid, if so apologies. But if anyone can help, I would really appreciate it.

thanks

P

Could you post the script please?
From the error message, you destroyed the gameObject.
I take it this is Lerpz, your player correct?
Personally I would just do a transform back onto the platform. I’m going to re-look at that tutorial as soon as I take a break from blender.

I’m sure others will have a better answer, I’m just guessing from the error message.

Jim Cullen

Hello Jim,

many thanks for replying. You asked that I post the script, I assume you mean the death fallout script, which I now do, its just the standard script in the tutorial. The only change I made was to make the collider box a little bigger so that it would be sure to catch Lerpz, and yes you are correct, it is Lerpz the Player game obj I was talking about.

I really appreciate you taking the time to think about this, once again, many thanks…Script below.

best

P

function OnTriggerEnter (other : Collider)
{
	// Player fall out!
	if (other.GetComponent (ThirdPersonStatus))
	{
		other.GetComponent (ThirdPersonStatus).FalloutDeath();
	}
	// Kill all rigidibodies flying through this area
	// (Props that fell off)
	else if (other.attachedRigidbody)
		Destroy(other.attachedRigidbody.gameObject);
	// Also kill all character controller passing through
	// (enemies)
	else if (other.GetType() == typeof(CharacterController))
		Destroy(other.gameObject);
}

// Auto setup the pickup
function Reset ()
{
	if (collider == null)
		gameObject.AddComponent(BoxCollider);
	collider.isTrigger = true;
}

@script AddComponentMenu("Third Person Props/Fallout Death")

So lerpz is transforming back onto the pad? I’m at work for the next 12hrs so I’m at a bit of disadvantage. Comment out the destroy statements as a test.
Oh and not to worry, I intend to implement the respawn platform this weekend so I have a vested interest in helping you! :twisted:

Jim Cullen

Much obliged Jim, will do first thing in morning.

P

i have the same problem, any solution?