Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/* by FVS - HaLuan */
/// <summary>
/// Run:
/// 1. Add this script to a GameObject
/// 2. Have an internet connection
@FVSHaLuan
FVSHaLuan / CameraVibrator.cs
Last active August 29, 2015 14:27
Vibrate the camera this component is attached with. Call it from other component (attached to the same camera): GetComponent<CameraVibrator>().Vibrate();
using UnityEngine;
using System.Collections;
/* by FVS - HaLuan */
public class CameraVibrator : MonoBehaviour
{
new Camera camera;
@FVSHaLuan
FVSHaLuan / TutorialFogController.cs
Last active August 26, 2015 02:52
** Function: create mesh data which describes a plane with a hole (rectangle) inside.
using UnityEngine;
using System.Collections;
/* by FVS - HaLuan */
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class TutorialFogController : MonoBehaviour
{
public void SetTutorialFog(Vector2 overallSize, Vector2 spotlightPosition, Vector2 spotlightSize)
@FVSHaLuan
FVSHaLuan / FVS-ColorCube.shader
Created August 26, 2015 02:49
**Function: shades a cube with a different color for each edge.
/* by FVS - Ha Luan */
// Usage:
// 1. Create a material using this shader
// 2. Apply the new material to a cube with correct normal vectors defined (a Unity's built-in cube is enough)
Shader "FVS/Color cube" {
SubShader
{
cull off
@FVSHaLuan
FVSHaLuan / ScriptableObjectUtility.cs
Created August 26, 2015 02:56
** Function: This makes it easy to create, name and place unique new ScriptableObject asset files.
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.IO;
/* Found on the Internet */
public static class ScriptableObjectUtility
{
/// <summary>
@FVSHaLuan
FVSHaLuan / StartWithSpecificScene.cs
Last active April 26, 2017 21:34
**Function: - Add menu DoC/Start with first game scene to Unity3D editor main menus. - The menu starts playing your game from the specified scene and brings you back to the scene you were editting when stop playing
using UnityEngine;
using System.Collections;
using UnityEditor;
/* by FVS - Ha Luan */
public class StartWithSpecificScene : Editor
{
const string settingKey = "FVSHaluanStartWithSpecificScene";
const string firstScenePath = "Assets/Scenes/Login.unity";
@FVSHaLuan
FVSHaLuan / Debugf.cs
Last active September 24, 2015 12:51
**Function: Print some text to screen when run game on real devices. Must be built in Development build to take effect (that's good because you don't have to care about removing it in final build)
using UnityEngine;
using System.Collections;
/* by FVS - Ha Luan */
public class Debugf : MonoBehaviour
{
#region Instance
static Debugf instance = null;
static Debugf Instance
@FVSHaLuan
FVSHaLuan / SortingLayerSetter.cs
Last active October 13, 2015 07:47
**Function: Expose Sorting layer & Sorting Id in layer properties in inspector for any kind of renderer. **Usage: put SortingLayerSetterEditor.cs into any folder named Editor, add SortingLayerSetter to a GameObject with a render component attached (SpriteRenderer, MeshRenderer,...). **Disclaimer: I just extracted, learned and customized the code…
using UnityEngine;
using System.Collections;
public class SortingLayerSetter : MonoBehaviour {
}
@FVSHaLuan
FVSHaLuan / DumbMesh.cs
Last active October 25, 2015 07:42
**Function: creating a mesh data for god's sake
using UnityEngine;
[RequireComponent(typeof(MeshFilter))]
[ExecuteInEditMode]
public class DumbMesh : MonoBehaviour
{
void Start()
{
GenerateMesh();
}
@FVSHaLuan
FVSHaLuan / InspectorListUtility.cs
Created October 1, 2021 16:33
Copy-pasting list between Unity editor and any other text editor
/// <summary>
/// made by FVS, for Beat Stickman: Beyond project
/// Visit the game at: https://store.steampowered.com/app/1494280/Beat_Stickman_Beyond
/// ________________
/// ***Prerequisite:
/// - Place this file under an Editor folder in your Unity project
/// ________________
/// ***Copy a list from Unity to a text editor:
/// 1. Copy the list in the inspector
/// 2. Go to menu: FH/Inspector List/Convert to text list