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

preview_player
Показать описание
#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
Рекомендации по теме
Комментарии
Автор

I wish there would be more of those super fast tutorials online, I need them so often and I dont want to watch a 30 minutes video every time I would just need one as short and direct as this one! Thank you!

lisamai
Автор

tysm❤❤❤❤❤❤❤❤❤ i struggled with this for hours but this tut was able to fix my problem

CheeseKing
Автор

straightforward without dilly-dallying. love it!

mikailrais
Автор

Thanks it worked on my VR project, though I have to watch it a few times. I think Step 2 you should've said "empty gameobject" or just tell us to create another object before proceeding to step 2.


..or maybe my application is just too different. Thanks still.

raandomplayer
Автор

how can you disable and enable a component in unity 2D?

_jexool_GD_
Автор

this look like a shit post from a multibillion dollar corporation

d.a
Автор

easy
ima not here using any editor so i might type some word or letter wrong

pic.activeInHirachy ? pic.setActive(true) : pic.setActive(false) ;
thats it

BLACKDREAMIO