Example of Correct Game Exit in Unity public void Quit() { #if (UNITY_EDITOR || DEVELOPMENT_BUILD) Debug.Log(this.name+" : "+this.GetType()+" : "+System.Reflection.MethodBase.GetCurrentMethod().Name); #endif #if (UNITY_EDITOR) UnityEditor.EditorApplication.isPlaying = false; #endif #if (UNITY_WEBGL || UNITY_STANDALONE || UNITY_IOS || UNITY_ANDROID) Application.Quit(); #endif }
If a question mark appears at the end of the string when processing text from TMP_InputField, it may be due to TMP_InputField adding a zero-width space (0x200B) at the end of the string. You won't see this in the input field itself, but it may appear under certain circumstances when passing the text. This issue can be easily fixed by:
Example of adding an event to a Button using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class PanelPaused : MonoBehaviour { public Button buttonContinue; public Button buttonExit; void Start() { buttonContinue…
To hide the cursor Cursor.lockState = CursorLockMode.Confined; Cursor.visible = false; To display the cursor Cursor.lockState = CursorLockMode.None; Cursor.visible = true;
A simple example of a simple Comparer for sorting //Descending Sort, Integer var queue = new PriorityQueue<int, int>(Comparer<int>.Create((x, y) => y - x)); //Ascending Sort, Object var queue = new PriorityQueue<ObjectA, ObjectB>(Comparer<Ob…
A simple example of finding trailing zeros in the factorial of N. public int TrailingZeroes(int n) { int result = 0; while(n!=0){ result += n/5; n = n/5; } return result; }
Given: An array of points on a plane: points[][] Xi and Yi. Need to find: The maximum number of points that belong to one line. Example: Original array: points= [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]] Result: 4 Example solution, not the best, but working: Explanation of the algorithm: Create a dictionary where the key is a pair [line equation + index of coordinates in the array].
Example of rotating/shifting an array Array K times in C# Meaning on example: There is an array: [1,2,3,4,5] We rotate it 3 times: K=3. Result: [3,4,5,1,2]
In the previous part (Python Bottle Guide (Translation) Part 5 - Request Data (data in the request)) we considered the main aspects related to the data transmitted in requests, in this part we will briefly consider the use of templates.
In the previous part (Python Bottle Guide (Translation) Part 4 - Creating Content) we considered the main aspects related to the transmitted content, in this part we will consider the data transmitted in requests. Files Cookie, HTTP headers, HTML form fields, and other request data are available through the global request object. This special object always refers to the current request, even in multi-threaded environments where multiple client connections are being processed simultaneously: