Greetings!
I'm at the end of my short text adventure game \ practice and he debugged it as far as I currently think I can. Enough that it lets me play test the thing in Unity. The initial text I put up loads just fine, but none of the keys meant to transition to other scenes with more text respond.
I remember there was something I had to do, but not what it was, exactly, to make the canvas read text strings from the c# code specified.
Requesting assistance with screenshots of Unity work environment to follow below - and the first bits of the code that enumerate and define states.
Work environ :
[
^]
Console error readouts on attempting to test :
[
^]
Code below :
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Game : MonoBehaviour {
public Text text;
private enum states {begin, light, d1, d2, applaud, deal, cave, memories, reflection, path1, egg, TH, no6, ocean, bEnd1, credits, summer, phone, memory, basement, weed, upstairs, devil, awake, bEnd2, computer, bEnd3, GOLDEN, GOLDEN2}
private states myState;
void Start () {
myState = states.begin;
}
void Update () {
print (myState);
if (myState == states.begin) {
begin(); }
else if (myState == states.light) {
light(); }
else if (myState == states.cave) {
cave(); }
else if (myState == states.path1) {
path1(); }
else if (myState == states.egg) {
egg(); }
else if (myState == states.TH) {
TH(); }
else if (myState == states.ocean) {
ocean(); }
else if (myState == states.bEnd1) {
bEnd1(); }
else if (myState == states.summer) {
summer(); }
else if (myState == states.basement) {
basement(); }
else if (myState == states.upstairs) {
upstairs(); }
else if (myState == states.awake) {
awake(); }
else if (myState == states.bEnd2) {
bEnd2(); }
else if (myState == states.computer) {
computer(); }
else if (myState == states.bEnd3) {
bEnd3(); }
else if (myState == states.GOLDEN) {
GOLDEN(); }
else if (myState == states.d1) {
d1(); }
else if (myState == states.d2) {
d2(); }
else if (myState == states.applaud) {
applaud(); }
else if (myState == states.deal) {
deal(); }
else if (myState == states.memories) {
memories(); }
else if (myState == states.reflection) {
reflection(); }
else if (myState == states.egg) {
egg(); }
else if (myState == states.no6) {
no6(); }
else if (myState == states.credits) {
credits(); }
else if (myState == states.phone) {
phone(); }
else if (myState == states.memory) {
memory(); }
else if (myState == states.GOLDEN2) {
GOLDEN2(); }
}
void begin () {
text.text = "This is like a bad dream. You don't know how you got here, where this place is, or why you got here, but you know that you feel uneasy. " +
"Something is very wrong with all of this. You should try and look for a way out of...wherever this is! \n \n " +
"You could go and see about that [L]ight in the distance, investigate the sound coming from a nearby [C]ave, or head down the nearby [P]ath..." ;
if (Input.GetKeyDown(KeyCode.L)) {myState = states.light;}
else if (Input.GetKeyDown(KeyCode.C)) {myState = states.cave;}
else if (Input.GetKeyDown(KeyCode.P)) {myState = states.path1;}
}
-----------------
I'm very new to Unity and C# programming, so please keep answers simple.
In short : Game does not respond to state buttons. Imported audio file throws up an error, console error messages mystifying me.
INFO : Unity version 4.6.9F1
Thank you!
What I have tried:
Fudging around with code, a few UI interaction changes, dragging script asset file to various places, to no avail.