Let's look at what rx is. Someone says it's about thinking of asynchronous operations as data flows and of rx operators as flow combining operations - join, merge, concat, transform (select/selectMany), etc. I prefer thinking that way. And yes, rx is somewhat about functional programming, it can be combined with LINQ.
четверг, 11 мая 2017 г.
воскресенье, 7 мая 2017 г.
Unity may lose frames in stacktrace: tests
I noticed that sometimes unity misses frames when crash occurs. So I decided to read code and do some tests.
суббота, 6 мая 2017 г.
What exactly does Debug.LogException in Unity
I noticed that sometimes Debug.LogException misses frames and/or adds wrong ones. So, I decided to test it. Results are below, tested in Unity 5.5.1f1.
воскресенье, 9 апреля 2017 г.
Top100 Unity errors
In my programming practice, I encountered many code construction errors. Most worse are hidden. All works, but bugfixing and extending functionality is a nightmare. I will write some which are funny or puzzling in my blog.
1. Created object shows "null" in debugger.
Suppose code:
1. Created object shows "null" in debugger.
Suppose code:
public class LocationsDB : MonoBehaviour { ... } locationsDB = new LocationsDB();Why do you think, debugger can say us, that locationsDB is "null" ?
суббота, 21 января 2017 г.
Why I prefer longer class names even when namespace guarantees no name conflict
Suppose:
namespace Tutorial {
class CarnavalEventTutorial {...}
}
I keep Tutorial at end of class because 2 reasons:
a. you may keep some field with the same name, e.g.
public CarnavalEvent CarnavalEvent { get; private set; }
And you don't get name collision here. And no collision with class name too.
b. Suppose, that you can set that Tutorial as field of Unity component in editor. Unity editor wount show you namespaces, so you'll get 2 CarnavalEvent and can't diferentiate which one is Tutorial and which is not. More ugly example:
namespace Windows
{
namespace Shop
{
public class Window : MonoBehaviour {}
}
}
So, in Unity you'll see Window component and may decide that it's basic component. While it's not.
And one more bad thing, suppose you want to include that "Window" in code:
public class EventTracker {
private List<Window> windows;
private Windows.Shop.Window shopWindow; // you need that, again, to tell reader that it is ShopWindow. And to fix compiler error.
}
So, trying to make names short you make them longer instead :)
Minuses:
The price for that is longer names. But, again, that rule don't ask to include all the names from namespace. E.g.:
namespace Game {
namespace QuestParts {
namespace Tutorial {
class CarnavalEventGameQuestPartsTutorial {...} // not needed
}
}
}
Because, usually, you wount get CarnavalEventTutorial at different levels of namespaces.
So, the rule is: CONSIDER DUBLICATING NAME FROM ENCLOSING NAMESPACE IN CLASS NAME
namespace Tutorial {
class CarnavalEventTutorial {...}
}
I keep Tutorial at end of class because 2 reasons:
a. you may keep some field with the same name, e.g.
public CarnavalEvent CarnavalEvent { get; private set; }
And you don't get name collision here. And no collision with class name too.
b. Suppose, that you can set that Tutorial as field of Unity component in editor. Unity editor wount show you namespaces, so you'll get 2 CarnavalEvent and can't diferentiate which one is Tutorial and which is not. More ugly example:
namespace Windows
{
namespace Shop
{
public class Window : MonoBehaviour {}
}
}
So, in Unity you'll see Window component and may decide that it's basic component. While it's not.
And one more bad thing, suppose you want to include that "Window" in code:
public class EventTracker {
private List<Window> windows;
private Windows.Shop.Window shopWindow; // you need that, again, to tell reader that it is ShopWindow. And to fix compiler error.
}
So, trying to make names short you make them longer instead :)
Minuses:
The price for that is longer names. But, again, that rule don't ask to include all the names from namespace. E.g.:
namespace Game {
namespace QuestParts {
namespace Tutorial {
class CarnavalEventGameQuestPartsTutorial {...} // not needed
}
}
}
Because, usually, you wount get CarnavalEventTutorial at different levels of namespaces.
So, the rule is: CONSIDER DUBLICATING NAME FROM ENCLOSING NAMESPACE IN CLASS NAME
вторник, 10 января 2017 г.
Unity's Assert loses stack frames in release: tests
All below done with BuildOptions.ForceEnableAssertions, messages logged with NSLog or Console.WriteLine to be in release build (not just debug) Unity 5.5.0f3 on iPhone
понедельник, 1 августа 2016 г.
Подписаться на:
Сообщения (Atom)