- Home /
Is there a game information class for Unity?
In UDK, there's the concept of "GameInfo" - a class that contains all of the information for a specific game type. It contains the team info, current level completion objectives/status, etc.
Is there an equivalent in Unity where I should place that information? Or is this something I just create and attach to a game object in each scene?
Answer by DaveA · Feb 13, 2012 at 11:03 PM
That's something you would create. You could attach it to an object, but you might want to do that in the first level and make it non-destructable so it lives on in other levels, and/or put it in Plugins as static so it's sorta like a global. Also look up 'singletons'
You don't have to attach to a gameObject if you inherit from the http://unity3d.com/support/documentation/ScriptReference/ScriptableObject.html class
Sounds like ScriptableObject and non-destructable items may be the way to go. I'm familiar with singletons (C# dev for 9 years), but I'm still learning about where .NET ends and Unity scripting begins. They definitely aren't an exact match. :)
Can you make a non-destructable ScriptableObject? If it's possible, that sounds like what I'd want: a data class that is persistent.
Looks like ScriptableObject inherits from Object (makes sense :) ), so DDOL should work just fine.
Thanks again. :)