Problem about finding script name
Hi all, i am struggling with this problem for very long time and i have never found right solution. So, let me explain my problem ( i don't know how good will you understand because my English is not...
View ArticleHow to create a player class and make 2 instances of the player, and handle...
Hello, I am very new to unity, I followed the Roll a Ball tutorial here https://unity3d.com/learn/tutorials/projects/roll-a-ball/displaying-text?playlist=17141 I successfully made a one player game....
View ArticlePassing an instance of a class to different game objects
I am trying to make a product catalog so we can show products, take orders, etc when on different devices and offline to our store. At the moment I am having trouble passing a instantiated class to...
View ArticleInformation 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...
View ArticlePass a variable into a class on creation
I've got a Mage class where they can shoot a fireball. I've got it so that when the player decided to shoot a fireball a fireball will instantiate with a script on it that will deal with movement and...
View ArticleNoob question about class inheritance
I'm kinda new to scripting and I've got a basic question about class inheritance in Unity. Let's say I want to make a base class named Enemy, which will contain the basic features shared by all...
View ArticleWhy have error: NullReferenceException: Object reference not set to an...
public class GamePlayManager : MonoBehaviour { public void BirdDiedShowPanel(){ pausePanel.SetActive (true); scoreText.gameObject.SetActive (false); gameOverUI.gameObject.SetActive (true);...
View ArticleInitializing a parent class and want it to get values from the relevant child.
Hi, I'm creating an RTS and been having a few issues but nothing that google hasn't solved so far. In this case, I'm having some trouble with checking the cost of the building I would like to create,...
View ArticleObject reference not set to an instance of an object (singleton)
Hello! I have a class Main. In the start method of that class i call a method InitMainScreen. InitMainScreen sets some starting conditions (enables the main menu, clears scene of garbage objects and...
View ArticleBest way to reference player class instance?
I'm making an FPS which has a "Player" class attached to a game object in a scene. This class keeps track of things like player health, ammo etc. and has functions for various player behavior. I need...
View Articlecomponent not detecting parent class
Say I have **class A.** Then I make **class B** that inherits from **class A.** I put the **class B** script on a gameobject in the scene. I have a separate gameobject that has a component on it. this...
View ArticleHow to search a certain variable in a list of a created class (C#)
Wasn't to sure how to word the question so here's a description with code below. I have a list which takes type of Room (a class i created) and this class has a contructor to create many instances of...
View ArticleHow would I handle having one instance of 2 possible class, one derived from...
I know that may sound odd, so let me elaborate. I am creating a custom character controller, but with 2 separate versions, a basic type & an advanced type, advanced inheriting from the basic. They...
View Articlec# class array not showing up in inspector
This might seem like a stupid question, but I can't figure out why it doesn't work. I have a c# class not inheriting from MonoBehaviour and marked as serializable. Then I have another (normal...
View ArticleHow to create a repository of enemy objects that are initialised but then get...
I am attempting to create a really simple turn based rpg. I have created an enemy object as follows: public class Enemy() { int attack; int hp; string name; public Enemy(string _name, int _hp, int...
View Articlecreate custom class
HI. I want create custom class in my script and define custom variables in this class. for do this I create another public class and defined my variables inside it. but when i play the game, it give me...
View ArticleWhy is my MonoBehaviour never being deleted?
I discovered this problem because I have a script that hooks to a static event from another class. And noticed that after reloading a level, the event delegate function was being called TWICE; once for...
View ArticleIs there anyway to disable clients GameObject instance from Server or...
I want to know how to disable object instantiated on client side from server and vice versa.
View ArticleInstance of a class, adding it to a List
Hello ! I'm new to unity, but not that new to C# and I want to ask a really average and regular question which I don't know how to search after. I made a class called ConsumableItem.cs. using...
View ArticleHow to pass classes of a class to a function's parameter?
Hello and thanks for taking the time to review my question. My question: how do I pass classes of a parent class to a function's parameter? What I HAVE, and what I WANT to do: HAVE: - I have a...
View Article