Domanda

I made a little android game in unity. I used UnityScript.

Most of the unity plugins I've come across are written in mostly in c#; this one, for example: https://github.com/playgameservices/play-games-plugin-for-unity. I can make simple changes (commenting out stuff), but for the most part I can't tell the difference between c# and the potholes on my street. This has limited me to the default setting of a very basic advertising plugin.

If it's possible, I'd like to make whatever calls I need to from a UnityScript, but I haven't been able to figure that out on my own.

Failing this, I'd need to get a good starting point for learning c#, in the context of unity3D development.

È stato utile?

Soluzione

You have to take Unity3D's file compilation order into account, which is well documented at Special Folders and Script Compilation Order

This is significant in cases where a script must refer to classes defined in other scripts. The basic rule is that anything that will be compiled in a phase after the current one cannot be referenced. Anything that is compiled in the current phase or an earlier phase is fully available.

and

A common example is where a UnityScript file needs to reference a class defined in a C# file. You can achieve this by placing the C# file inside a Plugins folder and the UnityScript file in a non-special folder. If you don't do this, you will get an error saying the C# class cannot be found.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top