Editor Scripting Question

Trying to make a simple Editor macro which would:

1) Add a Rigidbody.

2) Add a BoxCollider.

3) Enable “isTrigger” on the BoxCollider.

I’ve got as far as the first two steps but stuck on the third - flexed my Google-fu and forum searched but came up empty.

Here’s what I have so far:

import UnityEditor;

@MenuItem ("Window/Rigidbody and BoxCollider")
static function AddRigidBodyAndBoxCollider() {
	EditorApplication.ExecuteMenuItem("Component/Physics/Box Collider");

Any ideas are appreciated!

Try this:

       var rigidBody = Selection.activeGameObject.AddComponent(Rigidbody);
       var boxCollider = Selection.activeGameObject.AddComponent(BoxCollider);
       boxCollider.isTrigger = true;