support unity3d ?

68 views
Skip to first unread message

sony...@gmail.com

unread,
Feb 14, 2015, 2:33:21 AM2/14/15
to shar...@googlegroups.com

hi,sharpkit is powerful tool 

current we work an project  use js ,with spridermonkey  to make unity easy to runtime excute code .(update such like lua.)

https://github.com/qcwgithub/qjsbunitynew

and find out sharpkit is very suitable  for type , because it's can  directly use unity SDK ,and easy convert to js files 

and what I want to ask :

are there somebody interesting   let  sharpkit  to support  that ?

current we have some problem  to change jsclr.js to support that .

any suggestion  will be pleasure .


Dan-el Khen

unread,
Feb 14, 2015, 3:26:06 PM2/14/15
to shar...@googlegroups.com
Hi,

Your project sounds very interesting! There are currently no known efforts to support unity, but I'd be happy to try and help you guys with any issues you might have with sharpkit or jsclr in order to achieve that goal.

Would you like to try and explain your current issues?

In any case feel free to contact me at any time, I'm aware that there might be a bit of a language barrier here, but I promise to do my best to try and understand you fully, even if it's 'google translated'. :-)

Best regards
Dan-el Khen
SharpKit

--
You received this message because you are subscribed to the Google Groups "SharpKit Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharpkit+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sony...@gmail.com

unread,
Mar 3, 2015, 4:07:22 AM3/3/15
to shar...@googlegroups.com
hi,current our version support base c# lib,

what I want to ask  are there any documents  show   what is the regulation of class name /methods name?

such like

  var v1 = new UnityEngine.Vector3.ctor$$Single$$Single$$Single(1, 1, 1);
    var v2 = new UnityEngine.Vector3.ctor$$Single$$Single$$Single(1.1, 1.1, 1.1);
    var v3 = UnityEngine.Vector3.op_Addition(v1, v2);
    var g = new UnityEngine.GameObject.ctor$$String("myGameObject");
    g.AddComponent$1(UnityEngine.Transform.ctor).set_position(new UnityEngine.Vector3.ctor$$Single$$Single$$Single(1, 1, 1));


what's mean r$$Single$$Single$$Single? and $1?




在 2015年2月15日星期日 UTC+8上午4:26:06,Dan-el Khen写道:

Dan-el Khen

unread,
Mar 3, 2015, 4:50:49 AM3/3/15
to shar...@googlegroups.com
Hi Allen,

I'll answer both of your emails here:

Yes, you can create a bridge between the client and server to make up for the missing gaps, or you can emulate a file system directly in js using html5 apis if possible. If you have specific problems to solve let me know, I might be able to help out.

The jsclr naming rules are pretty simple, not sure if they're explained anywhere - but you can always override them and give your own names.

Method suffix will be generated according to the following pattern:
[method_name]$[generic_args_count]$$[param1_type_name]$$[param2_type_name]...
  1. If a class has only one method with no overloads (also not in base class), it will have no suffix.
  2. If a method has overloads, a suffix will be added
  3. Suffix names are according to parameters and generic args count
  4. I think that there's also another special case of method suffix if you use explicit interface implementations
I'm not sure if you saw that I mentioned it before, but as I said we can create a plugin for sharpkit or a special JsMode that will generate global classes just like unity.
Also, you might be interested in the following feature:
[assembly: JsExport(DefaultFilenameAsCsFilename = true)]

It might be also beneficial for you to read about all other JsAttributes here:

Best regards
Dan-el
SharpKit

sony...@gmail.com

unread,
Mar 3, 2015, 6:55:17 AM3/3/15
to shar...@googlegroups.com, sony...@gmail.com
you mean you can create an extern global class dll for unity just like ext.js/node.js/jQuery.?


it'will be greate ,and our project  seem support directly 

but current we want to support Clr model also,

and there are others questions

 1:<T>support in unity,like gameobject.AddCompnonet<T>
 2: out ,ref 
 3:Monobehavior :startContinue
 3:how to use the same project/folder  in unity? I mean put the sharpkit code to unity's folder ?



在 2015年2月14日星期六 UTC+8下午3:33:21,sony...@gmail.com写道:

sony...@gmail.com

unread,
Mar 3, 2015, 7:43:01 AM3/3/15
to shar...@googlegroups.com, sony...@gmail.com
it's seem there is an bug 

  private static List<T[]> cache = new List<T[]>(32);

 convert to js like 

    dfTempArray$1.cache = new System.Collections.Generic.List$1.ctor$$Int32(Array, 32);

