Skip to main content

Questions tagged [monobehaviour]

Filter by
Sorted by
Tagged with
0 votes
1 answer
61 views

I have a Unity scene that works fine in editor, but always crash after being compiled into an executable with .NET/Mono backend, so I enabled stacktrace logging and dump the whole log into a file: <...
tribbloid's user avatar
  • 131
0 votes
1 answer
242 views

Recently, I've been experimenting with different ways of initializing MonoBehaviours (since constructors are not an option), and I reached a solution that I am mostly satisfied with, but there are a ...
DemonicTree's user avatar
1 vote
1 answer
183 views

I have the following case: I have a class called App.cs and here I have a function called Render, that runs once every frame: ...
Bogdan's user avatar
  • 111
0 votes
1 answer
1k views

I'm coming from Unreal, and in Unreal you can use the constructor to make logic that is called in editor (as well as when beginning play). This is useful for some things, but Unity documentation says ...
Alexandre's user avatar
  • 150
0 votes
0 answers
42 views

Weird Unity thinks that the code that I've checked already has a MonoDevelop inside of it, but unity doesn't think so, can you help find what I wrote wrong in these two scripts? ...
INDO_GEMENG's user avatar
-1 votes
1 answer
78 views

I was writing the character controller for my player character, but Unity said that there was no mono behavior script in the file I'd written the file right and I included the mono behavior ...
INDO_GEMENG's user avatar
0 votes
2 answers
702 views

I have three scritps and one plain C# class. EnemyMonobehaviour, EnemyAttackMonobehaviour and UnitState plain class. In enemyMono I have Initialize function that initializes unitState. ...
Taras Fityo's user avatar
0 votes
1 answer
104 views

I have a script that triggers when the enemies are in range of my objective, but it also contains an Update method for its the damage. I noticed that Update is being called even when the enemies are ...
Doug Ray's user avatar
  • 143
0 votes
1 answer
4k views

I am trying to put a gameobject into a prefab. Unity says "You are trying to save a Prefab that contains the script 'NPCDebugInfo', which does not derive from MonoBehaviour. This is not allowed. ...
tmighty's user avatar
  • 919
1 vote
1 answer
342 views

I have been struggling with this dilemma for quite a while already. Our game is complex enough that we have tons of logic in normal C# scripts that function very independently of any Unity specific ...
fguillen's user avatar
  • 243
0 votes
0 answers
150 views

Having worked with monobehaviour and processing before, is it possible to create the same paradigm both frameworks use which basically is writing all code in two main functions, start/setup and update/...
BitBlunder's user avatar
0 votes
1 answer
1k views

I'm somewhat new to Unity and am trying to build a battle system. Right now, I have an attack that checks collisions with enemy objects like this: ...
G_hi3's user avatar
  • 111
0 votes
1 answer
582 views

Bellow is my code. I have an abstract class and a inheriting class. This keeps giving me an NullReferenceException, on the ...
ManoTech's user avatar
  • 157
2 votes
1 answer
682 views

I've run into the same problem multiple times that is begging for a solution. I try to write a lot of decoupled code to make my MonoBehaviour scripts as reusable as possible. This means that I end up ...
Adam B's user avatar
  • 800
0 votes
0 answers
844 views

User philip previously marked this as a duplicate question of this, but failed to actually read either question it seems. The question that this was marked as a duplicate of, does not address the ...
Dan_'s user avatar
  • 101
3 votes
1 answer
2k views

I'm running into a problem that I think will seriously affect maintainability down the road, so I'd like to figure it out now before it becomes a problem. I've been starting to use private [...
Adam B's user avatar
  • 800
-1 votes
1 answer
63 views

This is bizarre enough that it has to be me being an idiot. I have a MonoBehaviour with some public fields and public methods: ...
BanksySan's user avatar
  • 200
1 vote
1 answer
195 views

I managed to make a simple message box prefab with a Text and a Button through Canvas, and ...
PiggyChu001's user avatar
-1 votes
1 answer
551 views

In my method iTest.doStuff(), I try to convert interface testInterf _ti into a MonoBehavior. This gives me "error CS0246: The type or namespace name 'MonoBehavior' could not be found", but in the ...
Tom Titanium Lento's user avatar
1 vote
0 answers
38 views

got a bit of a weird error, hopefully someone here can help. So I have created a custom class (does not derive from Monobehavior). Then I have a variable for the class, in the Start() method I set ...
John Smith's user avatar
  • 1,255
0 votes
1 answer
1k views

I'm working on a voxel based game and this solution would make the implementation of networking and other features a lot more easier, it is less error-prone, easier to edit in the Editor, etc. So the ...
Tudvari's user avatar
  • 801
0 votes
3 answers
120 views

Hello I am a beginner in Unity and still currently exploring with scripts. So I ran into a problem. In FetchAndAssign.cs Script ...
Addy Pete's user avatar
1 vote
1 answer
2k views

I have a GameScene with an initially active GameObject in it, which has a singleton component: ...
Jacob's user avatar
  • 2,552
8 votes
1 answer
4k views

Is it possible to use Hybrid ECS with some components and the standard MonoBehaviour with all your old code? I want to know because I already have some game ...
Marc Rasmussen's user avatar
-1 votes
1 answer
272 views

I have a MonoBehaviour class in a compiled DLL that I have included in my Unity project. It automatically serializes public field data as expected. However, whenever I update the dll (by overwriting ...
GorillaOne's user avatar
0 votes
0 answers
113 views

I am trying to capture the game play and store it on local memory without using any third party sdk's. I tried This Video Capture Script but i didn't get the recorded file even i don't know whether it'...
Manoj Balaji M's user avatar
0 votes
1 answer
182 views

I am working on a game that contain 1000+ buttons starts from 0 - 999 with 3 decimals like 0-9, 00-99 and 000-999. if the user click the button the button image want to change. it working fine for me ...
Manoj Balaji M's user avatar
0 votes
0 answers
319 views

I know from Object Oriented Design perspective that in order to provide encapsulation, we should avoid defining ...
Emad's user avatar
  • 1,136
2 votes
2 answers
3k views

In Unity3D, I have a MonoBehaviour which gets added to game objects. I'm adding a string "name" field to it. I'd like the ...
Dan Hulme's user avatar
  • 187
1 vote
2 answers
9k views

If I were coding in generic C# I can create a list that only stores a certain type of object. If I accidentally try to add anything other than that type to the list I will be promptly told and can fix ...
Francis's user avatar
  • 159
1 vote
1 answer
771 views

I am trying to replicate the model of Unity documentation about coroutines, but I want to partition it in another class: I have these two: ...
JamesB's user avatar
  • 279
1 vote
1 answer
1k views

I am looking over a script that has a particular function called to disable the script and mark a list for re-structuring: ...
Gnemlock's user avatar
  • 5,333
0 votes
1 answer
253 views

In our project we used to have a PlayerObject class and then Unit and Building derived from that class. We recently started taking a look at Bolt, which requires classes that define objects that may ...
Douglas Gaskell's user avatar