- Home /
 
               Question by 
               WeatherCh · Nov 24, 2014 at 09:34 AM · 
                uicanvasvariabletransition  
              
 
              4.6 C# change canvas dependent on value
In the game I am making, the player applies hours to activities each day and is then given a set event.
Instead of creating several duplicate canvases to return to, I'd like the player to return to the same canvas. I have a float value for current day and need the canvas activation to be dependent on that value. (If day = 1, trigger event 1).
I'm new to coding, but this is the day system I have. Thanks in advance for your help.
 using UnityEngine;
 using UnityEngine.UI;
 using System.Collections;
 
 public class Day: MonoBehaviour
 {
     public static float DayV;        // The player's current day.
     
     
     Text text;                      // Reference to the Text component.
     
     
     void Awake ()
     {
         // Set up the reference.
         text = GetComponent <Text> ();
         
         // the starting day.
         DayV = 1;
     }
     
     
     void Update ()
     {
         // displaying the day to the player.
         text.text = "Day " + DayV;
     }
 }
 
I also have a float value for the "add day" feature, but no transition.. It is as follows:
 using UnityEngine;
 using UnityEngine.UI;
 using System.Collections;
 
 public class dayChange : MonoBehaviour {
 
     public void apply(float currentday)
     {        if(Day.DayV == 1)
                 Day.DayV += currentday;
 
     }
 
 
 }
 
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                