Skip to content

Instantly share code, notes, and snippets.

Ivan Notaros nothke

Block or report user

Report or block nothke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SomeSingletonClass.cs
/// Singleton example
using UnityEngine;
public class SomeSingletonClass : MonoBehaviour
{
public static SomeSingletonClass instance;
void Awake() { instance = this; }
public float someValue;
View IFL_Water.shader
Shader "IFL/DynamicWater" {
Properties {
_ReflectionTex ("Internal reflection", 2D) = "white" {}
_MainTex ("Fallback texture", 2D) = "black" {}
_ShoreTex ("Shore & Foam texture ", 2D) = "black" {}
_BumpMap ("Normals ", 2D) = "bump" {}
_DistortParams ("Distortions (Bump waves, Reflection, Fresnel power, Fresnel bias)", Vector) = (1.0 ,1.0, 2.0, 1.15)
_InvFadeParemeter ("Auto blend parameter (Edge, Shore, Distance scale)", Vector) = (0.15 ,0.15, 0.5, 1.0)
View LODTest.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Collections;
using Unity.Transforms;
using Unity.Rendering;
View Simple wheel spring pseudopicocode
-- variables
suspheight = 10 -- height of suspension
springrate = 10 -- spring stiffness
damprate = 1 -- damping amount
bouncemult = 0 -- bounce when we bottom out, keep between 0-1
velo = 0 -- verticla velocity
y = 100 -- distance from bottom of vehicle to ground
deltatime = 1/30 -- depending on framerate
-- ground is assumed to be at 0
View ClipboardPasteImageExample.cs
/// For this to work you need to copy these 2 files:
/// "YOUR UNITY LOCATION"\Editor\Data\Mono\lib\mono\X.X\System.Drawing.dll
/// "YOUR UNITY LOCATION"\Editor\Data\Mono\lib\mono\X.X\System.Windows.Forms.dll
/// ..to a "Plugins" folder within your project
///
/// For this example to work, you need to have a (UI) Canvas object in your scene
/// Put this script on any object
///
/// Tested on windows, not sure if it works on any other platform
///
View ListRefill.cs
void RefillWithNewStuff()
{
intList.Clear();
intList.Add(3);
intList.Add(4);
}
View PseudoListInitCapacity.cs
List<int> intList;
void Init()
{
intList = new List<int>(2); // 2 is capacity
}
void AddStuff()
{
intList.Add(1);
View PseudoListInit.cs
List<int> intList;
void Init()
{
intList = new List<int>;
}
void AddStuff()
{
intList.Add(1);
View MeshDataInArrays.cs
using UnityEngine;
public class MeshDataInArrays : MonoBehaviour
{
MeshFilter meshFilter;
// Vertex and tris buffers
Vector3[] vertices;
int[] triangles;
View MeshSetAtStart.cs
public class MeshSetAtStart : MonoBehaviour
{
MeshFilter meshFilter;
// Reference to the mesh
Mesh mesh;
void Start()
{
You can’t perform that action at this time.