- Home /
Character Selection Screen for Multiplayer - C#
Hello everyone I'm trying to figure out how to add a glow around objects when it's highlighted by a certain player, I plan on it being a local co-op game for now.
Something similar to how Mario Kart 64 does their character selection where they would both have their own color and box
below is how I have set up character selection
using UnityEngine; using System.Collections.Generic;
public class CharacterSelect : MonoBehaviour {
public GameObject singlePlayer;
public GameObject multiPlayer;
public List<charNav> charSelect = new List<charNav>();
[System.Serializable]
public struct charNav
{
public GameObject _this, left, right;
}
void Start() { menuSelect.transform.position = menuOpt[currentSelectedItem]._this.transform.position + menuSelectOffset; }
void Update() {
if (lastMenuChangeTime + menuChangeDelay < Time.realtimeSinceStartup) { Vector2 leftStickInput = new Vector2(Input.GetAxis("360_Dpad_X"), Input.GetAxis("360_Dpad_Y")); bool leftPressed = leftStickInput.x < -0.5f; bool rightPressed = leftStickInput.x > 0.5f;
if (leftPressed && (menuOpt[currentSelectedItem].left != null))
{
currentSelectedItem = GetMenuArrayIndex(menuOpt[currentSelectedItem].left);
menuSelect.transform.position = menuOpt[currentSelectedItem]._this.transform.position + menuSelectOffset;
}
if (rightPressed && (menuOpt[currentSelectedItem].right != null))
{
currentSelectedItem = GetMenuArrayIndex(menuOpt[currentSelectedItem].right);
menuSelect.transform.position = menuOpt[currentSelectedItem]._this.transform.position + menuSelectOffset;
}
lastMenuChangeTime = Time.realtimeSinceStartup;
}
}
Answer by airbagnr1 · Feb 23, 2017 at 01:28 AM
Hey, I'm on the same issue - just wondering if you ever managed to get it solved?
Your answer
