Tanoda
VersionDisplay.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4#if PLATFORM_STANDALONE_WIN
5using System.Runtime.InteropServices;
6#endif
7using UnityEngine;
8using UnityEngine.UI;
9
10public class VersionDisplay : MonoBehaviour
11{
12#if PLATFORM_STANDALONE_WIN
13 [DllImport("user32.dll", SetLastError = true)]
14 static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
15 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
16 public static extern bool SetWindowText(IntPtr hwnd, String lpString);
17
18 private void Start()
19 {
20 IntPtr hWnd = (IntPtr)FindWindow("UnityWndClass", Application.productName);
21 SetWindowText(hWnd, Application.productName + " - v" + Application.version);
22 }
23#endif
24#if UNITY_WEBGL
25
26 public bool useOnGUI = true;
27
28 private void Start()
29 {
30 Debug.Log(Application.productName + " - v" + Application.version);
31 if (GetComponent<Text>())
32 {
33 GetComponent<Text>().text =/* "v" + Application.version*/ NetworkManager.instance.selectedLevel.name;
34
35 }
36 }
37
38 private void OnGUI()
39 {
40 if (useOnGUI)
41 GUI.Label(new Rect(500,5,500,100), Application.productName + " - v" + Application.version + " " + NetworkManager.instance.selectedLevel.name);
42 }
43#endif
44}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19