|
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 () {
}
}
(comments are locked)
|
|
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...):
Thx..............
Oct 20 '11 at 08:06 AM
firasdeep
In regards to #2: You can declare its return type, though you apparently don't have to: I find it good practice to always declare its return type, for readability's sake and for catching incompatible-type errors further up the road that might occur when assigning its return value to some variable.
Oct 20 '11 at 03:53 PM
blitzen
Absolutely... You're right. Thanks. You can explicitly declare the type of everything in Unity javacript, which is quite cool. I do the same, but was trying to keep is brief and simple above. I changed the wording of my answer :)
Oct 20 '11 at 04:35 PM
jahroy
(comments are locked)
|
|
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 :)
(comments are locked)
|
|
There is a utility available specifically for this. I haven't tested it but here is the link: Online UnityScript/Javascript to C# converter
(comments are locked)
|

I don't understand. Why would you ever want to to that?