Upgrading Bolt
This is the step-by-step process of upgrading Bolt:
Upgrading to Bolt 1.3
Updating to Photon Bolt v1.3 includes several breaking changes: namespaces were changed, some scripts had their visibility changed and you can experience some missing references on your Prefabs. The following instructions aim to minimize the impacts of this update process.
- Ensure your project has a backup and/or is in a source control system (Git, SVN, Hg) before starting any changes. We can't stress this enought.
- Before importing the new SDK version into your project, you need to prepare your Bolt Prefabs for the update. As the changes on v1.3 include namespaces modifications, some components were moved, leading to missing references on the game objects. For this reason, we wrote an update script to will help with this task.
- Download the Bolt Updater script from our Samples Repository.
- Import it into your project inside the
Assets/Editor
folder. This will make Unity load the Script and include the proper Menu Items. - Make sure you've compiled Bolt (
Bolt/Compile Assembly
) and have all your prefabs listed on the Bolt Prefab Database (Assets\Photon\PhotonBolt\resources\BoltPrefabDatabase.asset
). - Run the task in the
Bolt/Utils/Update/Save Prefabs
menu. You should receive a log message withSave DONE!
message. Take a look at theAssets\Photon\PhotonBolt\resources
folder, and there should be anentity_data.json
file. This file contains all major settings from your Bolt Entity Prefabs, which includes theBoltEntity
component settings, but also information from anyBolt Hitbox
, for example. - Store this file somewhere for later use. That is important, otherwise, you will need to setup them manually.
- Note on BoltRuntimeSettings: on Scriptable Objects, changes to references are not easily fixable. This is the case of the
BoltRuntimeSettings
, which will lose the reference of the class it represents after the update. For this reason, considering the Bolt Settings are just a few values, we recommend annotating your current settings somewhere, or take a screenshot, for example. You will need the set the values again later.
- Delete any Photon Bolt related folders:
Assets/Photon
;Assets/samples
;Assets/Gizmos
;
- Use latest Bolt package and import to your project;
- You can import all content of the package, as usual.
- Include a new
Scripting Define Symbols
on yourProject Settings
, this will enable some sections of the code needed for the next steps:BOLT_1_3_OR_NEWER
- Restore the following files from your backup or source control:
Assets/Photon/PhotonBolt/project.json
: All your Bolt Assets;- In order to get the right references from the serialized data described on the
project.json
to reflect the new locations on the SDK v1.3, you must edit it manualy, but it should take just a few seconds:- Open the
project.json
file on any editor of your choice; - Replace all occurrences of
Bolt.Compiler.
byPhoton.Bolt.Compiler.
- please, be careful and replace all the text, including the dot at the end. - Save the file.
- Open the
- In order to get the right references from the serialized data described on the
- Open the
Bolt Settings
window atPhoton Bolt/Settings
and setup again your values based on the ones you saved earlier.- If you experience any errors while trying to edit the settings:
- Go to
Assets\Photon\PhotonBolt\resources
and remove theBoltRuntimeSettings.asset
file; - Create a new Bolt Settings: (i) right-click, (ii)
Create/Bolt/Create BoltRuntimeSettings
; - Open the
Bolt Settings
window again.
- Go to
- If you experience any errors while trying to edit the settings:
- As already mentioned, several namespaces were moved to best fit the naming and location of certain scripts. You should note that your project has a lot of broken references. In order to fix this, you will need to modify your source code changing the following namespaces:
- Most of the classes now are included inside the
Photon.Bolt
namespace, so you should includeusing Photon.Bolt;
on every script that you are touching Bolt code. - Remove the following namespaces from your scripts:
using Bolt;
using Bolt.Matchmaking;
using Bolt.Photon;
- On direct references, you can just replace the
Bolt.
byPhoton.Bolt.
on the script, examples:Bolt.Command
toPhoton.Bolt.Command
;Bolt.ScopeMode
toPhoton.Bolt.ScopeMode
;Bolt.GlobalTargets
toPhoton.Bolt.GlobalTargets
;Bolt.IProtocolToken
toPhoton.Bolt.IProtocolToken
;Bolt.EntityBehaviour
toPhoton.Bolt.EntityBehaviour
;Bolt.ReliabilityModes
toPhoton.Bolt.ReliabilityModes
;Bolt.GlobalEventListener
toPhoton.Bolt.GlobalEventListener
;
- Other namespaces that often are used:
Photon.Bolt.Utils
: include utility classes, likeBoltLog
and others.Photon.Bolt.Collections
: include the Bolt's own implementations of some collections, likeBoltRingBuffer
.Photon.Bolt.Matchmaking
: Matchmaking API;
- Now, you should have a project without any errors or missing references, it can take a while, depending on the size of your project, but it's totally possible.
- Most of the classes now are included inside the
- Your project is now ready to re-set the Prefabs data.
- Depending on the Unity version you are using (specifically 2019 LTS onwards), it will not let us modify the Prefabs and save them back if they have missing script references. In order to solve this, we need to remove those references first:
- Run the task on the Menu
Photon Bolt/Utils/Find Missing Scripts
. It will show a list of all prefabs that has any missing script references. - Run the task at
Photon Bolt/Utils/Remove Missing Scripts
in order to remove the missing references. Keep in mind that this code will run over all prefabs of the project and remove all references to any missing script components from them. If you want to do this manually, you can use the output from the step above as a reference. - You can run the
Photon Bolt/Utils/Find Missing Scripts
again, just to confirm that there are no prefabs with missing components.
- Run the task on the Menu
- Copy the
entity_data.json
file back toAssets\Photon\PhotonBolt\resources
, as it was moved on step2.5
. - Run the task at
Photon Bolt/Utils/Update/Load Prefabs
. This will read the serialized data fromentity_data.json
and set back all details on your prefabs. You should see a list of all affected prefabs on the Console like:Updating Player (UnityEngine.GameObject)
. - At the end, you will see the message
Load DONE!
- meaning that all went well.
- Depending on the Unity version you are using (specifically 2019 LTS onwards), it will not let us modify the Prefabs and save them back if they have missing script references. In order to solve this, we need to remove those references first:
- Compile Bolt (
Photon Bolt/Compile Assembly
) and you are done.
Upgrading to Bolt 1.2.9 or newer
- Ensure your project has a backup and/or is in a source control system (Git, SVN, Hg);
- Delete
Assets/bolt
and any other Bolt related files:Assets/Photon
;Assets/samples
;Assets/Plugins
;
- Use latest Bolt package and import to your project;
- Restore the following files:
- If you are updating from Bolt v1.2.5 or older:
Assets/bolt/project.bytes
orAssets/bolt/project.xml
;- In this case you should also delete the
Assets/Photon/PhotonBolt/project.json
file, so your Assets could be converted to the JSON format.
- If you are updating from Bolt v1.2.7 or newer:
Assets/bolt/project.json
;
Assets/bolt/assemblies/bolt.user.dll
;Assets/bolt/resources/BoltRuntimeSettings.asset
;
- If you are updating from Bolt v1.2.5 or older:
- Move the following files:
Assets/bolt/project.json
toAssets/Photon/PhotonBolt/project.json
;Assets/bolt/assemblies/bolt.user.dll
toAssets/Photon/PhotonBolt/assemblies/bolt.user.dll
;Assets/bolt/resources/BoltRuntimeSettings.asset
toAssets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset
;
- Remove the
Assets/bolt
folder; - Quit Unity;
- Open Unity and compile Bolt:
- Run the compilation at
Bolt/Compile Assembly
menu. - Open the
Bolt Assets
window (Bolt/Assets
menu), you should have all your assets as expected.
- Run the compilation at
- If the Wizard window did not show up, open it at
Bolt/Wizard
menu; - Follow the steps on the Wizard:
- Configure your
Photon Cloud
credentials; - Install all desired packages. The
Core
package installation is not required anymore;
- Configure your
- Any doubt, talk with us on our Discord Community.
- You are ready to use Photon Bolt.
Upgrading from Bolt 1.2.0.0 to 1.2.8
- Ensure your project has a backup and/or is in a source control system (Git, SVN, Hg);
- Delete
Assets/bolt
and any other Bolt related files:Assets/Photon
;Assets/bolt_samples
;Assets/Plugins/
;
- Use latest Bolt package and import to your project;
- If the Wizard window did not show up, open it at:
Bolt/Wizard
menu; - Follow the steps on the Wizard:
- Configure your
Photon Cloud
credentials; - Install all desired packages. You must install at least the
Core
package; - Any doubt, talk with us on our Discord Community.
- Configure your
- Quit Unity;
- Restore the following files:
Assets/bolt/project.bytes
orAssets/bolt/project.xml
, if you are updating from Bolt v1.2.5 or older;- In this case you should also delete the
Assets/bolt/project.json
file, so your Assets could be converted to the JSON format.
- In this case you should also delete the
Assets/bolt/project.json
, if you are updating from Bolt v1.2.7 or newer;Assets/bolt/assemblies/bolt.user.dll
;Assets/bolt/resources/BoltRuntimeSettings.asset
;
- Open Unity and compile Bolt:
- Run the compilation at
Bolt/Compile Assembly
menu. - Open the
Bolt Assets
window (Bolt/Assets
menu), you should have all your assets as expected. If it's true, you can remove/delete the old project files (Assets/bolt/project.bytes
orAssets/bolt/project.xml
).
- Run the compilation at
- You are ready to use Bolt.
Migrating Bolt Assets
Bolt saves all of its objects, states, commands and events in the Assets/bolt/project.json
file.
It's just a JSON file that defines all information from the assets.
You can read it but we highly discourage that you modify this file directly, the modification can break the deserialization process.
To migrate to a new project, simply copy this file to the same location in the new project. This is also useful if you need to share Bolt data with other team members.
Upgrading Bolt Free to Bolt Pro
If you now have access to Photon Bolt Pro, it's easy to update your SDK to this new version.
First, follow the instructions on the section Upgrading Bolt, as you are changing versions, the instructions are the same as if you upgrading.
The important aspects of the update are that you must maintain your project using a Version Control System
like SVN
or GitHub
before doing any changes or make a backup of it.
There are some files that are the most important ones for your game work properly after the update:
Assets/Photon/PhotonBolt/project.json
: this contains all your Bolt Assets descriptions;Assets/Photon/PhotonBolt/assemblies/bolt.user.dll
: this is the generated DLL every time you Compile Bolt, it's nice to have it saved, so you don't see errors after the update.Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset
: the Scriptable Object that contains all Bolt Settings you've set for your game.
In summary, the update process is:
- Backup the files described above;
- Remove All Bolt Related files;
- Import the new version of Bolt;
- Revert your files on the right locations;
- Done.
Also, you need to restart Unity at least once, so it reloads all Bolt DLLs.
We also suggest you remove the folders: Library
, obj
and Temp
on the root for your project folder (those folders are not inside the Assets folder) only if you are having compilation issues.
Keep in mind that removing those folders will cause your project to be completely recompiled by Unity, which may take a while, depending on the size of your project.
Regardless of the code or script changes, the update is almost minimal.
The main difference is that you are now able to connect to a server directly using its IP/port
.
Once you have imported the SDK, you will find the samples_pro
folder, and there you will find the BoltPro/BoltProInit.cs
script.
This script shows how you can start a Game Server using the DotNetPlatform
(that allows the direct connection), and later how to connect to the server from the client using the BoltNetwork.Connect
using the server EndPoint
.
The rest of the code and behaviors should be the same as on the Free version.