Tutorial for ver.3
Record and play character movements (saved in MySQL) †
In this scene, you can use MySQL to record and play back the movements of characters and some objects.
MySQL environment Construction †
If you are using MySQL, you need to go through a few steps first.
First, build MySQL Server. The details are omitted, but the outline is as follows.
- Install MySQL Server. Operation confirmed with version [8.0.15].
You can download MySQL product from here. (Archived Versions here)
MySQL Workbench is useful.
- Create a Schema (database) named "sigverse".
- Create a MySQL user with update authority for "sigverse".
- Create a table named "playbacker_motion_data" under "sigverse".
The table creation script is as follows.
CREATE TABLE `playbacker_motion_data` (
`recording_id` int(11) NOT NULL,
`elapsed_time` int(11) NOT NULL,
`data_type` int(11) NOT NULL,
`motion_data` text NOT NULL,
PRIMARY KEY (`elapsed_time`,`data_type`,`recording_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
In the SIGVerse setting window, set to use MySQL.
- Click [SIGVerse]-[SIGVerse Settings] in the Unity menu to open the SIGVerse setting window.
- Check [Use MySQL] in [Define symbols Settings].
Since an error occurs in the [Console] tab of the Unity editor, add the MySQL library to the Unity editor.
- Access Download Site of Connector/NET. (Archived Versions)
- Select [8.0.15] for [Product Version], [.NET & Mono] for [Operating System], and click [Download].
- When you unzip the downloaded zip file, confirm that MySql.Data.dll and Google.Protobuf.dll exist in the "v4.5.2" folder.
- Copy the two files by drag and drop into [Assets/Plugins] on the [Project] tab.
- Confirm that the error on the [Console] tab has disappeared.
Startup Procedure †
Start the [Assets/SIGVerse/SampleScenes/Playbacker/Playbacker(.unity)] scene with reference to here.
Recording to MySQL †
- Select [Database Recorder] for Mode.
- Make some settings such as [Unique ID] and database connection information.
- Click the [Start] button to start recording to MySQL.
- Operate the character with the arrow keys.
(Click [Baby icon] to show/hide the panel.)
- Click the [Stop] button to stop recording to MySQL.
Playback from MySQL †
- Select [Database Player] for Mode.
- Set the same database connection settings and [Unique ID] set in the above recording procedure.
- Press the [Start] button to start playback.
(Click [Baby icon] to show/hide the panel.)
- When the [Stop] button is pressed or the recording time elapses, playback ends.