Skip to content

pairofdocs/Unity-D2R-Scene-Editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity-D2R-Scene-Editor

Edit D2R preset environments in Unity. A purchased copy of D2R is required to access the data files.

(Recommended: intro video about Unity's layout, panels and terminology https://youtu.be/pwZpJzpE2lQ?t=71)

  1. Create a new 3D project in Unity (this example project is named "D2R-docktown")
  2. Download this repository, unzip and place its contents into your unity project Assets folder (e.g. ...Unity Projects/D2R-docktown/Assets/Scripts , Resources, libs, ...)
  3. Open the project in Unity and select the Main Camera object in the Hierarchy. Then in the Inspector window on the right hand side add a component script Scripts/SaveJson.cs. (This is done only once per project)
  4. Save your Unity Scene with ctrl+s. Set your D2R data paths in SaveJson.cs and save the script see below
  5. Click the blue "Play" button above the Scene window to load a json preset in the project folder (e.g. docktown3.json). Click "Pause" and move/rotate/scale objects in the Scene
  6. To add objects to the Scene click "Pause" to unpause and then click the "Add" button on the left of the Scene and specify the path of the model to add. Once objects have been added click "Pause" to go back to Scene editing
  7. When finished editing click "Pause" once again to unpause and then click "Save" on the left of the Scene to save your changes to the preset json file
  8. Place your edited preset json into your D2R/Data/hd/env/preset location and launch D2R with -direct -txt

A video showing act1 edits: https://streamable.com/xbxe7i

Troubleshooting

If you see errors like

Assets\Scripts\SaveJson.cs(9,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Assets\Scripts\SaveJson.cs(10,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

Then the Newtonsoft package needs to be installed in Unity. Install through Unity's Package Manager: in Unity’s top menu: Window > Package Manager > Search for package Newtonsoft. https://docs.unity3d.com/Packages/com.unity.package-manager-ui@2.1/manual/index.html

Thanks to MilesTeg from d2mods.info for pointing this out.

Config Data Paths

Lines 16 and 17 in SaveJson.cs should be configured for your preset path and D2R data path

    public string preset = "docktown3.json";              // Change this to be the json preset that is edited
    public static string d2rDataPath = "D:/D2R/";         // Change this to where your D2R data is extracted (casc storage)

Unity

Freely available here https://store.unity.com/download-nuo

Screenshots

Unity act3 scene

Act3 docktown in-game

Unity act1 south scene

Act1 south in-game

Credits and Tools

Copyrights

Diablo II and Diablo II: Resurrected are copyrighted by Blizzard Entertainment, Inc. All rights reserved. Diablo II, Diablo II: Resurrected and Blizzard Entertainment are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.
All trademarks referenced here are the properties of their respective owners.

This project and its maintainers are not associated with or endorsed by Blizzard Entertainment, Inc.

About

Use unity to edit position, rotation and scale of D2R models in a level preset

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages