I am aware that this question has been asked before but I have searched for the answer and none of the proposed solutions have worked for me. I have checked both of the scripts in my project currently for errors and have found none. My variable is public.
Script the variable is in:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class doorEnterController : MonoBehaviour {
public Scene toLoad;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
The other script in my project:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerController : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void FixedUpdate()
{
if (Input.GetKey(KeyCode.W))
{
gameObject.transform.Translate(new Vector3(0, 0.1f, 0));
}
if (Input.GetKey(KeyCode.S))
{
gameObject.transform.Translate(new Vector3(0, -0.1f, 0));
}
if (Input.GetKey(KeyCode.A))
{
gameObject.transform.Translate(new Vector3(-0.1f, 0, 0));
}
if (Input.GetKey(KeyCode.D))
{
gameObject.transform.Translate(new Vector3(0.1f, 0, 0));
}
}
}