Exemple #1
0
    public static void PasteRigidbodies()
    {
        int i = 0;

        foreach (GameObject obj in GameObjectsWithRigidBodies)
        {
            if (obj.GetComponent <Rigidbody>() == null)
            {
                GUIutilities.CopyComponent(RigidBodies[i], obj);
            }
            i++;
        }
    }
Exemple #2
0
    public static void CopyAllRigidbodies()
    {
        var rigidbodyContainer = returnOrCreateObjectWithName("Rigidbody Container");
        var tmp = GameObject.FindObjectsOfType <Rigidbody>().ToList();

        RigidBodies = new List <Rigidbody>(tmp.Count);
        GameObjectsWithRigidBodies = tmp.Select(x => x.gameObject).ToList();

        int i = 0;

        foreach (Component rigidbody in tmp)
        {
            GameObject newGOtmp = new GameObject();
            RigidBodies.Add((Rigidbody)GUIutilities.CopyComponent(rigidbody, newGOtmp));
            newGOtmp.transform.parent = rigidbodyContainer.transform;
            newGOtmp.SetActive(false);
            i++;
        }
    }