playMaker

Author Topic: Switching player prefabs  (Read 1307 times)

jrock84

  • Playmaker Newbie
  • *
  • Posts: 23
    • Divergent Worlds Interactive
Switching player prefabs
« on: August 10, 2016, 11:03:54 PM »
Hello all! New to the community and happy to be here. Still somewhat of a noob on scripting in general, but learning more everyday and loving it. Anyway, on to the question.

So, assuming my main player prefab is already loaded, please advise on the following. Think of this as a minigame where you switch cameras and perhaps alter controls for different gameplay.
1. Save current position to come back to.
2. Instantiate a new player prefab with different controls and camera.
3. Complete minigame
4. Return to original player setup.

Any help is greatly appreciated. Thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Switching player prefabs
« Reply #1 on: August 11, 2016, 02:46:46 AM »
Hi,
Create and destroy is an expensive way to do things and leaves Garbage.

Maybe you could use a set position for the camera,
make a group of controls for each desired control and use a send event for the desired controls.
or
Make an fsm for each control and Enable/disable the desired control fsms.

if you have different characters you could have them into an array and select the desired player to swap it with the current player from the array.