Skip to content

Instantly share code, notes, and snippets.

View SvDvorak's full-sized avatar

Andreas Wilcox SvDvorak

View GitHub Profile
Shader "Custom/Pixelate" {
Properties
{
_PixelSize("Pixel Size", Float) = 10
_Snapping("Snapping", Int) = 48
_Color("Color", Color) = (1, 1, 1, 1)
}
SubShader
{
@SvDvorak
SvDvorak / SystemSetup.cs
Last active May 19, 2016 09:40
Using extensions to group up systems
public Systems CreateSystems(Pool pool)
{
return SceneSetup.CreateSystem()
.Add(pool.CreateSystem<MoveAndRotateCameraSystem>())
// Adding all animation systems
.AddAnimationSystems(pool)
.Add(pool.CreateSystem<UpdateActingSystem>())
//...
.Add(pool.CreateSystem<DestroySystem>());
}
@SvDvorak
SvDvorak / WaveGenerator.cs
Last active July 8, 2023 02:09
Unity sound wave using line renderers
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// Creates a wave form based on an audiosource
/// Modified version of http://forum.unity3d.com/threads/making-sense-of-spectrum-data.90262
/// Make sure to plug in the _topLine and _bottomLine line renderers
public class WaveGenerator : MonoBehaviour
{
@SvDvorak
SvDvorak / ComponentCode
Created February 16, 2016 18:23
Example for how to create stacked settings
public class SettingsComponent : IComponent
{
public CombinedSettings Settings;
public float Speed { get { return Settings.GetFloat("Speed"); } }
}
public class CombinedSettings
{
private readonly List<Settings> _settingsList = new List<Settings>();
@SvDvorak
SvDvorak / Error
Last active February 15, 2016 10:54
Getting error when shutting down game in editor
MissingReferenceException: The object of type 'EntityBehaviour' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
Entitas.Unity.VisualDebugging.EntityBehaviour.DestroyBehaviour () (at Assets/Libraries/Entitas.Unity.VisualDebugging/Entity/EntityBehaviour.cs:45)
Entitas.Unity.VisualDebugging.EntityBehaviour.onEntityReleased (Entitas.Entity e) (at Assets/Libraries/Entitas.Unity.VisualDebugging/Entity/EntityBehaviour.cs:49)
Entitas.Entity.Release (System.Object owner) (at Assets/Libraries/Entitas/Entity.cs:377)
Entitas.Pool.DestroyEntity (Entitas.Entity entity) (at Assets/Libraries/Entitas/Pool.cs:146)
Entitas.Pool.DestroyAllEntities () (at Assets/Libraries/Entitas/Pool.cs:153)
Entitas.Pool.Reset () (at Assets/Libraries/Entitas/Pool.cs:248)
Assets.TestSetup.OnDestroy () (at Assets/TestSetup.cs:31)