Skip to content

Instantly share code, notes, and snippets.

View snlehton's full-sized avatar

Sampsa Lehtonen snlehton

View GitHub Profile
@snlehton
snlehton / SOExampleBehaviour2.cs
Created April 2, 2015 14:41
SOExampleBehaviour v2
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class SOExampleBehaviour : MonoBehaviour
{
public SOExample test;
public void OnEnable()
{
// find existing instance if needed
if (test == null)
@snlehton
snlehton / SOExample scene
Created April 2, 2015 14:18
SOExample scene
....
--- !u!114 &819407913 <<--- this is our ScriptableObject id in the scene
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4a48e9db79a952f419ca79d71a03fe31, type: 3}
@snlehton
snlehton / SOExampleBehaviour.cs
Last active August 29, 2015 14:18
SOExample behaviour
using UnityEngine;
using System.Collections;
public class SOExampleBehaviour : MonoBehaviour
{
public SOExample test;
public void OnEnable()
{
// instantiate if needed
if (test == null)
test = ScriptableObject.CreateInstance<SOExample>();
@snlehton
snlehton / SOExample.cs
Last active August 29, 2015 14:18
ScriptableObject example
using UnityEngine;
using System.Collections;
public class SOExample : ScriptableObject
{
public string text;
}