i’m quite confuse on this, i’m trying to acces a script on my camera wich is part of the unity effect, the edge detection script.
trying to enable it and disable it with a key
my code is
```csharp *using UnityEngine;
using System.Collections;
public class test_scriptenabler : MonoBehaviour
{
void Update()
{
ed = Camera.main.EdgeDetection;
if (Input.GetKey(KeyCode.Space))
{
ed.enabled = !ed.enabled;
}
}
} _```*_
well i’m getting an error " Assets/Script/test_scriptenabler.cs(13,27): error CS0103: The name `ed’ does not exist in the current context "
Also, GetKey will be true for every frame you’re holding spacebar, so the effect will flicker on and off while you hold it. Use .GetKeyDown or .GetKeyUp instead.
yeah well thx for the answer but i dont understand where the hell and most of all wich kind of declaration form i need to use, before void start or in update, i’m kinda new to code and it’s not very simple for me