Hello all,
Let’s see how can I explain the origin of my doubts. I am doing my first game with Unity, and it is supposed to be developed for wiiware so I have to have into account the memory and resource sizes limitations.
I was designing my class diagrams for all the vidoegame basis: EnemyManager (containing all enemies templates and instances), Level Manager (containing all levels with its settings), etc, and then I started to write the code in C#. The first question I got into my mind was: how do I define all these settings and enemy/levels definitions? I said: all right I will do it through xml files, parse them and save the info into the managers. However, after being playing with the Unity Editor I realised that instead of xml files I could use a GameObject to define the settings and properties of my managers.
Let’s make an example with enemyManager. The enemy Manager has a container of Enemies. These enemies has to be loaded at the beginning of the game: I could parse an xml file with all the enemies and then instiantiate them when needed or attach the EnemyManager script to a GameObject and through the editor add, one by one, the prefabs of each enemy to the array of enemies.
What do you think is the best solution for all this kind of stuff?
GameObjects work fine for that sort of thing.
If you want to parse with XML, you’ll have to use Mono’s .NET libraries. But thats doing everything the hard way.
However, I’m not sure if thats possible with the Wii.
The advantage to defining everything in the GameObjects is that your public variables are now editable in the Inspector, allowing you to test various settings in real time, just by changing their values in Unity’s GUI. This also makes for quick level editing and entity management.
Think of your scripts as components to the Unity engine. They extend Unity for your use. For oldschool programmers it’s a bit of getting use to.
Thanks for the reply
I am an oldschool programmer that’s why this is for me a completely new way to code. But I agree it is really easy once you get used to it and, as you said, once you have the GameObjects with all the properties you can leave the tweak to the game designers!
I’m in the same boat right now and I have a few game levels that the player will visit more than once. I need to load a set of enemies and waypoints depending on the player’s current objective and how far into the game they are e.g. Act 1, Act 2 or Act 3
I was thinking I could create a game object that contains a set of enemies for a level and create a prefab? I could then load the prefab from Resources path at runtime if I test the currently loaded level and the current Act?