Quick Start - Get up and running in the Unity editor
The IMVU API for Unity is a library that allows you to load an IMVU user's information (avatar, outfits & friends) right into your Unity app. This means that IMVU customers can connect to IMVU and control their avatar inside your app.
In order to use this API you must first obtain an AppID from IMVU. We will walk you through the required steps below.
NOTE: You do not need to develop an APP yet. Once you have an AppID you will be able to run the myriad of IMVU demos in the Unity editor to see what is possible. These demos will provide you with source code samples to get you on your way to building your own apps.
1. Create a Free Account with IMVU
We need a way to contact you when you want to publish your apps, and you need an account to test with. The good news is that you can create an IMVU account for free. Your account will have an Avatar, which will represent your company and act as a persona to represent your brand. (You can use an existing account if you have one, or create a new one. If you already have an account you would like to use, skip to step 2.)
To create an account and Avatar go to im.vu/next. You can dress up your Avatar, create a tagline and lots more, but that is an exercise for later. Once you have logged in as your new Avatar you can proceed to step 2.
2. Get an IMVU AppID
In order to use the IMVU API for Unity you must get an AppID. Since your goal is to eventually develop and publish an app, you may already have a good idea of what you want to call your app. However, if you are just getting started you can enter a temporary app name. You will be able to edit the app descriptions, images and other information later.
2.1 Create an App
Let's create a test app to get your AppID.
- Get started by visiting: imvu.com/next/developer.
- Click Add New App. (You will see a developer agreement. Agree to the terms as you see fit.)
- Enter a unique name for your app. We recommend [YourCompanyName]Test if you don't have another name in mind.
- Select a target platform for your app, if you know which platform you intent to develop for. If you are not sure you can pick WebGL for now.
- The first URL is the place from which your app will eventually run. Since you don't know that now you can leave that field blank. (This is the URL we will use to launch your app when it is ready.)
- The OAuth redirect URL tells the IMVU servers where to look for your app for authentication. Enter http://localhost:8888/ for now. This will get your working in the Unity editor. (More redirect URLs will be entered later for other deployment scenarios.)
- Click Continue.
2.2 Add yourself as a "Tester" of your new app
When your app is first created only accounts registered as "Testers" will be able to connect to it. Each account is referred to by it's user name or avatar name. Let's start by adding your account to that tester list so that you can test your own app.
- On imvu.com/next/developer, click the "Testing" link on the left
- Add your IMVU user name (The example below shows the user named "appdev1")
- NOTE: This is where you will add other users later if you have testers or developers working with you
2.3 Now you have your AppID
Click the platform you chose above to see the settings for that platform. (iOS, Android or WebGL.) You should see your App ID! Copy this ID, you'll need to paste it in the Unity Editor later.
Note: You will see a set of permissions under "Approved Access". For now, turn those all on. The demos we are going to run will require all of these access rights. (You may be able to remove some of them later when you publish your app.)
3. Run the IMVU Demos in a Unity Project
3.1 Install the IMVU API for Unity
The IMVU API for Unity currently works best in Unity 5.2.4 (available at https://unity3d.com/get-unity/download/archive). Run Unity 5.2.4 and follow the steps below to get the IMVU demos up and running.
- Download the Basic IMVUnity API package. (The Photon packages will be explained later.)
- Create an empty project in Unity
- Choose Assets->Import Package->Custom Package... and choose the IMVUnityXXX.unitypackage file downloaded above
- Import the entire contents of the package into your project
3.2 Configure the IMVU API for Unity
We are almost there. Now we will configure the editor to work with your new App ID.
- In the Unity Window menu select IMVU Settings
- Paste your AppID from above into the App ID field for the "Editor"
- Confirm that your "Redirect URL" entry for the Editor contains http://localhost:8888/ This must match the entry you added in step 2.1 above. (The default uses port 8888. If this port is already taken on your computer then you should find a free port and update the setting here as well as in step 2.1 above.)
- Close the IMVU settings dialog
3.3 Run the "Idenity" Demo
- You're almost there! Under the Unity "Project" tab, find the Identity demo scene and double click it. You should now see the Identity scene open in Unity.
- Hit the Unity Run button. You will be presented with a browser window to connect to IMVU. Enter the user name and password you created above.
- You will now be presented with a dialog asking you to give the App rights to access your account information. Hit accept.
- Your browser should now say you have successfully logged in, and your Avatar should be loaded into the scene
Connection successful. You can close this window and return to your app.
Success. Now feel free to try the other demos, and look at the source code to see how it is done.