Skip to content

Instantly share code, notes, and snippets.

View PlayMainScene_PrevSceneAutoLoader.cs
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
namespace Custom.Scripts
{
[InitializeOnLoad]
static class PlayMainScene_PrevSceneAutoLoader
{
@c0ffeeartc
c0ffeeartc / DestroyWith.cs
Last active Jan 17, 2021
EventDriven/SystemLess DestroyWith feature for Entitas ECS framework
View DestroyWith.cs
using System;
using Entitas;
using Entitas.CodeGeneration.Attributes;
[Context( Ids.Game )]
[Context(Ids.GameState)] // second context to force generation of EntityApiInterface
public class DestroyWith_Emit : IComponent
{
public Int32 Value;
}
View ITransformController.cs
using System;
using UnityEngine;
public interface ITransformController
{
Vector3 PosWorld { get; set; }
Vector3 PosLocal { get; set; }
Quaternion RotWorld { get; set; }
Quaternion RotLocal { get; set; }
Vector3 ScaleLocal { get; set; }
View gist:0701c18bae3bc316410a
import macros
# macro debug(c: varargs[expr]): stmt =
# result = newNimNode(nnkStmtList, c)
# for i in 0..c.len-1:
# # add a call to the statement list that writes the expression;
# # `toStrLit` converts an AST to its string representation:
# result.add(newCall("write", newIdentNode("stdout"), toStrLit(c[i])))
# # add a call to the statement list that writes ": "
# result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": ")))
View select_mesh_mode_pie.py
bl_info = {
"name" : "Select Mode Pie Menu",
"author" : "Stan Pancakes",
"version" : (0, 1, 0),
"blender" : (2, 72, 0),
"description" : "Custom Pie Menus",
"category" : "3D View",}
import bpy
View ScopeSwapOStream.hpp
#include <iostream>
class ScopeSwapOStream
{
public:
ScopeSwapOStream(const ScopeSwapOStream&&) = delete;
ScopeSwapOStream(const ScopeSwapOStream&) = delete;
ScopeSwapOStream& operator=(const ScopeSwapOStream&&) = delete;
ScopeSwapOStream& operator=(const ScopeSwapOStream&) = delete;