X
X
xXx_Unity_xXx2021-12-19 09:53:37
Unity
xXx_Unity_xXx, 2021-12-19 09:53:37

How to fix black sprites when moving in Unity2D?

Added simple lighting with light bulbs and material. Light bulbs are arranged in 3D, so that they shine on the picture. I added the same material to all objects, BUT when I start the game, the "zombies" turn black, but the player does not. I want to note that zombies become black only when the move script is running for them. On the z-axis and layers, zombies and the player are positioned equally .
Below I attached a scanty script for moving zombies and a screen from the game.
61bed65891e66224692253.jpeg

//ДВИЖЕНИЕ ЗОМБИ ОСНОВНОЕ
        if (player.position.x <= transform.position.x) //идёт влево за человеком
        {
            physic.velocity = new Vector2(-speed, 0);
            transform.localScale = new Vector2(1, 1);
        }
        else  //идёт вправо
        {
            physic.velocity = new Vector2(speed, 0);
            transform.localScale = new Vector2(-1, 1); 
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yura Mailler, 2021-12-20
@xXx_Unity_xXx

Try commenting out different lines of code to find out if there is a problem in them and tinker with the light. So it’s probably impossible to say what the problem is, after all, this is your project and only you know how it works

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question