playMaker

Author Topic: Customizable vehicle  (Read 2349 times)

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Customizable vehicle
« on: September 20, 2014, 01:53:12 AM »
I need help with making a vehicle customizable. The game goes something like this: You start out in a "garage" where you can change parts of your vehicle. Basically the main vehicle has empties around it (they are children of the vehicle) that spawn the different parts. You press the button on what ever part you select then it spawns. That works fine. Now when the player starts the game it switches over to the "main scene". I want the vehicle to retain all the parts that were selected in the previous "garage scene", but nothing happens. It still stays the same.
I did some research and people seem to be using "Dont destroy on Levelload" or something like that, but I still don't know to which object I should apply it to or how it works exactly.
Also I'm using Easytouch joystick, to control this vehicle just incase it's important...

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Customizable vehicle
« Reply #1 on: September 20, 2014, 05:55:07 AM »
Hi, I'm making something similar.

Player opens a menu to setup his car, when all done, on exit I build all parts in a string, every part is defined in a bool (is it on or off), after that I have a string 010110101010 for example, where every 0 or 1 means true or false. When car is spawned it checks which part to add.
I'm doing this way so I can send that string to others in multiplayer too, to spawn the same car+parts.

Maybe you can use this method. Depends on your game setup, if lots of parts that could be hard to manage 0101010100101010100101… etc. :)

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Customizable vehicle
« Reply #2 on: September 20, 2014, 08:59:36 AM »
Hi 600

Does that method also work when switching between different scenes? I tried using Global Variables but they don't seem to work on other scenes.

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Customizable vehicle
« Reply #3 on: September 20, 2014, 10:27:01 AM »
Sorry forgot to mention that I'm using PlayerPrefs to save that string. If App is reopened Player can choose to use saved setup or build a new one.

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Customizable vehicle
« Reply #4 on: September 20, 2014, 11:22:54 PM »
Thanks. First time I'm hearing about it but yeah I guess Playerprefs would be the solution.