Please help convert code from c # to js
using System.Collections.Generic;
using UnityEngine;
public class dialogHolder : MonoBehaviour
{
public string dialog;
private DialogManager dMAn;
// Start is called before the first frame update
void Start()
{
dMAn = FindObjectOfType<DialogManager>();
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log("!!!!!!!!");
if (other.gameObject.name == "Player")
{
dMAn.ShowBox(dialog);
}
}
}```
Unity doesn’t even support JS anymore, so I vote for C#.
It’s not too difficult, but I think we’d all be doing you a favor by not helping you convert it.
Javascript is dead. It still compiles but only for the sake of legacy support. It was never very good in the first place, even - and especially - for beginning coders. It also was never even Javascript.
Basically, converting this into Javascript is almost certainly going to do nothing but send you down a path which will hamper your progress in terms of learning Unity.
So the question is, why do you think you should be converting this to JS? What are you trying to accomplish? That way we can help you accomplish it the right way.
(Forum etiquette: 1) don’t post irrelevant polls as part of a question. 2) use actual code tags to post lines of code, which will do stuff like syntax highlighting and line numbers)
1 Like