Giter Club home page Giter Club logo

puerts_unreal_demo's People

Contributors

chexiongsheng avatar fishorbear avatar primaryfantasty avatar zombieyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

puerts_unreal_demo's Issues

Canvas构造函数的问题,类似的对象很多

class Canvas extends Object {
constructor(Outer?: Object, Name?: string, ObjectFlags?: number);
ts中的Canvas 构造函数需要提供3个参数,可是没有文档说明这3个参数是怎么传递的还是说随意传值,是否需要阅读c++源码才行

作者能分享几个wasm的C++代码吗

自己在测试C++ 转的wasm 和 JS 实现的接口的效率,但一直生成不了合格的wasm,普通C++的则OK。 特请教下作者,项目中和UE相关的几个wasm是怎么生成的呢,非常感谢车神的解惑!

tsx文件的更改无法被PurtesEditor更新

尝试使用内置的react-umg开发UI,发现每次更改.tsx文件后,editor并不能自动更新,即使手动跑了tsc命令也无济于事,目前只发现两种办法可以刷新更新后的tsx文件

  1. 文件重新命名,重新使用tsc生成(手动移除content/javascript下的js文件也不行,只能重命名)
  2. 重启UEEditor

以下是我的操作步骤:

  1. clone到本地
  2. 在如下地方跑了npm install:
    根目录
    Content/Javascript
    Content/Javascript/PuertsEditor
  3. 打开uproject之后开启了PuertsEditor Module Enabled,没有开其他debug的东西
    本地环境:
  4. windows 10
  5. node 12.18.2
  6. npm 6.14.5
  7. Unreal 26.1

此外,有没有办法可以手动根据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的引用吗?

在开启PuertsSetting.Enable开关后,DebugEditor启动报错,且退出时存在崩溃。

环境

分支: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使用的有一些函数已经不能用了,希望可以更新一下,万分感谢!

[4.26] 蓝图生成的TsTestActor无法双击打开

问题出现在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>()

UE4.24.3打开Demo失败

打开过程中提示
Tips
tips2
本机node 版本: Node.js v14.5.0
VS版本 : VS2019
系统 : Windows 10 64-bit (10.0, Build 19041) (19041.vb_release.191206-1406)

VSCode调试配置可以具体些吗,官方文档的介绍太少了

1.要安装哪些插件
2.要配置哪些json文件
3.要配置ts-node或者V8吗
4.//GameScript = MakeSharedpuerts::FJsEnv(std::make_uniquepuerts::DefaultJSModuleLoader(TEXT("JavaScript")), std::make_sharedpuerts::FDefaultLogger(), 8080);
这行代码需要取消注释吗,端口8080需要在vscode中哪里进行配置吗

Demo原生,无法用AnotherActor继承Blueprint

很奇怪,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;

win7 vs2017 编译demo报错

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.在去启动项目

unreal 5.2内存泄漏

16871392364485
unreal 5.2版本打开工程后,直接运行TsGameInstance,跑通后无异常并停止运行,工程打开后内存会不断增长,最后出现out of memory错误。
另外unreal 4.27.2版本不会出现这种问题。

4.25.4, 4.26.2均无法双击直接打开

报错信息

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.

unrealVersionSelector.log

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]

UI无法启动 版本(4.21 Win10)

最开始的错误

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也是不行的,似乎得正确的提供这个文件

在Generator目录运行 python main.py无法运行通过(附 报错信息)

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'

bug

进入Editor界面之后,每次点击Compile,QuickStart.ts中的Add,Bar等方法就不能使用,在ue.d.ts中就没有这些方法,但是每次重新打开Editor就有了

撤销C++类的Mixin后没有正常恢复原来的行为

定义一个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还是有问题。

代理的内存泄露bug

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.