Sprite not showing up (Tried common mistakes, Z-line, size, place, etc),Sprite is not showing up in 2D ( checked on Z, Layer order, size of the sprite)
Hi, I'm new to Unity. I have been using a code below, and it's been working fine, but somehow it's not showing up on Unity.
SpriteRenderer Skill_Explain;
void Update ()
{
Skill_Explain = GetComponent<SpriteRenderer> ();
GetComponent<SpriteRenderer> ().sprite = SkillSprite;
Skill_Explain.enabled = true;
Debug.Log ("Skill Sprite is on");
return;
}
}
I have other scenes that have the same codes and sprite render, and working smoothly. It's not null reference problem, Unity is recognizing it. I checked on scene while debugging, it's not on the canvas at all.
And I have checked common mistakes, such as Z-line, size of objects, layer order, and place of the object.
The difference between the fine one and the problem one is:
1:Fine one have only one sprite render in the scene, and the problem one have two one is working and the other one is not even showing up. (Two game objects with sprite render is not parent/child.) 2: The wrong game object had text component as well (Although, I tried to make them separate objects. Still not working.)
Any advice would be delightful.
,Hi, I'm new to Unity and the world of coding.
I tried to put a sprite with sprite-render on a game object.
SpriteRenderer Skill_Explain;
void Update ()
{
if (SkillBool == true) {
Skill_Explain = GetComponent<SpriteRenderer> ();
GetComponent<SpriteRenderer> ().sprite =SkillSprite;
Skill_Explain.enabled = true;
Debug.Log ("Skill Sprite is on");
return;
I didn't have any problem with this code before, and I checked objects several times including common mistakes, such as Z line, size of the object or sprite, and place of the object.
It's not Null reference problem, Unity is recognizing the sprite, but it's not visible, I checked on the scene while debug play, it's not visible at all.
Difference between a fine scene and this one would be...
1:The fine one has only one sprite render object, and the problem one has two objects with sprite render; one is working smoothly, and the other object doesn't. (Those objects are not parent/child relation, it's on the same canvas though.)
2: The problem object had a text and button. (Although, I already tried to make them separately, it didn't work.)
Any advice would be delightful.
Your answer
Follow this Question
Related Questions
Background in 2D game: sprite or image? 0 Answers
How to make headlight effects on a sprite? (Increasing emission of sprite material) 0 Answers
Sprites moving (shaking) during animation while they should not 1 Answer
Sprite loses quality when imported into unity. How to fix it? 0 Answers
[SOLVED] Problems creating a Sprite through script 0 Answers