Setting a win condition

I want to set a win condition: the player hast to pick up an object then carry it to a designated place.
There are 4 of those Objects in the Scene.
The win condition should be accomplished when all 4 objects are at their designated place.

I am an absolute noob when it comes to scripting so please reply in an easy and understandable way.
If anybody knows a way to accomplish the task without scripting please tell me.

Thank you

On your 4 objects, attach trigger colliders and a kinematic rigidbody.

Have a goal point. That goal point should have a trigger collider attached to it.

In a script on that collider, listen for the ‘OnTriggerEnter’ and ‘OnTriggerExit’ messages.

When OnTriggerEnter occurs, the collider that entered the goal should be passed in as the parameter. Check that collider to see if it’s one of the special objects (you could use tags for this).

When OnTriggerExit occurs, this could be used to see if the object left the goal in the same way you test if it entered. You could use this if you require the objects to REMAIN in the goal for the win condition to occur.

When the 4 objects have fired the OnTriggerEnter method, do something (do win).

If you need more specifics… ask a more specific question. Note we will not write the code for you, but will give you a pointer in the direction to head.

Thank you for the reply. Will check it out and be more specific when I started to work on it and have more questions.

I have set up a Box collider with “Is Trigger” checked (finally there will be4 of them, one for every object)
On the 4 Objects I added a Trigger Collider and Kinematic Rigidbody.
The next step in the previous post is:
In a script on that collider, listen for the ‘OnTriggerEnter’ and ‘OnTriggerExit’ messages.
I got no idea how to do this.
Any help appreciated

I could explain how to do this for you, and you will probably find a number of examples if you search the Unity docs/the web for simple examples of OnTriggerEnter/Exit…
However, as you said in your first post, if you are extremely new, it would be even more helpful to point you in the direction of examples/tutorials by Unity for a few projects.
This way, you’ll get some exposure to the basics, and it’ll help you so much more than simply posting 1 answer for you. :slight_smile: