I get this error. I want to turn it off 2 Texture2D different.
When I press the left mouse button to activate the mouse cursor component (Texture2D) and when the release button to trigger another (textured2d).
how to fix the error CS0029: Can not implicitly convert type ‘bool’ to `UnityEngine.Texture2D ’
script reference:
using UnityEngine;
using System.Collections;
public class CursorAnim : MonoBehaviour {
public Texture2D cursoropen;
public Texture2D cursorclose;
public Vector2 mouse;
public int w = 32;
public int h = 32;
void Start()
{
Screen.showCursor = false;
}
void Update()
{
if (Input.GetMouseButtonDown (0))
cursorclose = true;
cursoropen = false;
if (Input.GetMouseButtonUp (0))
{
cursoropen = true;
cursorclose = false;
}
mouse = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
}
void OnGUI()
{
GUI.DrawTexture(new Rect(mouse.x - (w / 2), mouse.y - (h / 2), w, h), cursoropen = cursorclose);
}
}