So Ive used GameObject.active = true
for quite a long time, however I am trying to get to learn SetActive as its updated and preferred, however I have kindof an issue when I try to use it, here is the script
`var obj1 : GameObject;
function Start()
{
obj1 = GameObject.FindGameObjectsWithTag(“TheObj1”);
if (PlayerPrefs.GetInt("ObjOn")==1)
{
obj1.GameObject.SetActive (true);
}
else if (PlayerPrefs.GetInt("ObjOn")==0)
{
obj1.GameObject.SetActive (false);
}
}`
and the error is:
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object args)
UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object args, System.Type scriptBaseType)
ObjOnJV.Start () (at Assets/Standard Assets/Character Controllers/Sources/Scripts/Camera/ObjOnJV.js:9)