Hello! I am currently trying to create a Unity game using Haxe’s C# target. I have imported the unity dll file in my
build.hxml file (
-net-lib /Applications/Unity/Hub/Editor/2020.3.24f1/Unity.app/Contents/Managed/UnityEngine.dll), but I am having some issues with getting some stuff to work.
I am importing
unityengine.* into my haxe files. I am trying to add component of type MeshRenderer to a game object, as described in this documentation: Unity - Scripting API: GameObject.AddComponent. However, the haxe autocomplete (and the build process) tells me that the only way to do it is to use the outdated
AddComponent(className: String). If I try to do something like
AddComponent<MeshRenderer>() the compiler throws an error about an unexpected semicolon, I assume because I did not provide the required className string. This wouldn’t be an issue, except that when I do that, I can’t set a sharedMaterial. I also want to point out that the mentioned AddComponent method that haxe is using has been outdated for a while, and I have used the same dll (I assume, using the same unity version as in the dll path, and
using UnityEngine) with the new version of AddComponent with no problem.
If anyone knows how to help or is willing to troubleshoot with me, please let me know! If this is the wrong place to put this, please let me know where to go! Thanks a lot!