component 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 ArticleAdd a extension method to the class Application
I would like to create a extension method call ReloadLevel() for the class Application. I tried this: public static void ReloadLevel(this Application app){ app.LoadLevel(app.loadedLevel); } It gives 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 ArticleHow Create the Array of Class (Steps of Game) that Editor has Wrote
hi I have Class [System.Serializable] public class EditorHolder : MonoBehaviour { public Sprite Picture; public string GeneralTypeWord; public string[] SpecializeTypeWord; public int[]...
View ArticleFuture compatible saveClass?
Creating a basic savefile on start i set the currentData either to the content from a savefile or create default values from a new class and saves that to file. So the next time the game is loaded we...
View ArticleError while serializing and deserializing multiple instances of a class while...
This is the code that I had written to store the details of 4 toys with their id and their vector 3 positions. But there is some error that's giving me trouble, and I can't identify what that error...
View ArticleAdding a prefab to the Item class instance
Here is a problem, which is a little bit abstract to me. You may find it foolish, but I am merely a beginner. Let's say I have a Weapon class that derives from Item class. Then, I have a following list...
View ArticleHow GameObject [] is working between 2 classes.
Hi, i have a doubt, i'm sorry if this is something of minor importance but i have to know why this is happening. I have a script called MyClass1 attached to a GameObject called PlayersManager, with...
View ArticleUnity MonoBehaviour Objects vs Game Logic
So I'm somewhat of a noobie to Unity. I've dabbled in it since Unity 3, but never actually made anything constructive or worth mentioning. I've been a C#, ASP.NET, and JAVA programmer by career for...
View Article"Object reference not set to an instance of the object" yet I can see the...
As title says, using this code to access a function in another script GameObject castAccess = GameObject.Find("castInt(clone)"); castInt castScript = castAccess.GetComponent("castInt") as castInt;...
View ArticleNull Reference Error With Scriptable Objects
Custom Scriptable Object public class GameDataScriptableObject: ScriptableObject,ICSVReader where T : class { public T[] mData; public T GetFromId(uint ID) { for (int i = 0; i < mData.Length; ++i) {...
View ArticleNon Monobehaviour GameManager?
Hi, most time I use Monobehaviour scripts, but now I want to create a GameManager which contains a lot of variables. I don't want to attach it to a GameObject, that means I can't use monobehaviour. The...
View Article