throw an error

 Uncaught TypeError: undefined is not a functiondfList.js:448
 dfTempArray$1.staticDefinition.cctorjsclr.js:456
 JsCompiler.Compile_Phase2jsclr.js:406
 JsCompiler.Compile_Directjsclr.js:384
 Compile(index):13 (anonymous function)


在 2015年2月14日星期六 UTC+8下午3:33:21,sony...@gmail.com写道:
dfList.cs

Dan-el Khen

unread,
Mar 3, 2015, 8:41:00 AM3/3/15
to shar...@googlegroups.com, sony...@gmail.com
That's not exactly what I meant, although it's possible to generate a dll if you have a good data source that contains all classes, properties, methods and parameters.

I'm not sure if I understand your questions (1..4) - can you be more specific?

new List<T[]>(32) might cause an error because there's no consturctor that receives the size implemented in javascript (but I'm not sure, need to check this).

D.


Sebastian

unread,
Mar 4, 2015, 6:01:18 AM3/4/15
to shar...@googlegroups.com, sony...@gmail.com

sony...@gmail.com

unread,
Mar 4, 2015, 7:31:20 AM3/4/15
to shar...@googlegroups.com, sony...@gmail.com, 6506...@qq.com
here is some example code and the dll

what I want is there is a tool auto create cs class from unityengine.dll





在 2015年3月3日星期二 UTC+8下午9:41:00,Dan-el Khen写道:
src.7z

Dan-el Khen

unread,
Mar 4, 2015, 10:27:56 AM3/4/15
to shar...@googlegroups.com, sony...@gmail.com, 6506...@qq.com
I'm not sure I understand why do you want to create C# source files from the unity.dll file, are you planning to fill them with implementation yourself? Or you just want to add JsType attributes on the classes?

Cheers
Dan-el

淺唱√

unread,
Mar 4, 2015, 11:00:01 AM3/4/15
to sharpkit, Dan-el Khen, sonygodx, 65069822
Sorry, we had some misunderstanding.
Now we don't need C# header files anymore.

What we are going to do now is generate Clr mode JavaScript for Unity C# classes like MonoBehavior. (Why? We want the generated js to work with jsclr.js, so it supports .NET features like inheritance, type casting, overloaded functions, etc.)

We did generate the JavaScript files before, but they were not Clr mode.

If there is something need to be noticed about Clr mode, please tell us, thank you!

Allen


------------------ 原始邮件 ------------------
发件人: "Dan-el Khen" <dane...@gmail.com>;
发送时间: 2015年3月4日(星期三) 23:27
收件人: "sharpkit" <shar...@googlegroups.com>;
抄送: "sonygodx" <sony...@gmail.com>;"65069822" <6506...@qq.com>;
主题: Re: support unity3d ?

Dan-el Khen

unread,
Mar 4, 2015, 11:08:46 AM3/4/15
to 淺唱√, sharpkit, sonygodx, 65069822
But weren't you supposed to export the code like unity does? A single file for each class, and everything global? Or is that working only on internal unity stuff?

I think that what I'm asking here is - is there a unity javascript library implementation currently? When you 'inherit' from 'Component' or 'Behaviour' - who is going to implement these classes? You? or there's an existing unity implementation in javascript for this? As well as a specific instructions on how to inherit.

Are you also saying that you can't get a small jsclr example to work? If so, send me your code, and I'll help to run it.

Dan-el

淺唱√

unread,
Mar 4, 2015, 11:43:19 AM3/4/15
to danelkhen, sharpkit, God Sony
I'll explain again. 

1) let's forget unity js. unity does not have js. it has unityscript which is totally different. so 
javascript has nothing to with Unity!

2) is there a unity javascript library implementation currently?  
NO! 

3) When you 'inherit' from 'Component' or 'Behaviour' - who is going to implement these classes? You? or there's an existing unity implementation in javascript for this?
No one is going to implement these classes. see GameObject.javascript. this file is generated according to GameObject.cs in UnityEngine. As you see, it is not implemented, it has only some CS.Call() there, which is used to call C# code from javascript. CS.Call() is the very important

4), see RotateObject.javascript in attachments. this is the file i sent you before. this file is nothing to do with unity. it is I that decide it to look like this. 
But now we are going to use SharpKit,  I decide to change ALL js files to match SharpKit Clr mode.
We are in progress, I believe it will work great with SharpKit very soon.

