Quantcast
Viewing all articles
Browse latest Browse all 131

Information about Classes and Instantiate Objects C#

Hi to all Unity Experts, I was wondering how can I instantiate Objects from Classes. and before I start sorry for my Bad English. well here we go I'm trying to create a class named "Enemies" this is the class Enemies using UnityEngine; using System.Collections; public class Enemies : MonoBehaviour { private int hpEnemy; public int _hpEnemy { get { return hpEnemy; } set { hpEnemy = value; } } // Use this for initialization void Start () { } // Update is called once per frame void Update () { } } yeah I know there's no sense mistakes lol, but I'm trying to studing C# and Unity al by myself. and when I try to open another Script Often in Visual Studio C# i do this Enemies myFirstEnemy = new Enemies(); // <---Instantiate an Object myFirstEnemy._hpEnemy; // <-----Calling the propriety but the problem is that in Unity when I try to Instantiate the Object, it doesn't give me the proprieties like above :\ I would like to know why it doesn't work, I want an explaination :( Again Sorry for my Bad English.

Viewing all articles
Browse latest Browse all 131

Trending Articles