M
M
Mark Nikitin2017-10-21 02:00:17
Unity
Mark Nikitin, 2017-10-21 02:00:17

Why does the object disappear?

Does an object disappear when changing color through code?
using UnityEngine;
using UnityEngine.UI;
public class Oneclicers : MonoBehaviour {
public Color nostandrt;
public GameObject knopka_kup;
public GameObject text_kup;
private void Update()
{
knopka_kup.GetComponent().color = nostandrt;
text_kup.GetComponent().color = nostandrt;
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2017-10-21
@goblinek

GetComponent and other code, insert the code with the tag) so that it does not eat up characters))
and so corny you can have a color with Alpha 0 - that is, completely transparent.
and the shader on the object maintains transparency and makes the .
and judging by the code using UnityEngine.UI; you just have a canvas interface and all that, just with transparency support.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question