How do I get List of all objects touching during a collision

During a collision, is there a way to get a list of all objects that are touching the object just collided with?

Try this. Let me know if you have any questions.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;	// Don't forget to add this if using a List.

public class CollisionList : MonoBehaviour {

	// Declare and initialize a new List of GameObjects called currentCollisions.
	List <GameObject> currentCollisions = new List <GameObject> ();
	
	void OnCollisionEnter (Collision col) {

		// Add the GameObject collided with to the list.
		currentCollisions.Add (col.gameObject);

		// Print the entire list to the console.
		foreach (GameObject gObject in currentCollisions) {
			print (gObject.name);
		}
	}

	void OnCollisionExit (Collision col) {

		// Remove the GameObject collided with from the list.
		currentCollisions.Remove (col.gameObject);

		// Print the entire list to the console.
		foreach (GameObject gObject in currentCollisions) {
			print (gObject.name);
		}
	}
}

Try looking into Physics.OverlapSphere
It checks for colliders around your gameobject in a specific radius.
There are other ‘Overlap*’ functions like circle, box, etc. But it won’t take in consideration your gameobject’s collider(which may be complex like enveloping your whole mesh).

I don’t believe that there is a built in way to do this, but alas it is still possible. I’m not going to write the code for you, but I will give you some tips.

I’m not 100% sure how you are planning to use this information so that might slightly change how you would implement this.

With that said, you should look into OnCollisionEnter and OnCollisionExit. You would also maintain a list in the same script to track active collisions.

During OnCollisionEnter you would add the collided-with GameObject (derived from the Collision info) to the list and during OnCollisionExit you would remove the GameObject from the list.

I hope that this helps. Good luck!