Giter Club home page Giter Club logo

unityassetreplacer's Introduction

UnityAssetReplacer

Build CodeQL Lint

A tool to dump or replace assets in a Unity asset bundle.

Usage

This program requires an uncompressed Unity asset bundle. Use Unity Assets Bundle Extractor Avalonia (UABEA) to decompress an asset bundle if it's compressed. It also requires the name of the member (the field of an object in the assets file, NOT the game object itself) you'd like interact with in the asset bundle (ex. m_Name), except for when you are dealing with textures. The best way to find members/fields for an object is to open the asset bundle in UABEA or a similar tool, then open the asset file and then the object, where you'll find a list of all members for that object. To extract, you also need to set the path of where you'd like to dump to.

To replace assets, you need to specify the path where the assets to import are and the name of the new asset bundle you're exporting. The files inside of the directory must match the asset names exactly in order to be imported.

For a more in-depth tutorial, check out the guide.

Arguments

  • -h, -?, --help: show the help message and then exit.
  • -b, --bundle=BUNDLE: the original asset bundle path you want to read from.
  • -m, --member=MEMBER: the member to dump or replace.
  • -t, --texture: will deal with textures instead of members. Uses PNG the format.

Dumping

  • -d, --dump=DUMP: the path of the directory you wish to dump the assets to.

Replacing

  • -i, --input=INPUT: the input directory of the assets you wish to overwrite with.
  • -o, --output=OUTPUT: the path and name of the asset bundle you wish to write to when replacing.

Examples

  • Dump all assets from assetBundle.bun with member m_Script to extractedAssets/:
    • UnityAssetReplacer -b assetBundle.bun -m m_Script -d extractedAssets
  • Replace assets in assetBundle.bun with member m_Script, reading from newAssets/, to newAssetBundle.bun:
    • UnityAssetReplacer -b assetBundle.bun -m m_Script -i newAssets -o newAssetBundle.bun
  • Dump all textures from assetBundle.bun to extractedTextures/:
    • UnityAssetReplacer -b assetBundle.bun -t -d extractedTextures
  • Replace textures in assetBundle.bun, reading from newTextures/, to newAssetBundle.bun:
    • UnityAssetReplacer -b assetBundle.bun -t -i newTextures -o newAssetBundle.bun

See the guide for how it is used in action.

Building

Requirements

  • .NET 5
  • Visual Studio 2019 (Optional)

Using dotnet

  1. Restore any packages with dotnet restore or skip and let it run implicitly when running the next step.
  2. Run dotnet build in the project root.

Using Visual Studio

  1. Open UnityAssetReplacer.sln in Visual Studio
  2. Press Build -> Build Solution to build or the green arrow to build and run.

Resources

unityassetreplacer's People

Contributors

dependabot[bot] avatar skyluker4 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

Watchers

 avatar  avatar

unityassetreplacer's Issues

Help :: I Cant Get Here From Any Members

For Your Example is "m_Script" but what are others?
I can't extract require member option but i cant extract or replace , for me return a error how to done without error? ::::

ERROR: Can't read member 'm_Musique' in asset 'sfx_char_player_clap_02'!
ERROR: Can't read member 'm_Musique' in asset 'mus_homeloop'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_obj_camera_move_02'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_ui_menu_character_selection_07'!
ERROR: Can't read member 'm_Musique' in asset 'mus_game_light_down_q_08and13'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_game_answer_select'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_ui_menu_multi_pressValidate'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_char_player_clap_03'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_public_reaction_happy_02'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_ui_menu_character_selection_09'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_ui_menu_option_slider_02'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_ui_menu_option_changeLanguage_03'!
ERROR: Can't read member 'm_Musique' in asset 'sfx_ui_menu_option_changeLanguage_02'!
ERROR: Can't read member 'm_Musique' in asset 'mus_game_heartbeat_Q06'!

because i don't know what is the member name for sound/sfx/music.

[FEATURE] A video showing how to use UAR

Problem

I'm trying to use this and I'm getting this error System.NullReferenceException: Object reference not set to an instance of an object. with this command unityassetreplacer -b="C:\path\to\folder\assets\bin\Data\sharedassets3.assets" -m="Visor" -d="C:\path\to\folder\dump". Visor is the name of an asset I found using UABEA.

Solution

A video showing how to use this would be very helpful.

Alternatives

UABE, doesn't work on the new unity
UABEA, crashes when trying to replace or export files
UAAE, broken

Additional Context

I'm on Windows 10

Clear Examples

I am really unsure on what "members" are supposed to mean. GameObjects, the name of the GameObject.. doesn't work

I would like a more clear example of what member I'm supposed to type or a list of members I could use

[BUG] Current Windows release does not replace textures

Description

Can't replace textures on the Windows releases found on this page.

Steps to Reproduce

  1. Run 'UnityAssetReplacer' with options ./UnityAssetReplacer -b assetbundle -t -i input_folder -o output_assetbundle

Expected Behavior

Expected program to replace textures successfully.

Output

Unhandled exception. System.DllNotFoundException: Unable to load DLL 'textoolwrap' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at TexturePlugin.PInvoke.EncodeByPVRTexLib(IntPtr data, IntPtr buf, Int32 mode, Int32 level, UInt32 width, UInt32 height)
   at TexturePlugin.TextureEncoderDecoder.EncodePVRTexLib(Byte[] data, Int32 width, Int32 height, TextureFormat format, Int32 quality)
   at TexturePlugin.TextureEncoderDecoder.Encode(Byte[] data, Int32 width, Int32 height, TextureFormat format, Int32 quality)
   at TexturePlugin.TextureImportExport.ImportPng(String file, TextureFormat format, Int32& width, Int32& height)
   at UnityAssetReplacer.TextureAsset.<Replace>b__4_0(List`1 assetReplacers, String inputFileName, String inputFilePath)
   at UnityAssetReplacer.Asset.ReplaceAll(String& inputDirectory, String& outputAssetBundlePath, Action`3 operation)
   at UnityAssetReplacer.TextureAsset.Replace(String& inputDirectory, String& outputAssetBundlePath)
   at UnityAssetReplacer.Program.RunOperation(Asset uar, Boolean dump, Boolean replace)
   at UnityAssetReplacer.Program.Main(String[] args)

Platform

  • Operating System: Windows
  • Architecture: x64, x86
  • Program Version: 3.0.1

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.