コード例 #1
0
        //[Tooltip("Share the score we got. If there are more than 1 player, all the scores of all the players will be shared in a list")]
        //public bool shareScore = true;

        // The name of the use who answered


        /// <summary>
        /// Start is only called once in the lifetime of the behaviour.
        /// The difference between Awake and Start is that Start is only called if the script instance is enabled.
        /// This allows you to delay any initialization code, until it is really needed.
        /// Awake is always called before any Start functions.
        /// This allows you to order initialization of scripts
        /// </summary>
        void Start()
        {
            // Look for the game controller in this level
            gameController = (TQGGameController)FindObjectOfType(typeof(TQGGameController));

            // If there is no game controller we can't use mail sharing
            if (gameController == null)
            {
                Debug.LogWarning("Can't find a game controller object, mail sharing cannot be used");
            }

            // Assign the text message object, which shows if the message was sent or failed
            textMessage = GameObject.Find("TextMessage").GetComponent <Text>();

            // Clear the text message
            if (textMessage)
            {
                textMessage.text = "";
            }

            mailSource = mailTarget;

            inputFieldName = GameObject.Find("InputFieldName/Text").GetComponent <Text>();

            buttonSendMail = GameObject.Find("ButtonSendMail").GetComponent <Button>();
        }
コード例 #2
0
 /// <summary>
 /// Awake is called when the script instance is being loaded.
 /// Awake is used to initialize any variables or game state before the game starts. Awake is called only once during the
 /// lifetime of the script instance. Awake is called after all objects are initialized so you can safely speak to other
 /// objects or query them using eg. GameObject.FindWithTag. Each GameObject's Awake is called in a random order between objects.
 /// Because of this, you should use Awake to set up references between scripts, and use Start to pass any information back and forth.
 /// Awake is always called before any Start functions. This allows you to order initialization of scripts. Awake can not act as a coroutine.
 /// </summary>
 void Awake()
 {
     gameController = (TQGGameController)FindObjectOfType(typeof(TQGGameController));
 }