Hello! I am trying to toggle between two textures in a mobile game, one a checkmark and one transparent. My code is:
using UnityEngine;
using System.Collections;
public class toggleCheck : MonoBehaviour {
public bool Show = true;
public Texture2D checkmark;
public Texture2D trans;
void OnMouseDown ()
{
if (Show == true)
{
checkmark = Rescources.Load("checkmark show") as Texture2D;
Show = false;
}
else
{
trans = Resources.Load("checkmark hide ") as Texture2D;
Show = true;
}
}
}
I want to be able to toggle between seeing a checkmark and "seeing" a transparent texture (literally transparent, unseeable). *checkmark* is the name of the texture, and *trans* is the name of the transparent texture. **I am using c#, and developing for ios.** My script does not work when I touch the empty gameobject that has the guitexture. Please help if you know why my code isn't working. Thanks.
↧