Coder Social home page Coder Social logo

unitypackage_godot's Introduction

UnityPackage For Godot


Synty in Unity

Synty in Godot


Notes

  • This has only been tested with Godot 4.0.3 on macOS 13
    • And Godot 4.0.2 on Windows 10
  • Main scene in res://unitypackage_godot/scenes/main.tscn
  • Uncheck Immediate Load Assets in res://unitypackage_godot_config.tres to only load what is opened in the UI
  • *.unity files are converted if they are manually loaded in the UI
  • Each node is tagged with a meta named ufile_ids, containing a list of {guid}:{component} values mapping back to the original Unity component.

How to use

Initial setup:

  • Clone this repo and add compiled unitypackage_util and FBX2glTF to the root of the project
  • Check Inspector for res://unitypackage_godot_config.res
    • Debug Log:
      • "On" for flashy console logs and debugging
      • "Off" to run a little faster
    • Immediate Load Assets:
      • "On" to build all prefabs/materials when loading packages
      • "Off" to only build assets selected in the file picker
      • .unity files must be manually selected to build either way
    • Default Open Path: Optional default location for file open dialog

Import UnityPackage:

  • Run the project
  • Press Import UnityPackage button in upper left
  • Select a .unitypackage file
  • Let it load
  • Explore assets in the pack
  • Close it or stop running
  • Let the freshly imported assets actually import
  • Explore the assets that are now in the project itself, default location: res://imports/
    • Each UnityPackage generates a folder
    • Each folder contains catalog.json as a cached file to load faster next run
    • Each folder contains location.txt pointing to where the UnityPackage file is located

Fixing Import Code:

  • Adjust the import code
  • Clear out what needs to be reimported in res://imports/
    • Individual files can be deleted to speed up the process
  • Run & import again
  • Submit your fixes back to the repo

How it works

  • OS.execute is used to call unitypackage_util
  • unitypackage_util {PACKAGE} dump retrieves all the packed file data
  • unitypackage_util {PACKAGE} extract {GUID} --json is used to extract individual yaml files as json
  • unitypackage_util {PACKAGE} extract {GUID} --fbx2gltf --base64 is used to extract fbx files, converted to glb, in base64 format
  • Assets in the UI are tracked by GUID and extracted
  • JSON data is walked to rebuild in native format, extracting more files as necessary
  • Models, meshes, images, materials, scenes(?? *.unity files), prefabs, are saved to disk as they are loaded/converted
  • FBX2glTF was modified to allow stdin/stdout, and to store pivot/transform-origin on each node
  • PivotFixer(GLTFDocumentExtension) uses this extra stored data to apply transform origin, later used when building the MeshInstance3D nodes
  • Left-to-right hand conversions are handled by -X positions and -X/-W quaternions
  • macOS uses pipes to communicate between unitypackage_util and FBX2glTF
    • Windows requires using a temp file for this, temporarily created in the config Extract Path folder.

Shaders

Original shaders are stored in .txt files along-side new placeholder shaders. Uniforms from the original shader are copied into the placeholder so materials maintain their shader properties. Shader property values are also set as meta data on the materials as backup.

Currently Implemented

Components:

  • GameObject
  • MeshFilter
  • MeshRenderer
  • SkinnedMeshRenderer
  • Transform
  • Stripped Transform
  • Light
  • Camera

Importers:

  • DefaultImporter
  • ModelImporter
  • NativeFormatImporter
  • PrefabImporter
  • TextureImporter
  • ShaderImporter (See Shaders section)
  • AudioImporter

Known Issues

See: https://github.com/barcoderdev/unitypackage_godot/issues

unitypackage_godot's People

Contributors

barcoderdev avatar yedpodtrzitko avatar

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.