How can I detect 2 objects colliding with the one that the script is sitting on ? They both must have 2 different tags, thanks!
Well, you could create two more axis which contain the w-s and the a-d keys, and leave the default ones just with the arrow keys.
I know this but I want to detect 2 objects: When 2 object the first with tag "a" and the second with tag "b" touch the object that has the script spawn result. I know how to spawn it.
So you want to detect if both tags are colliding with a specific object?
If that is want you want, you could add a script to that specific object and add a OnCollisionEnter or OnTriggerEnter (2D or 3D, depending on what you want to do), and check for both tags.
I'd recommend creating two bools: one for a, and one for b, and then setting them on when they collide with the object.
Then in Update() add an if that checks if both bools are on, and then do what you want to do when those 2 objects collide with the specificobject.
Hope this helps!
EDIT: Also, OnTrigger is for colliders with "Is Trigger" on, and OnCollision is for coliders with "Is Trigger" off.
You have Enter, Stay, and Exit which I think are pretty self-explanatory, but just in case:
(the object = object that the script is attached to)
Enter: Used to detect when a object collides with the object.
Stay: Used to detect if an object is still collisioning with the object.
Exit: Used to detect when an object stops colliding with the object.