Skip to content

Commit

Permalink
Merge pull request #25 from 989onan/master
Browse files Browse the repository at this point in the history
Add unity prefabs and Scene importing
  • Loading branch information
dfgHiatus authored Apr 30, 2024
2 parents b40e8d6 + b301f2f commit d5a6d5f
Show file tree
Hide file tree
Showing 20 changed files with 1,154 additions and 518 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ A [ResoniteModLoader](https://github.com/resonite-modding-group/ResoniteModLoade

## Installation
1. Install [ResoniteModLoader](https://github.com/resonite-modding-group/ResoniteModLoader).
1. Place [UnityPackageImporter.dll](https://github.com/dfgHiatus/ResoniteUnityPackagesImporter/releases/latest/download/UnityPackageImporter.dll) into your `rml_mods` folder. This folder should be at `C:\Program Files (x86)\Steam\steamapps\common\Resonite\rml_mods` for a default install. You can create it if it's missing, or if you launch the game once with ResoniteModLoader installed it will create the folder for you.
1. Start the game. If you want to verify that the mod is working you can check your Resonite logs.
2. Place [UnityPackageImporter.dll](https://github.com/dfgHiatus/ResoniteUnityPackagesImporter/releases/latest/download/UnityPackageImporter.dll) into your `rml_mods` folder. This folder should be at `C:\Program Files (x86)\Steam\steamapps\common\Resonite\rml_mods` for a default install. You can create it if it's missing, or if you launch the game once with ResoniteModLoader installed it will create the folder for you.
3. Put [The contents of this zip](https://ci.appveyor.com/api/buildjobs/mk8takud6nqne47k/artifacts/YamlDotNet%2Fbin%2FRelease%2FRelease-Net47.zip) into your `rml_libs` folder. This folder should be at `C:\Program Files (x86)\Steam\steamapps\common\Resonite\rml_mods` for a default install. You can create it if it's missing, or if you launch the game once with ResoniteModLoader installed it will create the folder for you.
4. Start the game. If you want to verify that the mod is working you can check your Resonite logs.

## FAQs
1. <b>What does this mod do exactly?</b> This mod solely extracts the assets of Unity Packages and imports them into Resonite
1. <b>Will this mod setup avatars for me?</b> No, you'll need to set them up normally.
1. <b>Will this mod setup avatars for me?</b> No, you'll need to set them up normally. It will do materials and textures though sometimes.
1. <b>What kind of unity packages can I import?</b> Anything! Avatar packages, world packages, anything you can think of!
1. <b>Will this mod run on the Linux version of the game?</b> Yes
1. <b>How many packages can I import at once?</b> In theory you should be able to import many at once, but in my experience one at a time is your best friend here given the <i>massive</i> file size Unity Packages can be
Expand All @@ -24,15 +25,13 @@ Presently, it supports:
- Fonts
- Videos
- And raw binary variants of the above for file sharing
- Prefabs (ALPHA)
- Scenes (ALPHA)
9. <b>What will this mod NOT import?</b>
- Prefabs
- Scenes
- Particle systems
- Animations/Animators
- Dynamic Bones
- Phys Bones

## Known Issues and Limitations
- This will not work with the legacy file importer. Paste/drag and drop the UnityPackage onto the Resonite window instead
- This doesn't place files under a single root
- This might hang a little bit during import. Recommended to import one unity package at a time, pairs nicely with [ResoniteModSettings](https://github.com/badhaloninja/ResoniteModSettings)
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ public async Task instanciateAsync(IUnityStructureImporter importer)
{

await default(ToWorld);
if(m_CorrespondingSourceObject.guid == null)
if(m_CorrespondingSourceObject.guid == null && frooxEngineSlot == null)
{
frooxEngineSlot = Engine.Current.WorldManager.FocusedWorld.AddSlot(this.m_Name);
frooxEngineSlot = importer.unityProjectImporter.world.AddSlot(this.m_Name);
frooxEngineSlot.SetParent(importer.CurrentStructureRootSlot, true); //let user managers not freak out that we're doing stuff in root.
frooxEngineSlot.ActiveSelf = m_IsActive == 1 ? true : false;
}
else if(frooxEngineSlot != null) //if being instanciated through prefab import while still in prefab hashes. Since it will have modifications done to it but have an in world object still.
{
frooxEngineSlot.ActiveSelf = m_IsActive == 1 ? true : false;
frooxEngineSlot.Name = this.m_Name;
}
else
{
if(importer.existingIUnityObjects.TryGetValue(m_PrefabInstance["fileID"], out IUnityObject prefab_inc))
Expand All @@ -44,7 +49,13 @@ public async Task instanciateAsync(IUnityStructureImporter importer)
await default(ToBackground);
if (prefab.PrefabHashes.TryGetValue(m_CorrespondingSourceObject, out IUnityObject existingobject))
{
this.frooxEngineSlot = (existingobject as GameObject).frooxEngineSlot;
GameObject existing = (existingobject as GameObject);
await default(ToWorld);
this.m_Name = existing.m_Name;
this.frooxEngineSlot = existing.frooxEngineSlot;
this.frooxEngineSlot.Name = this.m_Name;
this.frooxEngineSlot.ActiveSelf = existing.m_IsActive == 1;
await default(ToBackground);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace UnityPackageImporter.FrooxEngineRepresentation.GameObjectTypes
{
public class MonoBehavior : IUnityObject
public class MonoBehaviour : IUnityObject
{
public ulong id { get; set; }
public bool instanciated { get; set; }
Expand Down
Loading

0 comments on commit d5a6d5f

Please # to comment.