filmov
tv
HOW TO ENABLE AND DISABLE GAMEOBJECT IN 30 SEC (UNITY) *EASY*

Показать описание
#unity #devlog #blender
SCRIPT \/ \/ \/
HOW TO ENABLE AND DISABLE GAMEOBJECT IN UNITY
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnabledOrDisabled : MonoBehaviour
{
public GameObject pic;
public void Trigger(){
pic.SetActive(true);
}
else{
pic.SetActive(false);
}
}
}
(dont copy this)
--------------------------
Q: how to code works?
A: so we need to define the gameobject we wanna enable/disable by creating a variable
then create a void *NEEDS TO BE PUBLIC* so that will hold the code
dont use void update because we will be putting it to the button
so if the gameobject we defined on the variable was not active in the hierarchy we wanna setactive to true so the the gamobject object will be active
but if the gameobject is active in the hierarchy we wanna setactive to false
unity,unity3d,game development,unity game dev,unity game devlog,unity tutorial,how to,unity how to,HOW TO ENABLE AND DISABLE GAMEOBJECT IN 30 SEC (UNITY) *EASY*,unity game,devlog,how to unity,how to setactive,how to enable and disable gameobject,how to enable and disable gameobject in unity,kimza,kimza unity,unity kimza,unity devlog,unreal engine,unreal engine 5,blender,Unity,dani,jonas tryoller,will you snail,jonas tryoller will you snail
SCRIPT \/ \/ \/
HOW TO ENABLE AND DISABLE GAMEOBJECT IN UNITY
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnabledOrDisabled : MonoBehaviour
{
public GameObject pic;
public void Trigger(){
pic.SetActive(true);
}
else{
pic.SetActive(false);
}
}
}
(dont copy this)
--------------------------
Q: how to code works?
A: so we need to define the gameobject we wanna enable/disable by creating a variable
then create a void *NEEDS TO BE PUBLIC* so that will hold the code
dont use void update because we will be putting it to the button
so if the gameobject we defined on the variable was not active in the hierarchy we wanna setactive to true so the the gamobject object will be active
but if the gameobject is active in the hierarchy we wanna setactive to false
unity,unity3d,game development,unity game dev,unity game devlog,unity tutorial,how to,unity how to,HOW TO ENABLE AND DISABLE GAMEOBJECT IN 30 SEC (UNITY) *EASY*,unity game,devlog,how to unity,how to setactive,how to enable and disable gameobject,how to enable and disable gameobject in unity,kimza,kimza unity,unity kimza,unity devlog,unreal engine,unreal engine 5,blender,Unity,dani,jonas tryoller,will you snail,jonas tryoller will you snail
Комментарии