浏览代码

added copyValue

Nicolas Cannasse 4 年之前
父节点
当前提交
acd67fdd71
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      hrt/prefab/Prefab.hx

+ 5 - 0
hrt/prefab/Prefab.hx

@@ -126,6 +126,11 @@ class Prefab {
 		copySerializedFields(p);
 	}
 
+	function copyValue<T>( v : T ) : T {
+		// copy in-depth - might be optimized by macros when called in copy()
+		return haxe.Unserializer.run(haxe.Serializer.run(v));
+	}
+
 	/**
 		Creates an instance for this prefab only (and not its children).
 		Use make(ctx) to creates the whole instances tree;