This video reviews the use of invincibility frames (i-frames). In Unity, all systems need to run between frames. However, we can run code alongside this "routine" operation through the use of co-routines. By defining a method, we can perform an action, wait a certain about of time, and then resume again, yielding to other code.
Through using different layers for the Enemy and PlayCharacter game objects, we can temporarily ignore collisions between the layers, wait for one second, and then turn it back on again.
Unity 2023.2: Introduction to 2D Playlist: [ Ссылка ]
Created by Dan Cox ( @DanCox )
Ещё видео!