How to work with Unity?!
Hey guys, i have started working with Unity several weeks ago. I have some knowledge about OOP and have worked with some languages and platforms before. This is the first time I am working with scripts. I started to watch several tutorials and most of them deliver quite nice and sophisticated informations, but what I'm missing is how to manage my project, which led me to the following problem:
I'm working on a puzzle game. Each level is basicly structured the same way. The only difference is the number of GameObjects and some level-dependend informations, like how many moves the player already made. So beside a GameManager object, that manages comprehensive data and that i wouldn't allow to get destroyed, i have a LevelManager script. So every level has basicly the same LevelManager script. On top they have a LevelData# which contains the level-dependend informations and adds every GameObject of the current Level(Scene) to a list (which is a field of LevelManager) in the OnAwake method. The thing is, that I'm accessing this list from yet another script in its Update method. Unity throws plenty NullReferenceExceptions, telling me, that the list has no elements in it.
Besides the fact, that i would like to know, why this problem occurs, i moreover want to know, if this approach is ok (since it seems pretty cluttered to me)?! I read articles about Inheritance vs Composition referred to this problem, but this whole workflow with scripts and the unity editor seems not to apply fully to that.
I would really appreciate any kind of help. Maybe you guys have some references for me, that would enlighten me.
Regards
Answer by IbrahimK · Sep 30, 2015 at 07:44 PM
Hey Beennn,
first of all, thank you for your reply. Seems like nobody wanted to read the long text.
I actually solved the problem. It was a stupid mistake, that i made. One of my GameObjects was missing the Script i was trying to access in a loop. So yeah...
Besides of that, I have like 3784583495 Questions regarding how to work with Unity. And I sadly don't know anyone who works with Unity. I was wondering, if I should post the questions here, though not expecting them to get answered. What would you suggest?
The Questions would be like:
Should I use the inbuilt UI-System(if so, should i import UI graphics as sprites? Is it the right approach?), use external libraries or create a GUI trough script?
I made a simple circular movement for a GameObject in script, why is it causing spikes(i have read several things about this already, but none of those answers were satisfying).
How to import UI Graphics? Get a regular size and rescale them, or is it a better approach to create graphics the size I'm gonna use them. If so, there are two problems. I would be forced to customize every texture everytime i want to make minor changes and since I'm developing for mobile devices, it will be rescaled anyway. The worst thing is, that all this rescaling causes fragments, which is really annoying and I'm not sure what to do about.
etc.
I will try to start a new Question. Maybe you have the knowledge and the time to answer some of these? Or maybe a reference, where I could find answers to those questions?
Best regards,
Ibrahim
Your answer
Follow this Question
Related Questions
Roguelike: workflow working with many map generators and tile sets 0 Answers
Workflow ideas needed 0 Answers
Dedicated audio person workflow 0 Answers
LoadAssetAtPath doesn't seem to work for ScriptableObject asset in AssetPostProcessor 1 Answer
How to define a function seperate from the class in which it must called? 1 Answer