- Hello, and welcome to this tutorial, which was a request by someone! In this tutorial, i will show you how to add achievements that work to decompile mods. Below is what you need:
- Unity 2018.3.9f1 (For 1.3.2 Decompiles), Unity 2019.2.8f1 (For 1.4.3/BB Decompiles)
- Microsoft Visual Studio (For Coding)
- A Copy Of The OSB In Unity
- Some Coding Knowledge (Recommended)
Step 1. Create An Image And A Text Under It (It can be either standard or TMP text). Also, make a new script, it will be for your achievement. You can use the example script below: Example Achievement Script
Step 2. Go to the image you made and in inspector add the achievement script you just made.
Step 3. In the script you put in the image, there should be empty areas. Apply the text you made to achievement text, the image to achievement image, for type put in what you want the achievement to be called, And under locked and unlocked text put in the text that'll show up before and after you unlock it.
Step 4. Now we need to change the player pref (name of achievement) value somewhere. This example puts it in the notebook script, but you can put it almost anywhere.
Step 5. Make sure the PlayerPref's the value is the same as the one you put in "type". And, the value must be set to 1.
Step 6. Go to your scene and press play. Test to see if you achievement works. In this example, when a notebook is collected, the achievement is unlocked.
I hope this tutorial helps, and if anyone else has tutorials they request me to make, tell me in the comments! (And credit to filename3 for the screenshots i've linked)