I am testing simple variables and methods in unity with a script i have attached to the main camera called "LearningScript". I programmed a method called "AddTwoNumbers" to add the sum of two predetermined variables and output the result in the console. I then used the Input.GetKeyUp method to call the "AddTwoNumbers" method whenever input from the return key is given. When it compiles the script and i go to test it out, nothing appears in the console. I have no idea what i did wrong and can't find the mistake.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LearningScript : MonoBehaviour
{
public int number1 = 1;
public int number2 = 9;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyUp(KeyCode.Return))
AddTwoNumbers();
}
void AddTwoNumbers()
{
Debug.Log(number1 + number2);
}
}
