- Home /
how does unity handle game updates?
Are there any pitfalls such as; using/updating Enumerable's, updating optional parameters, etc that would cause a problem in the assemblies when updating. I will be releasing on iOS, Droid and Mac/PC and web.
The below post got me thinking:
void foo(int reqdParam, int optParam = 0)
{
// ...
}
foo(5); // gets compiled as foo(5,0)
foo(5, 10);
The reason it is not included in C# is mainly due to versioning
problem. Optional arguments are handled in most programming languages by inserting the default value of the optional argument at the call site. So for the above code foo(5) is compiled as foo(5, 0).
The versioning issue comes to play if the call site and the method are in
different assemblies. In the next version of the method the default value of optParam may change from 0 to 1 and 0 can become an unsupported value.
SOURCE: http://blogs.msdn.com/b/abhinaba/archive/2006/02/24/optional-arguments-in-c.aspx
I don't see why this would happen if you are using the default by value. If you were to use, for instance, a ref / out designation in the foo function for the optParam, then yes. The default is not to use a reference to an actual object but ins$$anonymous$$d to pass an object.
$$anonymous$$aybe you can clarify your statement?
Thanks. $$anonymous$$y overall question is aimed at finding out if anyone has ran into problems when updating their apps/games...or if basically all of this is handled internally by Unity?
If there is something to avoid doing in code...this is the information I am after. The above example is just one of the things that got me thinking along these lines. The other thing was if I should avoid working with enum's.
i.e. public enum $$anonymous$$yEnum {icon0=0, icon1=0}
Possible Problem: ...I go in on the next update of my game and want to add some more icons or modify the existing ones...will these just be overwritten via the update? or should I use a List rather than a enum? I understand that enums can have potential versioning issues as they are compile time and a constant.
Reference: http://msdn.microsoft.com/en-us/library/sbbt4032.aspx Under "Robust Program$$anonymous$$g":
Just as with any constant, all references to the individual values of an enum are converted to numeric literals at compile time. This can create potential versioning issues as described in Constants (C# Program$$anonymous$$g Guide).
Answer by Bunny83 · Dec 06, 2012 at 10:58 PM
I saw this question a few hours ago, i was trying to figure out what's the actual question and what's the relationship to Unity. If you really talk about updating your own game and not about switching to a new Unity version, i don't see any relevance here.
You are responsible for your code. There's nothing a framework can do when you change something in your code that breaks other things in your game.
Usually you or your company are the only ones that work on the game. "potential versioning issues" can mainly arise when you develop middleware or independent components since others depends on your interfaces / structures.
All this is pure software design. This is a question which the developers of Unity have to worry about for their next version to keep the changes to the old interfaces small.
Your example "enum vs list" is like "a glass of milk vs a sheet of paper". Those are two completely different data types and have actually nothing in common.
Again, enums can only cause problems when you have different code parts (old and new) which both use the same enum but different implementations of it. A Unity game is usually compiled as a whole project, so everything you've created is part of the project. When you cange something the whole application is affected. Hopefully i don't have to mention that if you "shoot yourself in the foot" it's 100% your fault ;)
The only problem in a Unity game i can think of is a savegame-file. However whenever you design such a file format you should always include a version number right at the beginning and test for it when you load it.
Enums are actually a good way to avoid problems when you update / change something. Since everywhere you use the symbolic name it's asured that at all places the same value is used. However, independent from if you have external dependencies on the underlying value or not, it's always a good advice to add new values at the end of an enum.
Thanks for the response. Sounds like there is nothing to be concerned about...as I am just an indie developer and all code will be maintained by me. It sounds like versioning comes into play if you have multiple people working on the project and a change is made to the flow of things (one part affects the other.) As my code is stand alone...this doesn't really apply. I was concerned about unknown stuff on the compile side like - if there was anything special I needed to do to flag updated code as changed (so that it would run right on a next iOS version of the game.) Again sounds like a non-issue as per your explanation...this would be more of an in house issue...but if the game works in the project and I export it I'm good to go.
Yes my main question I suppose was...what does versioning mean to a Unity indie developer. And that is answered. I did not fully understand if a game update reinstalls everything, or if it try's to just install the changes and if certain things could be missed. I can see now that a project is project, if it works the update will work.
As for my enum vs list...I was referring to enum.ElementAt(i); and the accessibility of the data. I agree that a list is huge compared to an Enum...and in discovering this I decided to use an Enum ins$$anonymous$$d of a list or an array (what I used in my flash as3 days) as the enum would be the fastest and still accomplish what I need. Obviously there was no point in even considering a list/array if all I needed was a enum. I'm still learning etc, etc.
Thank you also for the bonus tips on enum's (placing new data at the end) and save game files.
An "update" is a full replace of your game. However since your game have to be registrated by the AppStore (or google Play store), once the app has been published, each update must increase the version number in the build settings or Apple / google will refuse the new build.
Each app needs a unique identifier "com.yourcompany.yourproduct". This identifier deter$$anonymous$$es if it's the same app. When you want to replace / Update an already published app, you have to increase the version number(s)
Your answer
Follow this Question
Related Questions
getting udp package info inside unity (GlovePIE) 0 Answers
Android - User only update certain file, not the whole .apk 1 Answer
Moving Things Like Amnesia 1 Answer
Create a flashlight 2 Answers
Parallax scrolling 1 Answer