I just want when I push "F" the flashlight to turn on ONLY if I have 5 points . And when I push "O" to gain Points so I can use the flashlight . But if I try the "int points = 0 " to make it "static int points = 0" it doesn't work . It sends me an error "Unexpected Symbol 'static' . In this code I put the 'static' in brackets just to remind you I have used it without and with it in this code .
Code:
using UnityEngine;
using System.Collections;
public class flashing : MonoBehaviour
{
void Update()
{
(static) int points = 0;
if (Input.GetKeyDown(KeyCode.O))
points++;
if (Input.GetKeyDown(KeyCode.F) && points == 5)
{
points = 0;
light.enabled = !light.enabled;
}
}
}