Browse Source

added hrt.prefab.Resource.make

Nicolas Cannasse 6 years ago
parent
commit
1e4a736506
1 changed files with 9 additions and 0 deletions
  1. 9 0
      hrt/prefab/Resource.hx

+ 9 - 0
hrt/prefab/Resource.hx

@@ -5,6 +5,8 @@ class Resource extends hxd.res.Resource {
 	var lib : Prefab;
 
 	override function watch( onChanged: Null<Void -> Void> ) {
+		if( entry == null )
+			return;
 		if( onChanged == null ) {
 			super.watch(null);
 			return;
@@ -22,4 +24,11 @@ class Resource extends hxd.res.Resource {
 		return lib;
 	}
 
+	public static function make( p : Prefab ) {
+		if( p == null ) throw "assert";
+		var r = new Resource(null);
+		r.lib = p;
+		return r;
+	}
+
 }