unity

[Unity] Unity C# Basics (7) Enumeration, Indexer, Structure

Article directory enumerate – Simple enumeration – Flags enumeration (multiple choice enumeration) – Enum class C# indexer – Use generic indexers structure – Structure definition and use – Features of the structure – Difference between class and structure – struct with methods Summarize [enumerate] An enumeration is a set of named integer constants. Enumeration types …

[Unity] Unity C# Basics (7) Enumeration, Indexer, Structure Read More »

Unity visual chart plugin XCharts draws line charts, pie charts, and bar charts

1. Introduction A powerful, easy-to-use, parameter-configurable [data visualization] chart plug-in based on UGUI. Supports common charts such as line charts, bar charts, pie charts, radar charts, scatter charts, and heat maps. characteristic: Built-in rich examples and templates, parameter [visualization] configuration, effect real-time preview, pure code drawing. Supports common charts such as [line charts , bar …

Unity visual chart plugin XCharts draws line charts, pie charts, and bar charts Read More »

Unity Shader (1) Basic knowledge and syntax

Unity [Shader] (1) Basic knowledge and syntax 1. The basic structure of the Shader program 1. Document Statement 2. Simple UV understanding 3. Property declaration syntax (properties) 4. Sub-shader code syntax 1. The basic [structure of the Shader program] 1. Document Statement /*The first line declares a Shader named MyFirstShader, which is stored under the …

Unity Shader (1) Basic knowledge and syntax Read More »

Unity gets the width, height and set size of the UI, and clones the UI from the layout group will lose the size of the problem

Get width and height rectTransform = GetComponent<RectTransform>(); float width =recttransform.rect.width float height = rectTransform .rect.height; Setting the width and height only applies to the [anchor point] as a point rectTransform .sizeDelta = new Vector2(width,height); If the parent object uses a layouter, the cloned child object (whether using gameobject clone or transform clone) will lose its …

Unity gets the width, height and set size of the UI, and clones the UI from the layout group will lose the size of the problem Read More »

Unity AssetBundle study notes

Article directory Unity AssetBundle 1. Definition and role of AssetBundle 2.What is AssetBundle 3. AssetBundle use flow chart 4. AssetBundle usage process 5. Build the AssetBundle package code 6. Detailed explanation of the three parameters of BuildPipeline.BuildAssetBundles 7. Dependency packaging 8. The method of reading AssetBundle 9. Read the resources in the AssetBundle object 10. …

Unity AssetBundle study notes Read More »

Unity’s MD5 encrypted string

MD5 encrypt the [string] , then convert it to a string again using System; using System.Security.Cryptography; using System.Text; using UnityEngine; /// <summary> /// Encrypted data class /// </summary> public class EncryptData : MonoBehaviour { public static string EncryptString(string str) { //Convert the string to byte array in UTF-8 format byte [] resultBytes = Encoding.UTF8.GetBytes(str); //Create …

Unity’s MD5 encrypted string Read More »

Observer Pattern – Practical Application – Game Event System

using System.Collections; using System.Collections.Generic; using UnityEngine; /* * Author:W * Game event system */ namespace DesignPattern_Observer { # region event subject implementation /// <summary> /// Base class of game event subject /// </summary> public abstract class GameBaseEventSubject { /// <summary> /// A collection of all observers subscribed to the game event topic /// </summary> private …

Observer Pattern – Practical Application – Game Event System Read More »