Day 5 of Getting Started with Unity: Player and Enemy Spawn, Base Explosion Animation
This article describes how the character is generated at the beginning of the game, as well as the triggering and setting of the base explosion animation
Today is the fifth day. Although only a little game details have been updated, it took a lot of work to debug
I don’t know why my browser can’t listen to the song, but I can on my phone. Chrome open without trace directly does not display, dementia.jpg
06/22 Update, Chrome can already listen to songs
## Explosion animation when the base is hit In yesterday's study, we only changed the flag of the base, but ~~Art is explosion~~, so I added the explosion effect today:1 | //Explode animation (the prefab needs to be loaded in the Project interface) |
First create two enemy prefabs SmallEnemy
and BigEnemy
, copy the player’s script player
to the new script enemy
, update the prefabs in the script (such as transition patterns, bullets, special effects, etc.) .
Create a new script Born
for the prefab Born_0
(don’t know why it had the suffix _0
at the time):
1 | public class Born : MonoBehaviour |
The problem encountered today
With the deepening of learning, I will start to debug every day
For the 2019 version of Unity, when I copy and paste player
in hierarchy
to generate Enemy
, I found that I cannot directly delete the shield
prefab under player
. If I forcibly delete the shield
under Enemy
(that is, copy the gift of player
), the shield
under Player
in Project
will also disappear, which means the player
in hierarchy
The shield
is also gone.
After exploring to no avail, I had to start over by creating a new 2DObject
and that solved the problem.