chexiongsheng / puerts_unreal_demo Goto Github PK
View Code? Open in Web Editor NEWunreal demo for puerts
License: MIT License
unreal demo for puerts
License: MIT License
我看了一下UWorld中确实SpawnActor不是UFUNCTION,请问官方用的UE4版本是哪个?4.26有什么替代方案?
现在的UObject对象好像都存在 ObjectMap 中,导致无法被垃圾回收,请问正确的释放UObject 应该如何做呢?
没有找到如何获取IFileManager
class Canvas extends Object {
constructor(Outer?: Object, Name?: string, ObjectFlags?: number);
ts中的Canvas 构造函数需要提供3个参数,可是没有文档说明这3个参数是怎么传递的还是说随意传值,是否需要阅读c++源码才行
新建一个TS项目,可以用截图中的方式调试.
puerts中是不是要配置V8 Profilling?
自己在测试C++ 转的wasm 和 JS 实现的接口的效率,但一直生成不了合格的wasm,普通C++的则OK。 特请教下作者,项目中和UE相关的几个wasm是怎么生成的呢,非常感谢车神的解惑!
尝试使用内置的react-umg开发UI,发现每次更改.tsx
文件后,editor并不能自动更新,即使手动跑了tsc
命令也无济于事,目前只发现两种办法可以刷新更新后的tsx文件
以下是我的操作步骤:
此外,有没有办法可以手动根据ts生成蓝图,我觉得这个目录结构太混乱了,到处都是javascript和typescript相关的文件夹,有没有办法可以把所有JS相关的文件统一到一起?(我pull官方plugin也给我放一堆文件夹)
c++
bool Send(const FArrayBuffer& Buffer, int32& BytesSent)
在ts中定义了BytesSend,调用如下:
let BytesSent = 0; bool bSend = Send(buffer, $ref(BytesSent));
这里,BytesSent在ts中没办法返回,依然为0,但在c++层,已经修改了。
想问一下,支持number的引用吗?
分支:master
IDE:Visual Studio 2019
启动配置:Debug Editor / Win64 / puerts_unreal_demo
DefaultPuerts.ini:
[/Script/Puerts.PuertsSetting]
Enable=True
打开 Puerts Module Enable
开关,以 Debug Editor
启动后,日志中出现以下错误:
[2021.05.31-02.25.15:109][ 0]Puerts: Error: (0x000002814CF2DC10) load module [TsTestGameInstance] exception C:\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:89: Error: can not find [react-reconciler]
Error: can not find [react-reconciler]
at require (C:\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:89:30)
at C:\puerts_unreal_demo\Content\JavaScript\react-umg\react-umg.js:3:20
at executeModule (C:\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:66:9)
at require (C:\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:118:17)
at C:\puerts_unreal_demo\Content\JavaScript\react-umg\index.js:3:18
at executeModule (C:\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:66:9)
at require (C:\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:118:17)
at C:\puerts_unreal_demo\Content\JavaScript\TsTestGameInstance.js:4:21
at executeModule (C:\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:66:9)
at require (C:\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:118:17)
且退出调试时,在FJsEnvImpl::~FJsEnvImpl()
函数释放 DelegateMap
处存在崩溃:
0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
最新版本的puerts和这个demo使用的有一些函数已经不能用了,希望可以更新一下,万分感谢!
问题出现在Constructor()
中的console.warn("TsTestActor.Constructor this.Add", this.Add(33, 44));
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION 0x0000000000000000
UE4Editor_JsEnv!puerts::FFunctionTranslator::Call() [puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\Private\FunctionTranslator.cpp:108]
UE4Editor_JsEnv!puerts::FFunctionTranslator::Call() [puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\Private\FunctionTranslator.cpp:89]
UE4Editor_JsEnv!v8::internal::FunctionCallbackArguments::Call()
UE4Editor_JsEnv!v8::internal::CustomArguments<v8::FunctionCallbackInfo<v8::Value> >::GetReturnValue<v8::internal::Object>()
引擎版本:UE 4.26.1
在Project Settings中无法选择使用TsTestGameInstance这个类。
1.要安装哪些插件
2.要配置哪些json文件
3.要配置ts-node或者V8吗
4.//GameScript = MakeSharedpuerts::FJsEnv(std::make_uniquepuerts::DefaultJSModuleLoader(TEXT("JavaScript")), std::make_sharedpuerts::FDefaultLogger(), 8080);
这行代码需要取消注释吗,端口8080需要在vscode中哪里进行配置吗
我想在c++执行字符串形式的javascript代码,但是无法获取到当前的主isolate。
FJsEnvImpl里面存有MainIsolate但是是private,而且FjsEnv里面的FJsEnvImpl对象也是private,无从下手啊。有知道的吗?
如题,有没有办法可以保持引用呢?
另外,我需要引用场景里的actor,所以有没有办法让生成的属性勾上"Instance Editable"?
很奇怪,QuickTest里面可以成功用JS继承blueprint,但是如果用JS Blueprint来继承则返回错误
Puerts: Warning: (0x000002F2B58F7FD0) JS Execution Exception: E:\Unreal\xiuxian\client\puerts_unreal_demo\Content\JavaScript\puerts\uelazyload.js:23: Error: TestBlueprint_C is blueprint type, load it using puerts.blueprint.
Error: TestBlueprint_C is blueprint type, load it using puerts.blueprint.
at Object.get (E:\Unreal\xiuxian\client\puerts_unreal_demo\Content\JavaScript\puerts\uelazyload.js:23:38)
at getUClassOfType (E:\Unreal\xiuxian\client\puerts_unreal_demo\Content\JavaScript\PuertsEditor\CodeAnalyze.js:1042:30)
at E:\Unreal\xiuxian\client\puerts_unreal_demo\Content\JavaScript\PuertsEditor\CodeAnalyze.js:1014:54
at visitNodes (E:\Unreal\xiuxian\client\puerts_unreal_demo\Content\JavaScript\PuertsEditor\node_modules\typescript\lib\typescript.js:16514:30)
at Object.forEachChild (E:\Unreal\xiuxian\client\puerts_unreal_demo\Content\JavaScript\PuertsEditor\node_modules\typescript\lib\typescript.js:16742:24)
at onSourceFileAddOrChange (E:\Unreal\xiuxian\client\puerts_unreal_demo\Content\JavaScript\PuertsEditor\CodeAnalyze.js:1004:28)
at E:\Unreal\xiuxian\client\puerts_unreal_demo\Content\JavaScript\PuertsEditor\CodeAnalyze.js:941:29
AnotherActor被改为如下:
import * as UE from "ue";
import { blueprint } from "puerts";
const TestBlueprint = blueprint<typeof UE.TestBlueprint_C>(
"/Game/StarterContent/TestBlueprint.TestBlueprint_C"
);
class AnotherActor extends TestBlueprint {
//注意,继承UE类的js类,构造函数必须大写开头
Constructor() {
console.warn("AnotherActor.Constructor");
}
//override 1
ReceiveBeginPlay(): void {
console.warn("AnotherActor.ReceiveBeginPlay");
}
}
export default AnotherActor;
UE引擎版本 4.26.2
win7系统 vs2017
更新到最新版本 编译报错
1>S:/Code/macmini/Game/UE4/puerts/puerts_unreal_demo_check/Plugins/Puerts/Source/JsEnv/Private/PesapiAddonLoad.cpp(107): error C2894: 模板不能声明为有“C”链接
1>S:/Code/macmini/Game/UE4/puerts/puerts_unreal_demo_check/Plugins/Puerts/Source/JsEnv/Private/PesapiAddonLoad.cpp(111): error C2894: 模板不能声明为有“C”链接
1.打开JsProj
目录,输入npm i typescript
2.将package.json
改成下面的代码.
{
"name": "tgamejs-demo",
"version": "0.0.1",
"description": "tgamejs demo.",
"scripts": {
"build": "tsc"
},
"author": "johnche",
"license": "MIT",
"dependencies": {
"@types/mocha": "^7.0.1",
"@types/react": "^15.6.6",
"@types/react-reconciler": "^0.18.0",
"typescript": "^4.0.2"
},
"devDependencies": {}
}
3.控制台输入npm run build
4.在去启动项目
12号的可以,那个jsclass register.好对v8引用有几个错误
Running D:/UnrealEngine/UE_4.25/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project="D:/xxxxx/Documents/Unreal Projects/puerts_unreal_demo/puerts_unreal_demo.uproject" -game -rocket -progress -log="D:\xxxx\Documents\Unreal Projects\puerts_unreal_demo/Saved/Logs/UnrealVersionSelector-2021.04.22-09.15.11.log"
Discovering modules, targets and source code for project...
While compiling D:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Intermediate\Build\BuildRules\puerts_unreal_demoModuleRules.dll:
d:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\JsEnv.Build.cs(116,17) : warning CS0618: ??UnrealBuildTool.ModuleRules.PublicLibraryPaths???ѹ?ʱ:??For external libraries use the full path in PublicAdditionalLibraries, if its a system library then use PublicSystemLibraries/PublicSystemLibraryPaths??
d:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\JsEnv.Build.cs(118,17) : warning CS0618: ??UnrealBuildTool.ModuleRules.PublicLibraryPaths???ѹ?ʱ:??For external libraries use the full path in PublicAdditionalLibraries, if its a system library then use PublicSystemLibraries/PublicSystemLibraryPaths??
d:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\JsEnv.Build.cs(306,9) : warning CS0618: ??UnrealBuildTool.ModuleRules.Definitions???ѹ?ʱ:??The 'Definitions' property has been deprecated. Please use 'PublicDefinitions' instead.??
d:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\JsEnv.Build.cs(307,9) : warning CS0618: ??UnrealBuildTool.ModuleRules.Definitions???ѹ?ʱ:??The 'Definitions' property has been deprecated. Please use 'PublicDefinitions' instead.??
ERROR: Windows SDK must be installed in order to build this target.
WindowsPlatformFactory.RegisterBuildPlatforms: UnrealBuildTool.WindowsPlatformSDK using manually installed SDK
ProjectFileGenerator.GenerateProjectFiles: Discovering modules, targets and source code for project...
WindowsPlatform.FindVSInstallDirs: Found Visual Studio installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community (Product=Microsoft.VisualStudio.Product.Community, Version=16.8.30804.86, Sort=0)
WindowsPlatform.FindToolChainDirs: Found Visual Studio toolchain: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333 (Version=14.28.29335)
DynamicCompilation.RequiresCompilation: Compiling D:\UnrealEngine\UE_4.25\Engine\Intermediate\Build\BuildRules\UE4Rules.dll: Removed source file (D:\Build\++UE4\Sync\Engine\Source\Runtime\Advertising\Advertising\Advertising.Build.cs)
DynamicCompilation.RequiresCompilation: Compiling D:\UnrealEngine\UE_4.25\Engine\Intermediate\Build\BuildRules\UE4ProgramRules.dll: Removed source file (D:\Build\++UE4\Sync\Engine\Source\Programs\BenchmarkTool\BenchmarkTool.Build.cs)
DynamicCompilation.RequiresCompilation: Compiling D:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Intermediate\Build\BuildRules\puerts_unreal_demoModuleRules.dll: Assembly does not exist
DynamicCompilation.CompileAssembly: While compiling D:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Intermediate\Build\BuildRules\puerts_unreal_demoModuleRules.dll:
DynamicCompilation.CompileAssembly: d:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\JsEnv.Build.cs(116,17) : warning CS0618: “UnrealBuildTool.ModuleRules.PublicLibraryPaths”已过时:“For external libraries use the full path in PublicAdditionalLibraries, if its a system library then use PublicSystemLibraries/PublicSystemLibraryPaths”
DynamicCompilation.CompileAssembly: d:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\JsEnv.Build.cs(118,17) : warning CS0618: “UnrealBuildTool.ModuleRules.PublicLibraryPaths”已过时:“For external libraries use the full path in PublicAdditionalLibraries, if its a system library then use PublicSystemLibraries/PublicSystemLibraryPaths”
DynamicCompilation.CompileAssembly: d:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\JsEnv.Build.cs(306,9) : warning CS0618: “UnrealBuildTool.ModuleRules.Definitions”已过时:“The 'Definitions' property has been deprecated. Please use 'PublicDefinitions' instead.”
DynamicCompilation.CompileAssembly: d:\xxxxx\Documents\Unreal Projects\puerts_unreal_demo\Plugins\Puerts\Source\JsEnv\JsEnv.Build.cs(307,9) : warning CS0618: “UnrealBuildTool.ModuleRules.Definitions”已过时:“The 'Definitions' property has been deprecated. Please use 'PublicDefinitions' instead.”
WindowsPlatform.EnumerateSdkRootDirs: Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (1)
UnrealBuildTool.Main: ERROR: Windows SDK must be installed in order to build this target.
UnrealBuildTool.Main: BuildException: Windows SDK must be installed in order to build this target.
UnrealBuildTool.Main: 在 UnrealBuildTool.VCEnvironment.Create(WindowsCompiler Compiler, UnrealTargetPlatform Platform, WindowsArchitecture Architecture, String CompilerVersion, String WindowsSdkVersion, String SuppliedSdkDirectoryForVersion) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Platform\Windows\VCEnvironment.cs:行号 491
UnrealBuildTool.Main: 在 UnrealBuildTool.WindowsPlatform.CreateVCEnvironment(TargetRules Target) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Platform\Windows\UEBuildWindows.cs:行号 710
UnrealBuildTool.Main: 在 UnrealBuildTool.WindowsPlatform.ValidateTarget(TargetRules Target) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Platform\Windows\UEBuildWindows.cs:行号 792
UnrealBuildTool.Main: 在 UnrealBuildTool.RulesAssembly.CreateTargetRulesInstance(String TypeName, TargetInfo TargetInfo) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:行号 568
UnrealBuildTool.Main: 在 UnrealBuildTool.RulesAssembly.CreateTargetRules(String TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, String Architecture, FileReference ProjectFile, CommandLineArguments Arguments) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:行号 628
UnrealBuildTool.Main: 在 UnrealBuildTool.ProjectFileGenerator.AddProjectsForAllTargets(PlatformProjectGeneratorCollection PlatformProjectGenerators, List`1 AllGames, List`1 AllTargetFiles, String[] Arguments, ProjectFile& EngineProject, ProjectFile& EnterpriseProject, List`1& GameProjects, Dictionary`2& ProgramProjects) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:行号 2293
UnrealBuildTool.Main: 在 UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String[] Arguments) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:行号 753
UnrealBuildTool.Main: 在 UnrealBuildTool.GenerateProjectFilesMode.Execute(CommandLineArguments Arguments) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:行号 198
UnrealBuildTool.Main: 在 UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) 位置 D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:行号 550
Timeline.Print: Timeline:
Timeline.Print:
Timeline.Print: [ 0.000]
Timeline.Print: [ 0.000](+0.026) <unknown>
Timeline.Print: [ 0.026](+0.081) XmlConfig.ReadConfigFiles()
Timeline.Print: [ 0.108](+0.000) SingleInstanceMutex.Acquire()
Timeline.Print: [ 0.108](+0.121) UEBuildPlatform.RegisterPlatforms()
Timeline.Print: 0.109 [ 0.000](+0.104) Initializing InstalledPlatformInfo
Timeline.Print: 0.213 [ 0.105](+0.000) Querying types
Timeline.Print: 0.214 [ 0.106](+0.001) XXXPlatformFactory
Timeline.Print: 0.216 [ 0.107](+0.000) MacPlatformFactory
Timeline.Print: 0.216 [ 0.107](+0.000) TVOSPlatformFactory
Timeline.Print: 0.216 [ 0.108](+0.000) AndroidPlatformFactory
Timeline.Print: 0.216 [ 0.108](+0.000) HoloLensPlatformFactory
Timeline.Print: 0.216 [ 0.108](+0.000) IOSPlatformFactory
Timeline.Print: 0.216 [ 0.108](+0.000) LinuxPlatformFactory
Timeline.Print: 0.216 [ 0.108](+0.000) LuminPlatformFactory
Timeline.Print: 0.216 [ 0.108](+0.013) WindowsPlatformFactory
Timeline.Print: [ 0.230](+6.469) <unknown>
Timeline.Print: [ 6.699](+0.003) Finding engine modules
Timeline.Print: [ 6.703](+0.003) Finding plugin modules
Timeline.Print: [ 6.706](+0.049) <unknown>
Timeline.Print: [ 6.755](+9.890) Compiling rules assembly (UE4Rules.dll)
Timeline.Print: [16.645](+0.020) <unknown>
Timeline.Print: [16.666](+0.000) Finding program modules
Timeline.Print: [16.667](+0.000) Finding program targets
Timeline.Print: [16.667](+0.028) <unknown>
Timeline.Print: [16.695](+0.189) Compiling rules assembly (UE4ProgramRules.dll)
Timeline.Print: [16.896](+0.166) Compiling rules assembly (puerts_unreal_demoModuleRules.dll)
Timeline.Print: [17.062](+0.097) <unknown>
Timeline.Print: [17.160](+0.000) FileMetadataPrefetch.Stop()
Timeline.Print: [17.162]
最开始的错误
TGameJS: Error: (0x0000019DD8484698) E:\Example\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:59: Error: can not find [react-reconciler]
let moduleInfo = loadModule(moduleName, requiringDir);
然后我
npm i react
npm i react-reconciler
然后的错误是:
TGameJS: Error: (0x0000019DFA913560) E:\Example\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:61: Error: can not find [components.js]
let moduleInfo = loadModule(moduleName, requiringDir);
^
Error: can not find [components.js]
at require (E:\Example\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:61:30)
at E:\Example\puerts_unreal_demo\Content\JavaScript\react-umg\index.js:5:18
at E:\Example\puerts_unreal_demo\Content\JavaScript\react-umg\index.js:12:3
at E:\Example\puerts_unreal_demo\Content\JavaScript\react-umg\index.js:12:134
at executeModule (E:\Example\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:45:16)
at require (E:\Example\puerts_unreal_demo\Content\JavaScript\puerts\modular.js:79:21)
at E:\Example\puerts_unreal_demo\Content\JavaScript\QuickStart.js:5:21
at E:\Example\puerts_unreal_demo\Content\JavaScript\QuickStart.js:181:3
at E:\Example\puerts_unreal_demo\Content\JavaScript\QuickStart.js:181:102
此时我npm i components.js
或者是创建components.js
也是不行的,似乎得正确的提供这个文件
PS E:\Work\puerts_unreal_demo\Plugins\Puerts\Generator> python main.py
('vcxproj_path ', '../../../Intermediate/ProjectFiles/puerts_unreal_demo.vcxproj')
('tree == ', <xml.etree.ElementTree.ElementTree object at 0x03DA6930>)
('root.tag ===', '{http://schemas.microsoft.com/developer/msbuild/2003}Project')
('namespaces ===', {'ns': 'http://schemas.microsoft.com/developer/msbuild/2003'})
Traceback (most recent call last):
File "main.py", line 278, in
main()
File "main.py", line 250, in main
ue_proj = UEProj(opts.project_path)
File "E:\Work\puerts_unreal_demo\Plugins\Puerts\Generator\ue_project.py", line 20, in init
include_search_paths = root.find('ns:PropertyGroup/ns:NMakeIncludeSearchPath', namespaces).text.replace('$(NMakeIncludeSearchPath)', NMakeIncludeSearchPath)
AttributeError: 'NoneType' object has no attribute 'text'
进入Editor界面之后,每次点击Compile,QuickStart.ts中的Add,Bar等方法就不能使用,在ue.d.ts中就没有这些方法,但是每次重新打开Editor就有了
定义一个MyActor类,在Tick中调用声明为BlueprintNativeEvent的TestUFun
// UFUNCTION(BlueprintNativeEvent)
// void TestUFun(double DeltaTime);
void AMyActor::TestUFun_Implementation(double DeltaTime)
{
FRotator Rotator = GetActorRotation();
SetActorRotation(FRotator(0, Rotator.Yaw + DeltaTime * 30, 0));
}
// Called every frame
void AMyActor::Tick(float DeltaTime)
{
TestUFun(DeltaTime);
Super::Tick(DeltaTime);
}
再创建一个蓝图类指定父类为刚刚的MyActor,添加一个StaticMesh组件网格体用自带的Cube。保存,然后拖拽蓝图到默认关卡里命名TestMyActor。
此时运行,可以看到TestMyActor在旋转。
编写一个TS脚本TS_Player,并将编译后的蓝图TS_Player拖拽到默认关卡里
import * as UE from 'ue'
import {$ref, $unref, $set, argv, on, toManualReleaseDelegate, releaseManualReleaseDelegate, blueprint} from 'puerts';
class TS_Player extends UE.Character {
//StaticMesh: UE.StaticMeshComponent;
Constructor() {
// this.MixinCPPClass();
}
MixinCPPClass(): void {
const MixinUE = blueprint.tojs<typeof UE.MyActor>(UE.MyActor.StaticClass());
const MixinTestWithMixin = blueprint.mixin(MixinUE, ExtendMyActor);
}
UnMixinCPPClass(): void
{
const MixinUE = blueprint.tojs<typeof UE.MyActor>(UE.MyActor.StaticClass());
const MixinTestWithMixin = blueprint.unmixin(MixinUE);
}
interface ExtendMyActor extends UE.MyActor {}
class ExtendMyActor {
ReceiveBeginPlay(): void {
console.log("ExtendMyActor ReceiveBeginPlay");
}
TestUFun(delta : number):void {
console.log("ExtendMyActor TS TestUFun");
// this.CallFromTS();
}
}
export default TS_Player;
可以看到这次执行之后之前的TestMyActor不再旋转了,而是不断的输出“ExtendMyActor TS TestUFun”Log。
然后停止运行后,注释掉TS_Player的Constructor调用MixinCPPClass,再次运行。依旧不转,而且也没有Log输出,断点后发现调用回了C++侧的TestUFun,但是参数和Tick的参数对不上,几乎为0。
试过在停止运行前主动调用UnMixinCPPClass还是有问题。
Hey, I am wondering how easy/hard to bind GAS interfaces via puerts ?
https://docs.unrealengine.com/en-US/InteractiveExperiences/GameplayAbilitySystem/GameplayAbility/index.html
Thanks.
import * as UE from 'ue'
import {$ref, $unref, $set, argv, on, toManualReleaseDelegate, releaseManualReleaseDelegate} from 'puerts';
/////////////////////////////////////////////////////////////////////////
let world = (argv.getByName("GameInstance") as UE.GameInstance).GetWorld();
let actor = world.SpawnActor(UE.MainActor.StaticClass(), undefined, UE.ESpawnActorCollisionHandlingMethod.Undefined, undefined, undefined) as UE.MainActor;
function ggg(){
let arr = new Array(1000000);
function MutiCast2(i) {
if(arr){}
}
actor.NotifyWithInt.Add(MutiCast2)
actor.NotifyWithInt.Remove(MutiCast2);
}
for(let i=0;i<10;i++){
ggg()
}
actor = null
QuickStart.ts中使用world.SpawnActor时,Level可能还未被加载,此时生成一个Actor可能会在Level成功加载后被清除。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.