Hello all, i installed Unity 3.4.3 f1 and when i try to run a simple example using mono dev or xamarin studio the next messages appears:
The type or namespace name ‘UnityEngine’ could not be found (are you missing a using directive or an assembly reference?)
the same for MonoBehaviour line. So i reinstall this version again BUT the issue still appearing, any help will be appreciate.
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour {
void Start ( ) {
Texture2D texture = new Texture2D (128,128);
render.material.mainTexture = texture;
First you have 1 extra } at the bottom of the script. Second you didn’t declare texture as a variable. Third, render is suppost to be renderer. The follow script is the correct setup I think.
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour {
void Start ()
{
var texture = new Texture2D (128,128);
renderer.material.mainTexture = texture;
}
}
Also remember to use the code tags (under advance settings) so it doesn’t turn some things to smileys ie: 8) is 8 )
Beside what wondyr wrote, you should always open MonoDevelop or XamarinStudio through Unity. That means you create an new project or open an existing one and then open MonoDevelop/XamarinStudio either by double clicking on a script in the project or by selecting “Assets → Sync MonoDevelop Project” in the menu.
Hello all, what to do mono and xamarin are not compiling the example!!! i made modifications to the code lines because was wondyr wrote but is not running yet. Thank you and
If Xamarin Studio is open, you should not select any solution, the solution should automatically open. After you sync the project, try to double click on a script in the Unity project and try that.
If that doesn’t work, you should stick to Mono Develop. Even if Xamarin Studio is pretty close, the Unity support varies from version to version.
The reason for the error is you are building the build in the wrong place. You are building inside Xamarin Studio. You need to build it inside of Unity for it to build correctly. I got the same errors you did when I tried to build in Xamarin Studio but not in Unity.