Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UObject.Find is not a function #26

Closed
mflux opened this issue Jan 18, 2016 · 9 comments
Closed

UObject.Find is not a function #26

mflux opened this issue Jan 18, 2016 · 9 comments

Comments

@mflux
Copy link

mflux commented Jan 18, 2016

Hi Nako, I've updated to the latest version and encountered this problem:

Error: TypeError: UObject.Find is not a function
Error:     at register (C:\Program Files (x86)\Epic Games\4.10\Engine\Plugins\UnrealJS\Content\Scripts\uclass.js:57:30)
Error:     at compile (C:/Users/Flux/Documents/Unreal Projects/CPCS/Content/Scripts/cpcsruntime.js:10:20)

UnrealJS exists here: C:\Program Files (x86)\Epic Games\4.10\Engine\Plugins\UnrealJS

Which I've unzipped from UnrealJS.Prebuilt.4.10.1-20160106-1

The line from which eventually reaches that is:

function compile( cl ){
  return uclass()( global, cl );
}

Which I've copied from one of your examples.

@mflux
Copy link
Author

mflux commented Jan 18, 2016

I switched back to UnrealJS.Prebuild.4.10-hotfix-20151127-1 and it appears to have fixed the issue. I assume something is wrong with the newer build?

@nakosung
Copy link
Collaborator

I rebuilt and uploaded a new build, please check again with the new build. (Unfortunately there is no automated test yet)

@mflux
Copy link
Author

mflux commented Mar 3, 2016

Hi Nako, thanks for the new build. I've tried it again and am getting the same issue.

Is it something with my install that's incorrect? Content/Scripts should be in the Plugins folder, and then what else should be in my game's Content/Scripts folder?

@nakosung
Copy link
Collaborator

nakosung commented Mar 3, 2016

There should be 'aliases.js' in GameContent/Scripts.

        Context.WriteAliases(Context.Paths[0] + 'aliases.js')

        Context.RunFile('aliases.js')
        Context.RunFile('polyfill/unrealengine.js')
        Context.RunFile('polyfill/timers.js')

:)

@mflux
Copy link
Author

mflux commented Mar 4, 2016

I do have that. One thing I noticed that was a source of confusion was that there are two Content/Scripts folders, one in the Plugin/UnrealJS and the other in Plugin/UnrealJS/Examples

screenshot 2016-03-03 17 26 23

What I did in the previous version was I copied the working example files in Content/Scripts folder to my project's Content/Scripts folder and then started building from there. Am I doing this correctly?

Where is this:

    Context.WriteAliases(Context.Paths[0] + 'aliases.js')

    Context.RunFile('aliases.js')
    Context.RunFile('polyfill/unrealengine.js')
    Context.RunFile('polyfill/timers.js')

Supposed to be?

@mflux
Copy link
Author

mflux commented Mar 4, 2016

I see now where the Context.RunFile is (bootstrap). However the aliases.js seem to be missing UObject.prototype.Find

UObject.prototype.Modify = UObject.prototype.ModifyObject;
UObject.prototype.ClearTimerbyFunctionName = UObject.prototype.K2_ClearTimer;
UObject.prototype.GetTimerElapsedTimebyFunctionName = UObject.prototype.K2_GetTimerElapsedTime;
UObject.prototype.GetTimerRemainingTimebyFunctionName = UObject.prototype.K2_GetTimerRemainingTime;
UObject.prototype.IsTimerActivebyFunctionName = UObject.prototype.K2_IsTimerActive;
UObject.prototype.IsTimerPausedbyFunctionName = UObject.prototype.K2_IsTimerPaused;
UObject.prototype.PauseTimerbyFunctionName = UObject.prototype.K2_PauseTimer;
UObject.prototype.SetTimerbyFunctionName = UObject.prototype.K2_SetTimer;
UObject.prototype.DoesTimerExistbyFunctionName = UObject.prototype.K2_TimerExists;
UObject.prototype.UnpauseTimerbyFunctionName = UObject.prototype.K2_UnPauseTimer;
UObject.prototype.ToString = UObject.prototype.Conv_ObjectToString;
UObject.prototype.Equal = UObject.prototype.EqualEqual_ObjectObject;
UObject.prototype.NotEqual = UObject.prototype.NotEqual_ObjectObject;
UObject.prototype.GetClass = UObject.prototype.GetObjectClass;

@mflux
Copy link
Author

mflux commented Mar 4, 2016

I've tried running HelloBlueprint example and that one is failing as well it seems.

screenshot 2016-03-03 18 02 58

@mflux
Copy link
Author

mflux commented Mar 4, 2016

Alright I was able to get it working again by reverting to the old unrealEngineClassId global method you had in an earlier uclass.js.

module.exports = function () {
    global.nextUnrealEngineClassId = global.nextUnrealEngineClassId || 0
    function fetchClassId() {
        return global.nextUnrealEngineClassId++
    }

And then...

        // get a classname
        let className = `${orgClassName}_C${fetchClassId()}`;

Instead of using the for loop and then testing UObject.Find, since that is unavailable through aliases. Hopefully we can get a correct fix for this at some point :)

@nakosung
Copy link
Collaborator

nakosung commented Mar 4, 2016

Actually UObject.Find is exposed via JavascriptIsolate_Private.cpp. https://github.com/ncsoft/Unreal.js/blob/master/Plugins/UnrealJS/Source/V8/Private/JavascriptIsolate_Private.cpp#L1442 It isn't a javascript function, so it cannot be available if you have a right build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants