This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Total XP :::::::::::::::::::::: lvl 53 (4,497,475 XP) | |
C# :::::::::::::::::::::::::::: lvl 52 (4,417,075 XP) | |
Documentation ::::::::::::::::: lvl 5 ( 40,987 XP) | |
JavaScript :::::::::::::::::::: lvl 2 ( 12,477 XP) | |
CSS ::::::::::::::::::::::::::: lvl 2 ( 6,870 XP) | |
Arduino ::::::::::::::::::::::: lvl 1 ( 6,354 XP) | |
Web ::::::::::::::::::::::::::: lvl 1 ( 4,762 XP) | |
JSON :::::::::::::::::::::::::: lvl 1 ( 4,700 XP) | |
JavaScript (JSX) :::::::::::::: lvl 0 ( 1,582 XP) | |
Backend ::::::::::::::::::::::: lvl 0 ( 1,058 XP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void DrawMainPageSelector() | |
{ | |
bool isMainPageSet = !string.IsNullOrEmpty(setMainPage); | |
var mainPageTitle = !isMainPageSet ? "NONE" : Path.GetFileName(setMainPage.ToUpper()); | |
//Display a Popup selector with default of non if exisitng value is not in the list | |
using (var mainPageScope = new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | |
{ | |
GUILayout.Label(string.Format("Main Page Setting\nCurrent: {0}", isMainPageSet?setMainPage.ToUpper():"NONE"), EditorStyles.centeredGreyMiniLabel); | |
using (var selectionScope = new EditorGUILayout.HorizontalScope(EditorStyles.toolbar)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
//Made by Dencho, Just some useful extensions for Unity types, wrote them over the years for my own use, enjoi thx! | |
namespace Yakno | |
{ | |
#region Debugging | |
public static class DebugExt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (GUILayout.Button("Your Button")) | |
{ | |
GUI.FocusControl(null); | |
} | |
_data.ItemValue = EditorGUILayout.IntField("VALUE", (int)_data.ItemValue, textAreaStyle); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Say you have incommingJson like this: | |
{ | |
"name": "Bob", | |
"url": "https://example.com/bob.png" | |
} | |
//And you have a DataClass like this you use for you Avatar Loading or Refferences | |
[System.Serializable] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Examples of the different types of paths in Unity and their outputs: | |
Application.dataPath: //This property returns the path to the Assets folder of the project. In the editor, it returns the path to the Assets folder. In a build, it returns the path to the data folder of the build. | |
// Usage | |
Debug.Log(string.Format("Assets path: {0}", Application.dataPath)); | |
// Example output in the editor: "Assets path: C:/MyProject/Assets" | |
// Example output in a Windows build: "Assets path: C:/MyGame/MyGame_Data" | |
Application.persistentDataPath: //This property returns the path to a persistent data directory. This directory is where you can store data that needs to persist between game sessions. The exact location of this directory depends on the platform. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Creating a Prefab from Custom Inspector To create a Prefab from a custom inspector, you can use the PrefabUtility.CreatePrefab method. Here's an example of how you can use this method: | |
using UnityEditor; | |
using UnityEngine; | |
public class MyCustomEditor : EditorWindow | |
{ | |
[MenuItem("MyTools/CreatePrefab")] | |
static void CreatePrefab() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//How to USe: | |
private Texture2D icon_PlayButton = null; | |
private Texture2D icon_Refresh = null; | |
private GUIContent iconGUI_PlayButton; | |
private GUIContent iconGUI_Refresh; | |
private void InitStyles() | |
{ | |
icon_PlayButton = EditorGUIUtility.IconContent("PlayButton").image as Texture2D; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ProcessRotationSnappingSubroutine(Vector3 surfaceNormal, float rotationAngleInDegrees) | |
{ | |
// Set the up direction of the object's transform to the surface normal | |
transform.up = surfaceNormal; | |
// Calculate the rotation axis as the object's up direction | |
Vector3 rotateAxis = transform.up; | |
// Calculate the rotation angle in radians | |
float rotationAngleInRadians = Mathf.Deg2Rad * rotationAngleInDegrees; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Make all reffs are already serialized that are to be used when OnAfterDeserialize() is called. | |
public bool IsReady { get => isInitialized && Cells.Count > 0; } | |
public Config_CellData Storage { get => cellDataStorage; } | |
public bool IsInitialized { get => isInitialized; private set => isInitialized = value; } | |
[SerializeField] | |
private bool isInitialized = false; | |
[SerializeField] | |
private Config_CellData cellDataStorage = null; |
NewerOlder