using UnityEngine; using System.Collections; public class DemoScript : MonoBehaviour { public Light myLight; // Use this for initialization void Start () { int myVar = AddTwo (9,2); Debug.Log (myVar); } // Update is called once per frame void Update () { if (Input.GetKeyDown("space")) { MyFunction (); } } void MyFunction () { myLight.enabled = !myLight.enabled; int myVar = AddTwo (9,2); Debug.Log (myVar); } int AddTwo (int var1, int var2) { int returnValue = var1 + var2; return returnValue; } }