I've been really stuck on this one and need some help.
I've got some accessories for my player, and my goal is to have a collider, with the script attached. When the player walks into the script, the inactive model components on the player, will be set to active.
This is the script I'm using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemEquip : MonoBehaviour
{
public GameObject[] Apparel;
public bool SetActive;
void Start()
{
Apparel = GameObject.FindGameObjectsWithTag("Apparel");
}
void OnTriggerEnter(Collider ApparelCollect)
{
if (ApparelCollect.CompareTag("Player"))
{
GameObject[] clothes = GameObject.FindGameObjectsWithTag("Apparel");
foreach (GameObject apparel in clothes)
{
apparel.SetActive(true);
}
}
}
}
I'm really stuck on this. It's something basic but despite trying several tutorials, asking some people I know and experimenting, nothing is getting this script to work.
What I've tried: -Deactivating the individual components -Attaching a script to each component, along with the trigger -Activating the individual components (from inspector) -Activating the script (from inspector) -Double checking that each component I want affected has the Apparel tag -Cry in a corner
I've been going around in a loop for ages trying to get this thing to work, but still nothing.
I'm self taught on game development, working on my first game. I've read the Unity manual (that absolutely did not help) as well as hit up YouTube and multiple forums, all with no luck.