- Home /
Massive memory usage during compile time
Hi guys,
I am currently making a game where players can select several characters in a team to fight some AI. It is a turn-based game and each character has several abilities.
As I need to make quite a number of abilities for all the different characters, I decided to create a base class called "CustomAbility" and every ability will be a subclass of "CustomAbility".
I am writing the classes in JavaScript.
In "CustomAbility", there are declarations of several "protected" variables such as
protected var level : int = 1;
protected var name : String = "Not assigned";
When I try to compile the script (hit save on the MonoDevelop then make the Unity main window the active window), I notice that the memory usage shoots up to 3.5GB++ until unity crashes.
However, when I comment out the declarations, Unity can compile successfully without going past 700MB in memory usage.
Anyone can help me understand what is going on? What happens during compile time that takes up so much memory?
EDIT: I did an experiment and after I moved every variable declared in the base class (for characters and abilities) to the subclasses (meaning now "CustomAbility" has no variables, but "Fireball", which extends "CustomAbility", has all the variables) Unity can compile in under 200MB.
This is very confusing to me, I would greatly appreciate anyone who could help me understand why this is the case. Thanks.
I agree with Ben. This is a user forum, the Unity $$anonymous$$m won't see it here.
Your answer
Follow this Question
Related Questions
Limit on the amount of data I can store on Android Devices? 0 Answers
Crashing on Samsung S6, S6 Edge, and Galaxy Tab S 4 Answers
Instantiate fails on iPad. How can I debug memory allocation errors? 1 Answer
Unity crashes when GUI becomes too complex 1 Answer
Why my android app crashes when using RenderTexture.ReleaseTemporary? 0 Answers