Sorry to make you confused. Is it clear now?

------------------ 原始邮件 ------------------
发件人: "danelkhen";<dane...@gmail.com>;
发送时间: 2015年3月5日(星期四) 凌晨0:08
收件人: "淺唱√"<doit...@qq.com>; "sharpkit"<shar...@googlegroups.com>;
抄送: "sonygodx"<sony...@gmail.com>; "淺唱√"<6506...@qq.com>;
主题: Re: Re: support unity3d ?
GameObject.javascript
RotateObject.javascript

Dan-el Khen

unread,
Mar 4, 2015, 11:50:56 AM3/4/15
to 淺唱√, sharpkit, God Sony
Ok, I think I partially understand it better now (although not completely)... You said that GameObject.javascript is generated according to GameObject.cs, but you didn't send GameObject.cs so I'm not sure. I also don't fully understand how CS.Call() exactly work and what is your eventual target platform for runtime (is it going to run in a browser?)

In any case, clr mode will basically allow you to choose to work with jsclr.js, or implement your own runtime engine, since you will have all definitions of classes, methods, etc... When you have a small working sample, if you have any problems, let me know and I'll try to help.

Best regards
Dan-el
SharpKit

淺唱√

unread,
Mar 4, 2015, 12:01:01 PM3/4/15
to danelkhen, sharpkit, God Sony
1) You said that GameObject.javascript is generated according to GameObject.cs, but you didn't send GameObject.cs so I'm not sure. 
see GameObject.cs in attachments. GameObject.javascript is not generated by SharpKit! it is generated by myself.

2) how CS.Call() exactly work
Mozilla SpiderMonkey javascript engine. i'll explain in the future. i'll send you a full example!!

3) what is your eventual target platform for runtime (is it going to run in a browser?)
will NOT run in a browser. because we use SpiderMonkey C/C++ dll, Unity doesn't allow user to use C/C++ dll in a browser. But even if Unity allows users to do that, the javascript we use are nothing to do with the browser. they are run internally

------------------ 原始邮件 ------------------
发件人: "danelkhen";<dane...@gmail.com>;
发送时间: 2015年3月5日(星期四) 凌晨0:50
收件人: "淺唱√"<doit...@qq.com>; "sharpkit"<shar...@googlegroups.com>;
抄送: "God Sony"<sony...@gmail.com>;
GameObject.cs

淺唱√

unread,
Mar 4, 2015, 12:02:19 PM3/4/15
to danelkhen, sharpkit, God Sony
2) how CS.Call() exactly work
Mozilla SpiderMonkey javascript engine. i'll explain in the future. i'll send you a full example!!
Target platforms: Windows/Mac/Android/iOS


------------------ 原始邮件 ------------------
发件人: "淺唱√";<doit...@qq.com>;
发送时间: 2015年3月5日(星期四) 凌晨1:00
收件人: "danelkhen"<dane...@gmail.com>; "sharpkit"<shar...@googlegroups.com>;
抄送: "God Sony"<sony...@gmail.com>;
主题: 回复: Re: support unity3d ?

淺唱√

unread,
Mar 4, 2015, 12:04:54 PM3/4/15
to danelkhen, sharpkit, God Sony
BTW  Some functions in GameObject.cs are not exported because they are not supported (can be supported in the future) !


------------------ 原始邮件 ------------------
发件人: "淺唱√";<doit...@qq.com>;
发送时间: 2015年3月5日(星期四) 凌晨1:02

淺唱√

unread,
Mar 4, 2015, 12:11:48 PM3/4/15
to danelkhen, sharpkit, God Sony
....One more thing
Some functions in GameObject.javascript are from GameObject's base class. not in GameObject.cs.
with jsClr.js 's help, I dont have to put them together?

------------------ 原始邮件 ------------------
发件人: "淺唱√";<doit...@qq.com>;
发送时间: 2015年3月5日(星期四) 凌晨1:04

Dan-el Khen

unread,
Mar 6, 2015, 3:40:11 AM3/6/15
to 淺唱√, sharpkit, God Sony
SharpKit supports inheritance between classes in both prototype in clr mode. The clr mode inheritance support is more extended, when you call Compile(); in clr mode - the jsclr engine will create all needed prototypes including methods from base classes so they will be available.
D.

Reply all
Reply to author
Forward
0 new messages