- Home /
The question is answered, right answer was accepted
Using a selected character
I want to make a screen with multipile characters for selection. After the selection of the character the game scene loads and the selected character is playing. How can I make the selected character play without putting all characters in the game scene ? Like a general character that gets the form of the selected character .
Thank you
Answer by fafase · Jun 22, 2014 at 05:21 PM
Create buttons for selecting player
When pressing button, value is stored via PlayerPrefs
When loading next scene, value is retrieved form PlayerPrefs
Either have all prefab in an array and instantiate the prefab corresponding to the value
Have all prefab in Resources folder and fetch with the value and the create
Watch picture of cute kittens to relax
For step 1:
http://docs.unity3d.com/ScriptReference/GUI.Button.html
For step 2 and 3:
http://docs.unity3d.com/ScriptReference/PlayerPrefs.html
http://docs.unity3d.com/ScriptReference/Application.LoadLevel.html
For step 4:
http://docs.unity3d.com/ScriptReference/Array.html (See built in arrays)
http://docs.unity3d.com/Manual/Prefabs.html
http://docs.unity3d.com/Manual/InstantiatingPrefabs.html
For step 5:
http://docs.unity3d.com/ScriptReference/Resources.Load.html
For step 6: