Question by 
               LINKENN · Jan 20, 2018 at 01:36 PM · 
                c#collisioncollidercharactercontrollerontriggerenter  
              
 
              How to deadtivate a gameobjects from the scene, if player has a character controller
hello everybody, I am trying to make my first UI inventory for upgrade the weapon. The problem is : My script works only with rigidbody and not with character controller. The script I put on colectible game object (It is a capsule) and on player I have a character controller. When I try to interact with capsule, nothing hapens :) I send you a script. Thank you for help
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class Example : MonoBehaviour {
 // script works and I can activate not only UI Omages but olso a GUI Buttons
 // if you are triggering with object all works
 // put scrit on gameObject, which will activate a image
 // It works only with rigidbody
 public GameObject capsule;
 public Image redImage;
 void Start()
 {
     
 }
 void Update () 
 {
     
 }
 void OnTriggerEnter (Collider col) 
 {
     if (GetComponent<Collider>().gameObject.name == "cube")
     {
         
         DeactivateAndActivate ();
     }
 }
 void DeactivateAndActivate () 
 {
     capsule.SetActive (false);
     redImage.gameObject.SetActive (true);
 
 }
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                