Hello

I try to convert it but doesn’t work…
Any help>>>>

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

public class Test5 : MonoBehaviour {

	public List targets;

	// Use this for initialization

	void Start () {

		targets = new List();

		AddAllenmey ();

	}

	public void AddAllenmey ()

	{

		GameObject[] go = GameObject.FindGameObjectsWithTag("wall");

		

		foreach(GameObject wall in go)

		{

			AddTarget(wall.transform);	

		}

		

	}

	public void AddTarget(Transform wall)

	{

		targets.Add(wall);	

	}

	// Update is called once per frame

	void Update () {

		

	}

}

Javascript and c# can exist simultaneously in the same project. Be sure that you actually need to convert this before facing the woes of learning a new language :slight_smile:

The best way to learn would be to do it yourself, not have other people do it for you.

I'll give you a few hints (that are well documented here, here, here, etc...):

  1. For javascript you use import System.IO instead of using System.IO (in javascript you don't use the term using at all).
  2. When you declare a function in javascript, you use the keyword function and you are not required to declare its return type. In other words, you would use function Start() in stead of void Start()
  3. In javascript there is no need to type : MonoBehaviour when you declare a class. Scripts written in javascript extend the MonoBehaviour class by default.
  4. There are a few other basic syntax differences that are highlighted by the script you've posted. I can't think of a better way for you to learn javascript than to discover them by reading some documentation... That's the best way to learn Unity!
  5. Good luck!

There is a utility available specifically for this. I haven’t tested it but here is the link: Online UnityScript/Javascript to C# converter