Unity - How to trigger animation on collision

TIMESTAMPS
7:55 The script can be found in the inspector window.

Пікірлер: 22

  • @radhikajain15
    @radhikajain15 Жыл бұрын

    Very helpful, Thank you!!

  • @DaveSucker
    @DaveSucker Жыл бұрын

    plz man tell me bro haw can i just make a ui button witch rotate my car backward and forward

  • @TS-rp7dz
    @TS-rp7dz2 жыл бұрын

    Please can you give us the script

  • @leoisforevercool
    @leoisforevercool2 жыл бұрын

    Thanks!

  • @extravirginoliveoil2
    @extravirginoliveoil22 жыл бұрын

    correction: tutorial on how to move object position on animation

  • @TJS123
    @TJS1232 жыл бұрын

    Script using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class MyEventTriggerOnEnter : MonoBehaviour { [Header("Custom Event")] public UnityEvent myEvents; private void OnTriggerEnter(Collider other) { if (myEvents == null) { print("myEventTriggerOnEnter was triggered but myEvents was null"); } else { print("myEventTriggerOnEnter Activated. Triggering" + myEvents); myEvents.Invoke(); } } }

  • @crleo8709

    @crleo8709

    2 жыл бұрын

    thank you for the script, it's very helpful!!!

  • @universedavestudiotv4834

    @universedavestudiotv4834

    Жыл бұрын

    thank you!

  • @nickram2009

    @nickram2009

    Жыл бұрын

    For those who are wondering why this does not work for 2D game insted: of private void OnTriggerEnter(Collider other) use: private void OnTriggerEnter2D(Collider2D collision) Hope i saved you some nerves and time)

  • @ultimav3868

    @ultimav3868

    Жыл бұрын

    Thank you bro

  • @MsRaskauskas

    @MsRaskauskas

    Жыл бұрын

    Thank you for this but it is not working for me. I am new at this but trying to help a student who wants to trigger an animation in 3D such as this. I am getting the error message that the script is not able to be applied and there are no public variables showing in the inspector to add the trigger etc. Do I have to change the code to fit my assets?

  • @TJS123
    @TJS1232 жыл бұрын

    was very useful but providing a script wouldve been helpful

  • @botaniccanon1596
    @botaniccanon15967 ай бұрын

    Thanks ever so much for your video content. I appreciate it!!! if you have some time, can you help me with how to make an object collide with another object three times, then play an animation? I am a beginner in coding so can you script it out for me to understand. Thanks

  • @cybersoff149
    @cybersoff1492 жыл бұрын

    Cssn you make a video of how to do this in unity 3d?

  • @Dilithium1

    @Dilithium1

    Ай бұрын

    its the exact same thing but you don't include the 2D part in the parenthesis in the code, it would look like this: (Collider other)

  • @infpya
    @infpya7 ай бұрын

    using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class myEventTriggerOnEnter: MonoBehaviour [Header('CustomEvent')] { public UnityEvent myEvents; private void OnTriggerEnter2D(Collider2D other) { if (myEvents==null) { print("myEventTriggerOnEnter was triggered but myEvents was null."); } else { print("myEventTriggerOnEnter Activated. Triggering"+myEvents); myEvents.Invoke(); } } }

  • @eduardomoroian4618
    @eduardomoroian46182 жыл бұрын

    Without sharing the script with us this video is useless