I have an prefab instantiated in the start and I made toggle button to activate and deactivate it
when the clone deactivated it never be activated again.
any help?
The trick is to not deactivate the GameObject, but the Component.
this.GetComponent<SpriteRenderer>().enabled = true;
is Prefered over
this.gameObject.SetActive(true);
try something like this
var pf0 = Instantiate (prefab, transform.position, transform.rotation);
pf0.SetActive(false);
If theres multiple prefabs I would consider a “for” hope this helped