The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [monobehaviour]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1
votes
1answer
31 views

Public MonoBehavior string fields empty

This is bizarre enough that it has to be me being an idiot. I have a MonoBehaviour with some public fields and public methods: ...
1
vote
1answer
43 views

Unity, WaitUntil in a self-made message box class

I managed to make a simple message box prefab with a Text and a Button through Canvas, and ...
-1
votes
1answer
37 views

How do I convert an interface into a MonoBehavior in Unity?

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 ...
1
vote
0answers
13 views

Unity, weird error appearing after playing in editor

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 ...
0
votes
1answer
108 views

Is it efficient to have a only-data MonoBehaviours on lots of game objects?

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 ...
0
votes
3answers
52 views

Public value null after assigning it from a different script

Hello I am a beginner in Unity and still currently exploring with scripts. So I ran into a problem. In FetchAndAssign.cs Script ...
1
vote
1answer
647 views

Waiting for object's Awake() after loading a new scene synchronously

I have a GameScene with an initially active GameObject in it, which has a singleton component: ...
8
votes
1answer
2k views

Unity Hybrid ECS with “old way”

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 ...
-1
votes
1answer
87 views

Unity3D MonoBehaviour in .dll loses serialized data when dll is updated

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 ...
0
votes
0answers
99 views

Capture Video without Third Party SDK's

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'...
0
votes
1answer
122 views

few button image are not updating

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 ...
0
votes
0answers
105 views

Best practice to define fields scope in C# script of Unity in regard to serialization?

I know from Object Oriented Design perspective that in order to provide encapsulation, we should avoid defining ...
2
votes
2answers
807 views

How can I give a MonoBehaviour field a default value that depends on the object?

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 ...
0
votes
2answers
4k views

How to make Lists (and Arrays) in Unity only take GameObjects of a certain “type”

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 ...
1
vote
1answer
438 views

StartCoroutine from other MonoBehaviour is not working

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: ...
1
vote
1answer
789 views

What is the difference between a game object being disabled and it made inactive?

I am looking over a script that has a particular function called to disable the script and mark a list for re-structuring: ...
0
votes
1answer
222 views

Have several classes with a common interface, but still able to access MonoBehaviour methods through that interface?

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 ...