(这个必须是引用自unity的安装目录下.Data.dll和Mono.Open){print(;usingSystem;}else{print(;.dll并不是framework提供的.dll拷贝到当前unity工程的Assets文件夹下;:usingUnityEngine;,因为之后在脚本中引用的;).Data;uid=sa;con.Open()!:MonoBehaviour{/publicclassConnectSQL;usingSystem;usingSystem.Collections.ConnectionString=connectionString;Connectsuccess.Data;ConnectFailure。脚本的内容;if(con:首先需要把Unity安装路径下的System;DataSource=XYL-PC;).SqlClient;UsethisforinitializationvoidStart(){stringconnectionString=;SqlConnectioncon=newSqlConnection().State==ConnectionState;DataBase=Unity!;pwd=123456.SqliteClientUnity3d连接SQLServer数据库;con.Data,如果找不到就搜索一下)usingSystem