ncsoft / Unreal.js

Unreal.js: Javascript runtime built for UnrealEngine
Other
3.61k stars 345 forks source link

Struct keys have spaces stripped out on packaging #187

Open mflux opened 6 years ago

mflux commented 6 years ago

I have a custom struct type:

screenshot 2017-09-18 14 21 39

When accessing via JS in editor, everything looks good:

{
  "mesh": "/Game/Geometry/market/nightfood_02.nightfood_02",
  "instanced": false,
  "width": 1,
  "height": 1,
  "tags": {
    "very poor": false,
    "poor": false,
    "average": false,
    "wealthy": false,
    "very wealthy": false,
    "rooftop": false,
    "industrial main": false,
    "industrial support": false,
    "industrial silo": false,
    "industrial cooling": false,
    "smokestack": false,
    "house": false,
    "nature": false,
    "balcony": false,
    "window": false,
    "ad": false,
    "chimneys": false,
    "slumchunk": false,
    "market": true,
    "police": false,
    "parking": false
  },
  "name": "nightfood_02"
}

When packaged... the struct names are mangled:

{
  "mesh": "/Game/Geometry/parking/parking_police.parking_police",
  "instanced": true,
  "width": 1,
  "height": 1,
  "tags": {
    "verypoor": false,
    "poor": false,
    "average": false,
    "wealthy": false,
    "verywealthy": false,
    "rooftop": false,
    "industrialmain": false,
    "industrialsupport": false,
    "industrialsilo": false,
    "industrialcooling": false,
    "smokestack": false,
    "house": false,
    "nature": false,
    "balcony": false,
    "window": false,
    "ad": false,
    "chimneys": false,
    "slumchunk": false,
    "market": false,
    "police": true,
    "parking": true
  },
  "name": "parking_police"
}

It looks like spaces are removed. I'm not sure about casing. Related issue #185

What can we do about this? Please help! :) Still trying to package. Not giving up easily.

nakosung commented 6 years ago

Actually FName has several restrictions. (It might include some-space-prohibition) I suggest that you would be better to follow certain rules to avoid unexpected problems like these.

Blueprint editor lets you have weird names which are usually not permitted by UE4, just because UE4 BP editor does some dirty works to make it happen. (They store illegal names in UMETA)

mflux commented 6 years ago

Got it. I changed all my spaces to underscores to avoid the issue, it was an undocumented and unexpected gotcha though!

I also noticed that some all caps words become translated to first letter caps... like JSON becomes Json in packaged game 🙀 On Tue, Sep 19, 2017 at 7:55 PM Nako Sung notifications@github.com wrote:

Actually FName has several restrictions. (It might include some-space-prohibition) I suggest that you would be better to follow certain rules to avoid unexpected problems like these.

Blueprint editor lets you have weird names which are usually not permitted by UE4, just because UE4 BP editor does some dirty works to make it happen. (They store illegal names in UMETA)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ncsoft/Unreal.js/issues/187#issuecomment-330730970, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_j0Kpmq6JGvmmfOYQxnTLHwHQb7Sa0ks5skH6WgaJpZM4PbjNX .