Quantcast
Channel: Questions in topic: "class instance"
Browsing index pages (131 articles)

I made a child class of another child class, and if I declare new...

Basically, I have made: - a parent class for behaviors "CreatureBehavior" - a child class for a builder npc "BuilderBehavior", which inherits from "CreatureBehavior" - a function inside...

View Article


creating new elements on a serialized list of class from inspector is also...

I am creating a modular state machine called SabiStateMachine I have a list of a custom class called States ( this custom class is called SabiState and the list of this custom class is called States)...

View Article


Instantiate a class type from inside a variable?

Hi, I have a few Boss AI classes that inherit from the class Boss. In inspector, I can drag in a BossAI script as an object (BossClass), but I'm not able to properly instantiate it. ![alt text][1] this...

View Article

Saving class data without having lots of references?

[System.Serializable] public class Level_Data { public string LVLID; public bool LevelComplete;[Space(20)] public string AnimationState; public Wire_Dictionary Wires; public Switch_Dictionary Switches;...

View Article

How to choose base class to make Inherit C#

Hello everyone, I'm new on Unity and C#. In my project I need to choose the base class to make a child class inherit. In particular I have an Interface that defines all Character's methods: public...

View Article


Creating a copy of an existing class object

I have a class which is used to created various items and store them in a static dictionary database. Creating and adding items to the database is working just as intended but I have ran into an issue...

View Article

How do i reference a path as a sprite?

I created a Gun class with a constructor. One of the properties is a sprite. I made a "Weapons" script to handle all the guns that i create. When i use the new keyword to create a new instance of the...

View Article

Any way to destroy internal classes that were instantiated?

I'm building a script that will instantiate some internal script when called. As in, public class Example : MonoBehaviour { private List newClassList = new List(); public void MakeNewClass() {...

View Article


ScriptableObject problem and creating a new class instance

Hi! I ran into a problem with Scriptable Objects. I have a abstract class derived from ScriptableObject. All other cards are inherited from this class, which I assign values ​​in the inspector public...

View Article


Returned class is always null

The MeshHolder class that GenerateChunkMesh returns is always null. No matter what I do to try and make it return the class it continues to return null. public class MeshGenerator { private byte[,,]...

View Article

How to Assign Class Instances to Prefabs Inside the Inspector

Apologies in advance for the lengthy introduction, I've tried my best to describe my situation as succinctly as possible. ---------- I have a non-Monobehaviour class called **Spell** which defines the...

View Article

is class variable in a ScriptableObject automaticly Instantiated?

while I created an Instance of ScriptableObject with a class variable in it, in the inspector it shows the class variable as default instance of the class, do I still need to add a null checker before...

View Article

In the second script "InputManger" should be glowing but it is not. Why is...

using System.Collections; using System.Collections.Generic; using UnityEngine; public class InputManager : MonoBehaviour { // Start is called before the first frame update public float throttle; public...

View Article


Error referencing custom class elements

Hello everyone. I've been working in a grid based project in which I save an instance of the class "Cell" in a "grid[ , ]" array, that represents each particular cell of the grid and conteins...

View Article

singleton pointer and updating variables of the singleton with the pointer

When i have created a player class and created a singleton in it: public static Player instance; void Awake() { if (instance != null) { Debug.LogWarning("More than one instance of Inventory found");...

View Article


How to correctly use MonoBehaviour inherited class?

Hi, I'm trying to use a class structure to store coroutines responsible for spawning enemy waves. I already regret the idea but want to get to the bottom of it. My **Spawn_Manger** script is attached...

View Article

Merging multiple array's from a specific class without manually targeting them

Hello, I got into Unity really hardcore, around 8-12 hours a day of continues learning, I just can't stop. _ the problem is that I'm trying to merge multiple arrays into one. _ I know about...

View Article


C# Inheritance and passing Components

Hi !, Been learning inheritance and passing variables and parameters between classes and subclasses. Also tried to setup sphere collider from base class by passing neccesary variables from derived...

View Article

Loading class instances from Json file gives ArgumentNullException

In my game, I have a Computer class with following variables: [System.Serializable] public class Computer : MonoBehaviour, ShopItem{ public string model; public int price; public int speed; public int...

View Article

I'm struggling with assigning unique attributes to prefab objects.

As a test for a much larger project, I'm creating five primitive cubes (prefabs) and want to assign each a unique "Name" and two unique numbers assigned at random...I plan to access and manipulate...

View Article
Browsing index pages (131 articles)


Latest Images