Save Clone Geometry while in Play Mode (or export to Rhino)

Hi All!

I am not that good at coding, so just trying my best…

I am trying to create a simulation where I shoot out prefabs and they stick together.
So far I was able to do that more or less (however they still overlap when they are bulked together, which i don’t want).

But the question is whether it is possible to save it as geometry all of the clone prefabs I created in Play mode?

My script so far…


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CreateObject : MonoBehaviour
{

Ray ray;
RaycastHit hit;
public GameObject prefab;
public PhysicMaterial physicMaterial;

void Start()
{

}

void Update()
{

    ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    if (Physics.Raycast(ray, out hit))
    {

        if (Input.GetKey(KeyCode.Mouse0))
        {

            GameObject myGameObject = Instantiate(prefab, new Vector3(hit.point.x, hit.point.y, hit.point.z), Quaternion.identity) as GameObject;
            Rigidbody mygameObjectsRigidBody = myGameObject.AddComponent<Rigidbody>();

            mygameObjectsRigidBody.mass = 100000; // Set the GO's mass to 5 via the Rigidbody.
            Destroy(myGameObject.GetComponent<MeshCollider>());

            BoxCollider myGameObjectsBoxCollider = myGameObject.AddComponent<BoxCollider>();// Add the rigidbod
            myGameObject.GetComponent<BoxCollider>().material = physicMaterial;
            mygameObjectsRigidBody.AddForce(transform.forward * 5);
            mygameObjectsRigidBody.useGravity = true;

               FixedJoint joint = myGameObject.AddComponent<FixedJoint>();
            joint.enableCollision = true;


        }

    }
    
}

}

}

thanks in advance!

Figured out how to copy the clones! A simple copy in play mode and paste in edit mode works just fine…