This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Unity.Entities; | |
using UnityEngine; | |
[DisallowMultipleComponent] | |
public class GameObjectEntity : MonoBehaviour | |
{ | |
Entity entity; | |
EntityManager manager; | |
void Awake() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEngine; | |
/// <summary> | |
/// Enumerable component cache with methods for querying components based on their types. | |
/// </summary> | |
class World : IEnumerable<MonoBehaviour> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class HTMLImport extends HTMLElement { | |
#abortController = new AbortController() | |
async connectedCallback() { | |
let src = this.getAttribute("src") | |
if (src === null) { | |
console.warn("<html-import> element requires attribute \"src\"") | |
this.remove() | |
return | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Base class for components. | |
Components are nodes which only store state data. They belong to an entity, and | |
can optionally provide accessor methods, but don't contain any behavior logic. | |
""" | |
class_name Component extends "./ecs_node.gd" | |
func _enter_tree() -> void: | |
if owner != null: | |
# Register entity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
/* | |
using UnityEngine; | |
// Instantiated automatically each scene | |
[Autoload] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
public class RuntimeScriptableObject : ScriptableObject | |
{ | |
#if UNITY_EDITOR | |
string serializedEditorState; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ComponentType, createElement, createContext, useContext } from "react" | |
export const createSingletonHook = <P, S>( | |
useHook: (props: P) => S | |
): [() => S, ComponentType<P>] => { | |
const Context = createContext<S | undefined>(undefined) | |
const SingletonHookProvider: ComponentType<P> = ({ | |
children, | |
...props |