It’s a 2D platformer game where each time the enemy shoots, it finds the player’s position and makes the bullet go in that direction. The first enemy that already exists when the scene starts shoot bullets correctly as you can see in this screenshot: Screenshot by Lightshot . But a problem happens with all the new enemies that are instantiated by an “enemymanager” object. The problem is that when the player is above or under the enemy, the enemy bullet gets thinner as you can see in this screenshot: Screenshot by Lightshot .
I already made prefabs for all these objects and assigned them correctly to their specific public variables.
Also, I tried rotating and scaling in the bullet’s script after 0.1 second and it didn’t work. This is the code
that makes the enemy shoot:
creatingbullet = Instantiate(enemyA2Bullet, transform.position, Quaternion.identity);
creatingbullet.transform.LookAt(targetisplayer.position);
creatingbullet.transform.Rotate(new Vector3(0, -90, 0), Space.Self);
When I tried removing and changing the last line of this code, the bullet worked even weirder.
Hope someone can help me, thank you.