Skip to content

Commit

Permalink
Commented two lines of code in both Model Controller scripts of Unity
Browse files Browse the repository at this point in the history
Commented two lines of code in both Model Controller scripts of Unity side to be error-free when following the YT tutorial.

The two lines of code are in format GameObject.FindWithTag("GameController").GetComponent<UISystem>().*();

Suppose they will link the UI system to show the correct values and allow adjusting the thresholds during runtime.

However, building the UI system is time-consuming. The simpliest way is to comment them.

The program still can be run, but lose customizability during runtime. It can be fixed by importing the complete unity package file and study it.

Update .gitignore to disable ignoring the .unitypackage files.

Updated README.md for clearer option descriptions.
  • Loading branch information
mmmmmm44 committed May 16, 2022
1 parent 23f314c commit 96a6949
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.png
*.jpg
*.zip

__*
Assets
build
Expand All @@ -9,8 +11,7 @@ main-*
file_tidy.py
Videos*

UnityAssets/Packages
.DS_Store
UnityAssets/.DS_Store

git-personal-access-token.txt
git-personal-access-token.txt
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ git clone https://github.com/mmmmmm44/VTuber-Python-Unity.git
cd "VTuber-Python-Unity"
```

Download the unity packages of sample projects of both live2D and unitychan 3D in the link next to: [Dropbox](https://www.dropbox.com/sh/qh7dcqt0z287idt/AACbljJEcD6knM6JL2uojfIaa?dl=0)
~~Download the unity packages of sample projects of both live2D and unitychan 3D in the link next to: [Dropbox](https://www.dropbox.com/sh/qh7dcqt0z287idt/AACbljJEcD6knM6JL2uojfIaa?dl=0)~~

(last edit of the sample projects: 23-12-2021)
~~(last edit of the sample projects: 23-12-2021)~~

### Simple Setup
### Setup
1. Create An empty Unity 3D Project

2. Import either the Live2D or UnityChan3D package to your project. The corresponding SDKs have been included already.

Links for both packages (in a zip file): [Dropbox](https://www.dropbox.com/sh/qh7dcqt0z287idt/AACbljJEcD6knM6JL2uojfIaa?dl=0)
~~Links for both packages (in a zip file): [Dropbox](https://www.dropbox.com/sh/qh7dcqt0z287idt/AACbljJEcD6knM6JL2uojfIaa?dl=0)~~

_last edit: 23-12-2021_
~~_last edit: 23-12-2021_~~

3. Run the Scene.

4. Run the following code in terminal
[content in the bracket is optional]
```
python main.py --connect [--debug]
python main.py --connect [--debug] [--port PORT]
```

5. Enjoy


### Custom Setup (For people who want to import their own 3D/ Live2D model)
### [Depreciated] Custom Setup (For people who want to import their own 3D/ Live2D model)

#### For Live2D model

Expand All @@ -93,7 +93,7 @@ Video Walkthrough: [Click Me!](https://youtu.be/3pBc9Wkzzos?t=30)
7. Run the following code in terminal
[content in the bracket is optional]
```
python main.py --connect [--debug]
python main.py --connect [--debug] [--port PORT]
```

8. Enjoy
Expand All @@ -117,14 +117,25 @@ Video Walkthrough: [Click Me!](https://youtu.be/V6Wd2kPNbPY?t=180)
7. Run the following code in terminal
[content in the bracket is optional]
```
python main.py --connect [--debug]
python main.py --connect [--debug] [--port PORT]
```

8. Enjoy

**Make sure you run the Unity Scene first before running the python script**

*Both the python scripts and the unity project can be exported to .exe, which can be run on other computers.*
_The complete Unity Project with fancy stuffs such as UI system, Save Load Preferences, and custom port UI can be found after importing the Unity Packages provided._

## Options (main.py)
-h, --help show this help message and exit

--connect connect to the unity character

--port PORT specify the port of the connection to unity. Have to be the same as in Unity.

--cam CAM specify the camera number to use if you have multiple cameras connected to the computer

--debug show the raw values of the detection in the terminal

## Development Environment
* Python 3.8.5
Expand Down
6 changes: 4 additions & 2 deletions UnityAssets/Scripts/Live2D/HiyoriController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ void Start()
InitTCP();

// Load saved JSON data at start
GameObject.FindWithTag("GameController").GetComponent<UISystem>().LoadData();
GameObject.FindWithTag("GameController").GetComponent<UISystem>().InitUI();
// Commented the following two lines to make it error-free when following the YT Tutorial
// A full, updated version which works with the UI system can be found after importing the unity packages to a Unity project
// GameObject.FindWithTag("GameController").GetComponent<UISystem>().LoadData();
// GameObject.FindWithTag("GameController").GetComponent<UISystem>().InitUI();

}

Expand Down
6 changes: 4 additions & 2 deletions UnityAssets/Scripts/UnityChan3D/UnityChanController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ void Start()
autoBlinkScript.enabled = isAutoBlinkActive;
SetEyes(eye_ratio_open);

GameObject.FindWithTag("GameController").GetComponent<UISystem>().LoadData();
GameObject.FindWithTag("GameController").GetComponent<UISystem>().InitUI();
// Commented the following two lines to make it error-free when following the YT Tutorial
// A full, updated version which works with the UI system can be found after importing the unity packages to a Unity project
// GameObject.FindWithTag("GameController").GetComponent<UISystem>().LoadData();
// GameObject.FindWithTag("GameController").GetComponent<UISystem>().InitUI();

InitTCP();
}
Expand Down

0 comments on commit 96a6949

Please sign in to comment.