Quantcast
Viewing latest article 3
Browse Latest Browse All 49

How do I use a power up to change the character I'm controlling?

Here is my situation: 1. I have a particle system with a box collider attached with "is trigger" checked. 2. I have 2 playable characters with character controllers attached. When you start the game you start out as "character 1" which has the tag: "Player." When the character runs through the "powerup" which is the particle system listed above (#1) I want him to change into character #2 which has the tag: "Player 2." I'm new to Unity3d and I could have this totally wrong... but I have the following script attached to the particle system prefab I created: var redapple : GameObject; var yellowapple : GameObject; function OnTriggerEnter(other : Collider){ if(other.gameObject.tag == "Yellow Powerup"){ Destroy(other.gameObject); redapple = GameObject.FindWithTag("Player"); yellowapple = GameObject.FindWithTag("Player2"); redapple.active = false; yellowapple.active = true; } } Any ideas guys? I've been trying to figure this out for so long now... appreciate any help. Thanks!

Viewing latest article 3
Browse Latest Browse All 49

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>