Skip to content

Instantly share code, notes, and snippets.

Avatar
🍌
Working from home

spilat12 SiarheiPilat

🍌
Working from home
View GitHub Profile
@SiarheiPilat
SiarheiPilat / NcSimpleDialogueUi.cs
Created Jan 23, 2023
Simple UI script for NodeCanvas dialogue tree.
View NcSimpleDialogueUi.cs
using System.Collections.Generic;
using UnityEngine;
using NodeCanvas.DialogueTrees;
using TMPro;
using UnityEngine.UI;
using NodeCanvas.Framework;
public class NcSimpleDialogueUi : MonoBehaviour
{
public TextMeshProUGUI NarrationText;
@SiarheiPilat
SiarheiPilat / FindCustomScriptsEditor.cs
Last active Jan 23, 2023
Find all custom scripts in the hierarchy of the current scene, show as a list of buttons, user can ping the object by clicking a button. Omits native Unity components.
View FindCustomScriptsEditor.cs
using UnityEngine;
using UnityEditor;
using System;
namespace Suasor
{
public class FindCustomScriptsEditor : EditorWindow
{
Vector2 scrollPosition;
public string[] Strings = new string[4] {"BreakableHelper", "ObjectColor", "StickerController", "Obi" }; // REPLACE THIS WITH LIST EDITABLE
@SiarheiPilat
SiarheiPilat / post-build-push-ipa-appstore.bash
Created Jun 3, 2022
Automates cloud build upload to iTunes Connect
View post-build-push-ipa-appstore.bash
#!/bin/bash
echo "Uploading IPA to Appstore Connect..."
# Taken from this great thread: https://forum.unity.com/threads/path-to-the-final-ipa-file.754331/
#Path is "/BUILD_PATH/<ORG_ID>.<PROJECT_ID>.<BUILD_TARGET_ID>/.build/last/<BUILD_TARGET_ID>/build.ipa"
path="$WORKSPACE/.build/last/$TARGET_NAME/build.ipa"
if xcrun altool --upload-app --type ios -f $path -u $ITUNES_USERNAME -p $ITUNES_PASSWORD ; then
echo "Upload IPA to Appstore Connect finished with success"
else
@SiarheiPilat
SiarheiPilat / ExcemptFromEncryption.cs
Created Jun 3, 2022
Automates encryption compliance setting for iOS builds.
View ExcemptFromEncryption.cs
using UnityEngine;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor;
using UnityEditor.iOS.Xcode;
using System.IO;
public class ExcemptFromEncryption : IPostprocessBuildWithReport // Will execute after XCode project is built
{
public int callbackOrder { get { return 0; } }
View CameraTargetOrientationScript.cs
/***************************************************************/
/********** Simple target orientation camera script. ***********/
/*** You can change parameters, such as rotation/zoom speed. ***/
/***************************************************************/
// Original: https://github.com/steaklive/Orbit-Camera-for-Unity-Demos
using UnityEngine;
using System.Collections;
@SiarheiPilat
SiarheiPilat / CoolButton.cs
Last active May 29, 2022
Replacement for a TextMeshPRO button that will automatically change button text.
View CoolButton.cs
using UnityEngine;
using UnityEngine.UI;
using TMPro;
/// Original: https://gist.github.com/SiarheiPilat/e4fa93c97d31d8d0e2d18f34e0e2abe9
/// Author: Siarhei Pilat
/// Date: 29-05-2022
/// License: MIT
[ExecuteAlways]
View ReadWriteModelPostprocessor.cs
using UnityEditor;
using UnityEngine;
public class ReadWriteModelPostprocessor : AssetPostprocessor
{
void OnPreprocessModel()
{
Debug.Log("Setting Read/Write permission automatically... Delete this script if this is not intended.");
ModelImporter modelImporter = assetImporter as ModelImporter;
modelImporter.isReadable = true;
View EditorCloseWindowTab.cs
// taken from https://forum.unity.com/threads/shortcut-to-close-editor-window-close-tab.1232121/
using UnityEditor;
using UnityEngine;
public class EditorCloseWindowTab : Editor
{
[MenuItem("Shortcuts/Close Window Tab")]
static void CloseTab()
{
View UnityGuidRegeneratorMenu.cs
// taken from https://answers.unity.com/questions/460530/forcing-a-guid-to-regeneraterefresh.html
using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
namespace UnityGuidRegenerator {
public class UnityGuidRegeneratorMenu {
[MenuItem("Tools/Regenerate asset GUIDs")]
@SiarheiPilat
SiarheiPilat / AutoSave.cs
Last active Sep 5, 2022
future release of autosaver sua
View AutoSave.cs
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace Suasor
{
// TODO:
// editor settings window
// rate button