Been trying to use/convert an old C# script on youtube tutorial into javascript for use in my project. All was going well until I hit this line of code -
CurrentlySelectedUnit.transform.FindChild("Selected").gameObject.active = false;
CurrentlySelectedUnit = null;
Which gave me this error -
"Assets/Scripts/MousePoint 2.js(24,82): BCW0012: WARNING: ‘UnityEngine.GameObject.active’ is obsolete. GameObject.active is obsolete. Use GameObject.SetActive(), GameObject.activeSelf or GameObject.activeInHierarchy.
if I use ‘GameObject.SetActive’ I get this error -
"Assets/Scripts/MousePoint 2.js(24,71): BCE0019: ‘GameObject’ is not a member of ‘UnityEngine.Transform’. "
If I use ‘GameObject.activeSelf’ I get the same error -
"Assets/Scripts/MousePoint 2.js(24,71): BCE0019: ‘GameObject’ is not a member of ‘UnityEngine.Transform’. "
And if I use ‘GameObject.activeInHierarchy’ I get the same again.
How can I fix this as the only solutions it gives me, causes more errors ???