yidouyaya 2015-03-30 05:40
浏览 1596

在untiy3d中如何用js调用c#中的函数

在网上看了很多人的回答,都说把要被调用的c#放在”Standard Assets”, “Pro Standard Assets” or “Plugins” 目录下,但是我的c#代码调用了Plugins里的文件,所以一放进去就出错。有没有其他好的方法呀。。。求各位大神帮帮忙。。。
c#代码如下
using UnityEngine;

using System;

using System.Data;

using System.Collections;

using MySql.Data.MySqlClient;
using MySql.Data;
using System.IO;
using System.Reflection;

public class menuData : MonoBehaviour {

string Error=null;
public static string[,] picAndmod;//分别存放picNo,modNo,picAndmodName,picAddress,modAddress,modDiscribe;

// Use this for initialization
void Start () {

}
public string[,] dataFind(){
try{

    Debug.Log("连接数据库成功");
    sql s = new  sql();
    DataSet ds=s.SelectTablesWhere(new string[] {"modle","picture"},new string[]{"picNo","picture.modNo","picture.picAndmodName","picAddress","modAddress","modDiscribe"},new string[]{"modle.modNo"},new string[]{"="},new string[]{"picture.modNo"});
    if(ds!=null){
        DataTable table=ds.Tables[0];
        picAndmod=new string[table.Rows.Count,6];
        for(int i=0;i<table.Rows.Count;i++){
            for(int j=0;j<6;j++){
                Debug.Log(table.Rows[i][j].ToString());
                picAndmod[i,j]=table.Rows[i][j].ToString();
            }
        }

}
return picAndmod;
}
catch(Exception e)
{
Error = e.Message;
return picAndmod;
Debug.Log(Error);
}
}

// Update is called once per frame
void Update () {

}

}
希望通过js调用dataFind()方法,获得picAndmod的值。。。。。连接数据库System.Data;System.Collections; MySql.Data.MySqlClient; MySql.Data;这些文件放在了Plugins文件夹下

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题