In my unity project i have a firstpersoncharacter under it connect to it a spotlight.
Then i clicked in the menu on Assests > Open C# Project
Then i deagged the c# icon to the spotlight.
Then double click on the c# script icon and it opend the script code:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.F)
{
if (light.name)
{
}
}
}
}
But i have some problems.
First i’m getting error on the { of the first input under the if (Input.GetKeyDown(KeyCode.F)
This { under it i see red small line the error is: Parse Error: Unexpected symbol “{”
Second problem is when i select in the inner if light i see a line on the light variable like this --------
And it says: Thel ight attached to this gameobject (null if there is none attached)
I tried to make if (light.
But there is no enable property.
How should i fix all this ?