Quantcast
Channel: Questions in topic: "dllimport"
Viewing all articles
Browse latest Browse all 160

Missing using directive with imported c# .ddl

$
0
0
I have created a c# .dll to do some bitmap stuff with "System.Drawing" inside a unity game. So I set up a c# classlibrary-project in visual studio, changed targetframework to ".NET Framework 3.5", added UnityEngine.dll as a reference and built the tiler.dll. It has the namespace "Tiler" and a public class with a public method in it. I tested the class in visualStudio and everything works. Then I placed this .dll in my Assetsfolder and wrote `using Tiler;` I instanciated the class and called the method. Everything is fine and monodevelop recognices everything. But in unityeditor there is this error: The type or namespace name `CreateTiledGraphic' could not be found. Are you missing a using directive or an assembly reference? My .dll: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using UnityEngine; namespace Tiler { class CreateTiledGraphic { public string TileGraphic(String path, int[,] colors, int xBlocks) { ... } } } And my c#-script in unity: using UnityEngine; using System.Collections; using Tiler; public class PNG_FileFinder : MonoBehaviour { protected string m_graphicPath; protected string m_graphicTiledPath; protected FileBrowser m_fileBrowser; private CreateTiledGraphic createTG; public int xBlocks; public int[,] colors; [SerializeField] protected Texture2D m_directoryImage, m_fileImage; void Start() { createTG = new CreateTiledGraphic (); } protected void OnGUI () { if (m_fileBrowser != null) { m_fileBrowser.OnGUI(); } else { OnGUIMain(); } } protected void OnGUIMain() { GUILayout.BeginHorizontal(); GUILayout.Label("PNG File", GUILayout.Width(100)); GUILayout.FlexibleSpace(); GUILayout.Label(m_graphicPath ?? "none selected"); if (GUILayout.Button("...", GUILayout.ExpandWidth(false))) { m_fileBrowser = new FileBrowser( new Rect(100, 100, 600, 500), "Choose PNG File", FileSelectedCallback ); m_fileBrowser.SelectionPattern = "*.png"; m_fileBrowser.DirectoryImage = m_directoryImage; m_fileBrowser.FileImage = m_fileImage; } GUILayout.EndHorizontal(); } protected void FileSelectedCallback(string path) { m_fileBrowser = null; m_graphicPath = path; m_graphicTiledPath = createTG.TileGraphic(m_graphicPath, colors, xBlocks); } } (I use a script from the unify wiki and just added the few lines for calling the dll-method.) I think this is just a stupid small mistake but I cannot find it. Thanks in advance for your help!

Viewing all articles
Browse latest Browse all 160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>