What is a constructor in C #?

Community Forums/General Help/What is a constructor in C #?

Yue(Posted 2014) [#1]
Bonjour, je voudrais savoir ce qu'est un constructeur dans une classe.


Matty(Posted 2014) [#2]
I don't speak French (and neither did I think did you ;-) ) but a constructor, from what I can tell, is the method used when creating an instance of an object. This method can be user defined/programmed according to what you want it to do.

?

Is that what you were after?

Sorry I don't know C# though.


Yue(Posted 2014) [#3]
I'm a little confused, I have an example of feline class and create a Cat object inherits things feline class constructor as public variables that are within the class funcioanan to objetener access to them when I create the object.

But I have repeated variables and do not know where, it seems inheritance ...


xlsior(Posted 2014) [#4]
The translator couldn't make any sense of your question here, no idea what you're asking...


Yue(Posted 2014) [#5]
:(


ziggy(Posted 2014) [#6]
Just write it again on google translator, but be sure to write in spanish without typos.

are within the class funcioanan to objetener access to them when I create the object.
I'm sure the word "funcioanan" was meant to be "funcionan" and "objetener" was "obtener".
If you don't write it properly in the original language, the translation is impossible to follow or guess.


Yue(Posted 2014) [#7]
Hi, I'm trying to learn C #, the case is that it is very difficult for people to help me on the forums of Unity, these forums are very fast and why I do here, with the scope to offend anyone, always ready to learn advanced users.

The problem I have now is that the build script for C # on the unit is very different from progrmación of Blitz3D and the problem I have now is that I need to click on a button on a main menu can be passed to another menu options, but this only happens once, ie i click options, go to the options menu and then back to the main menu using the back button, but then if i want to try again does not work.

using UnityEngine;
using System.Collections;

public class Menu : MonoBehaviour
{

	public enum NavegandoMenu
	{
	 MenuInicial,
	 MenuOpciones,
	}

	byte menuActivo = (byte)NavegandoMenu.MenuInicial;


	public GUISkin miEstilo;


	// Clases para GUI.
	private MenuInicial MenuInicial = new MenuInicial ();
	private MenuOpciones MenuOpciones = new MenuOpciones ();
	//private MenuLenguaje MenuLenguaje = new MenuLenguaje ();




	void OnGUI(){


	switch(menuActivo)
		{

		case (byte) NavegandoMenu.MenuInicial:
			MenuInicial.Interfaz_MenuInicial(miEstilo);





			break;
		case (byte) NavegandoMenu.MenuOpciones:
			MenuOpciones.Interfaz_MenuOpciones(miEstilo);


			break;
		}

		// Eventos Menu Inicial.
		switch(MenuInicial.botonActivado)
		{
			
		case (byte) MenuInicial.Botones_MenuInicial.Bton_Opciones:
			
			menuActivo = (byte) NavegandoMenu.MenuOpciones;
			break;
			
		case (byte) MenuInicial.Botones_MenuInicial.Bton_Salir:
			
			Application.Quit ();
			break;
			
		}



		// Eventos Menu Opciones.
		switch(MenuOpciones.botonActivado)
		{
			
		case (byte) MenuOpciones.Botones_MenuOpciones.Bton_Regresar:
			
			menuActivo = (byte) NavegandoMenu.MenuInicial;
			menuActivo = 0;
			break;
			
			/*case (byte) MenuInicial.Botones_MenuInicial.Bton_Salir:
				
				Application.Quit ();
				break;
				*/
		}




	}





feeble1(Posted 2014) [#8]
Abridged Yue translation:
Hi, I'm trying to learn C#, but it is difficult for me to find help on the Unity forums. These forums (Blitz) have fast replies, when I post here, and there are advanced users.

The problem I have now is that the scripting for C# in Unity is quite different from programming in Blitz3D. My current problem is that I need to click a button on the main menu and pass that click to other menu option. Unfortunately this only works once, ie: I click option and it goes to the options menu, but when I return to the main menu, it will not work a second time.

@Yue Have you had a look at Blitzlike? https://dl.dropboxusercontent.com/u/9723781/Unity/BlitzLike/website/Blitzlike%20in%20Unity.xhtml