I have a question, in C#, if I try to check if my boolean variable “holding” is true, but it says "the name ‘holding’ does not exist in the current context. This might be a stupid question, but here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pickup_cube : MonoBehaviour {
// Use this for initialization
void OnMouseDown () {
bool holding = true;
}
// Update is called once per frame
void OnMouseUp () {
bool holding = false;
}
void Update () {
if (holding == true) {
}
}
}