Skip to content

Instantly share code, notes, and snippets.

View ErnSur's full-sized avatar

Ernest Suryś ErnSur

View GitHub Profile
@ErnSur
ErnSur / RemoteConfigResponse.json
Created November 24, 2023 15:06
Remote Config Response
{
"token": "DemoToK3n",
"res": {
"s_manifest_name": "Demo Game",
"s_android_bundle_id": "com.homagames.demo-game",
"s_ios_bundle_id": "com.homagames.demo-game",
"ao_packages": [
{
"s_package_key": "com.homagames.localization",
"s_version_number": "1.0.1",
@ErnSur
ErnSur / FallbackEventSystem.cs
Last active August 26, 2023 14:27
Event system for uGUI singletons
public class FallbackEventSystem : MonoBehaviour
{
private GameObject _fallbackEventSystem;
private void Awake()
{
CreateFallbackEventSystem();
}
private void OnEnable()
@ErnSur
ErnSur / TextUtils.cs
Created July 1, 2023 08:28
Implementation of the `UnityEditor.ObjectNames.NicifyVariableName` algorithm
using System.Text;
namespace QuickEye.Utility
{
public static class TextUtils
{
public static string NicifyVariableName(string input)
{
var result = new StringBuilder(input.Length * 2);
@ErnSur
ErnSur / WorldSpaceUIDocument.cs
Created December 2, 2022 15:25 — forked from Anthelmed/WorldSpaceUIDocument.cs
Until Unity decide to make it official, this is a custom WorldSpaceUIDocument component
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Rendering;
using UnityEngine.UIElements;
using UnityEngine.InputSystem.UI;
#if UNITY_EDITOR
using UnityEditor;
#endif
## To remove all ignored files from repo
# git rm -r --cached .
# git add .
#
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://gist.githubusercontent.com/ErnSur/8112c76adab8633e60db4aff7ca3b8e8/raw/
#
/[Ll]ibrary/
/[Tt]emp/
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CheckNamespace/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:Boolean x:Key="/Default/CodeInspection/Roslyn/LegacySeveritiesMigrated/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Built-in: Full Cleanup</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EMPTY_BLOCK_STYLE/@EntryValue">TOGETHER_SAME_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER<
@ErnSur
ErnSur / MetaFields.cs
Last active June 5, 2022 16:54
Quick, simple and a little dirty way to deserialize visual elements from XML. Created to load custom views in runtime.
using UnityEngine.UIElements;
namespace QuickEye.UIToolkit
{
public class FoldoutMeta : InputFieldMeta<Foldout>
{
protected override void Initialize(Foldout e)
{
base.Initialize(e);
e.text = Label;
@ErnSur
ErnSur / UssExporter.cs
Created May 30, 2022 18:21
Export Unity Editor USS files
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace QuickEye.Editor
{
internal class UssExporter : EditorWindow
@ErnSur
ErnSur / CustomDockAreaButton.cs
Created May 21, 2022 17:37
CustomDockAreaButton
class CustomWindow : EditorWindow
{
// ShowButton is a special EditorWindow message that provides a way to draw buttons in dock area
private void ShowButton(Rect r)
{
EditorGUI.DrawRect(r,Color.cyan);
GUI.Toggle(r, false, GUIContent.none, "IN LockButton");
}
}
@ErnSur
ErnSur / GetGameObjectPath.cs
Created January 18, 2022 15:30
Get GameObject Path
public static class GameObjectUtility
{
public static string GetGameObjectPath(GameObject obj)
{
var path = $"/{obj.name}";
while (obj.transform.parent != null)
{
obj = obj.transform.parent.gameObject;
path = $"/{obj.name}{path}";
}