// transmission.log

Data Feed

> Intercepted signals from across the network — tech, engineering, and dispatches from the void.

1688 transmissions indexed — page 85 of 85

[ 2013 ]

4 entries
1681|blog.unity.com

Occlusion culling in Unity 4.3: The basics

The following blog post was written by Jasin Bushnaief of Umbra Software to explain the updates to occlusion culling in Unity Pro 4.3.Unity 4.3 includes a plethora of improvements. One of the completely re-implemented subsystems is occlusion culling. Not only has the interface been simplified and the culling runtime itself revamped, a number of new features have also been added.In this series of three posts, I’m going to go over how the new occlusion culling system works in Unity 4.3. This first post goes through the basics of how occlusion culling is done and what the basic usage is like with the user interface. The second post focuses on best practices to get the most out of occlusion culling. The third and final post focuses on some common problem scenarios and how to resolve them.But let’s start with some basics. Occlusion culling refers to eliminating all objects that are hidden behind other objects. This means that resources will not be wasted on hidden stuff, resulting in faster and better-looking games. In Unity, occlusion culling is performed by a middleware component called Umbra, developed by Umbra Software. The UI, from which Umbra is controlled in Unity, can be found in Window -> Occlusion Culling, under the Bake tab.Umbra’s occlusion culling process can be roughly divided into two distinct stages. In the editor, Umbra processes the game scene so that visibility queries can be performed in the game runtime, in the player. So first, Umbra needs to take the game scene as its input and bake it into a lightweight data structure. During the bake, Umbra first voxelizes the scene, then groups the voxels into cells and combines these cells with portals. This data, in addition to a few other important bits is referred to as occlusion data in Unity.In the runtime, Umbra then performs software portal rasterization into a depth buffer, against which object visibility can be tested. In practice, Unity gives Umbra a camera position, and Umbra gives back a list of visible objects. The visibility queries are always conservative, which means that false negatives are never returned. On the other hand, some objects may be deemed visible by Umbra even though in reality they appear not to be.It’s important to realize that, while this system appears similar to what was shipped with previous Unity versions, the entire system has been basically rewritten. A lot has changed for the better, both internally and externally!How to Use Umbra There are obviously a few considerations in getting the best out of occlusion culling. Ideally, you’d want the least conservative result as fast as possible. There are, however, tradeoffs involved. The more accurate (i.e. the least conservative) results you want, the higher-resolution data you need to generate. However, higher-resolution data is slower to traverse in the runtime, yielding slower occlusion culling. If occlusion culling requires more frame time than it saves by culling, it obviously doesn’t make a whole lot of sense. On the other hand, very quick culling isn’t of much help if only a few objects are culled. So it’s a balancing act.The way Umbra lets you control this balance is by having you define a couple of bake parameters. The parameters determine what type of input the bake process should expect and what type of data is generated. In the runtime, using Umbra is as simple as it gets. If you’ve baked occlusion data and the camera has occlusion culling enabled in the Inspector, Unity will use Umbra automatically.Smallest Hole The input is controlled using the smallest hole parameter. When voxelizing the occluder geometry, smallest hole maps almost directly to the voxel size. This means that if your geometry contains intentional holes, gaps or cracks that you wish to see through, using a smallest hole smaller than these is a good idea. On the other hand, a lot of the time the geometry contains lots of unintentional cracks that you do not wish to see through. A reasonable voxel resolution will patch these up. It may help to think about smallest hole as the “input resolution” of the bake.Note that setting smallest hole into a ridiculously small value means that baking will be unacceptably slow and/or take up a monumental amount of memory in the editor. In some rare cases, it may even cause the bake to fail due to insufficient memory. Then again, while using a larger value will be faster and more memory-friendly, it may cause Umbra to not see through things like grates or fences. So bigger isn’t always better either. In general, a smallest hole as large as possible without visible errors is desirable. In practice, we’ve found that values between 5 cm to 50 cm work fairly well for most games where the scale is “human-like”. The default value in Unity is 25 cm, and it’s a good starting point.Smallest Occluder While smallest hole mostly deals with what type of input geometry you have, smallest occluder determines what kind of output data is produced. In essence, you can think about smallest occluder as the output resolution of the data. The larger the value, the faster it is to perform occlusion culling in the runtime, but at the cost of increased conservativity (false positives). The smaller the value, the more accurate results are generated, but at the cost of more CPU time. Obviously higher-resolution data will mean a larger occlusion data size as well.So as the name implies, a small value means that very fine features are captured in the occlusion data. Under the hood, this directly maps to how large cells Umbra creates. Lots of small cells mean lots of small portals between them, and naturally it’s more expensive to rasterize a large amount of small portals than vice versa. The effects of changing smallest occluder can be seen in the picture below. Note how the depth buffer, which is essentially what Umbra sees, loses detail as smallest occluder increases.In most games, keeping smallest occluder slightly larger than the player, so around a few meters, is a good default. So anywhere between 2 and 6 meters may make sense if your game’s scale isn’t microscopic or galactic. The default value in Unity is 5 meters.Backface threshold Perhaps the most difficult parameter to grasp is called backface threshold. While in many cases you don’t really need to change it, there are some situations in which it may come in handy to understand how it affects the generated data.First, it’s important to note that the parameter exists only for a single purpose: occlusion data size optimization. This means that if your occlusion data size is OK, you should probably just disregard backface threshold altogether. Second, the value is interpreted as a percentage, so a value of 90 means 90% and so on.OK so what does backface threshold actually do then? Well, imagine a typical scene that consists mostly of solid objects. Furthermore, there may be a terrain mesh whose normal points upwards. Given such a scene, where do you want your camera to be? Well, certainly not underneath the terrain, that’s for sure. Also, you probably don’t want your camera to be inside solid objects either. (Your collision detection normally takes care of that.) These invalid locations are also ones from which you tend to “see” mostly back-facing triangles (although they may of course get backface-culled). So in many cases it’s safe to assume that any location in the scene, from which the camera sees a lot of back-facing triangles, is an “invalid” one, meaning that the in-game camera will never end up in those locations.The backface threshold parameter helps you take advantage of this fact. By defining a limit of how much back-facing geometry can be seen from any valid camera location, Umbra is able to strip away all locations from the data that exceed this threshold. How this works in practice is that Umbra will simply do random-sampling in all cells (see the previous post) by shooting out rays, then see how many of those rays hit back-facing triangles. If the threshold is exceeded, the cell can be dropped from the data. It’s important to note that only occluders contribute to the backface test, and the facing of occludees doesn’t bear any relevance to it. A value of 100 disables the backface test altogether.So, if you define the backface threshold as 70, for instance, to Umbra this means that all locations in the scene, from which over 70% of the visible occluder geometry doesn’t face the camera, can be stripped away from the occlusion data, because the camera will never end up there in reality. There’s naturally no need to be able to perform occlusion culling correctly from underneath the terrain, for instance, as the camera won’t be there anyway. In some cases, this may yield pretty significant savings in data size.It’s important to stress that stripping away these locations from the occlusion data means that occlusion culling is undefined in these locations. “Undefined”, in this context, means that the results may be correct, incorrect (pretty much random) or return an error. In the case of an error, all objects are simply frustum culled.Of course in some cases, there just happens to be some amount of back-facing geometry in valid camera locations too. There may be a one-sided mesh that has been, possibly erroneously, tagged as an occluder. If it’s a large one, it may cause the backface test trigger in nearby areas, resulting in culling artifacts (=errors). This is why the default value of backface threshold in Unity is 100, meaning the feature is disabled by default.Feel free to experiment with the parameter. Try reducing the value to 90, which should drop a lot of data underneath terrains for example. See how it has any noticeable effect on the occlusion data size. You can go even lower if you want. Just remember to do so at your own risk. If you start popping into rendering artifacts, increase the value back to 100 and see if it fixes the problems.To be continued… In the next post, I’ll go into some best practices and recommendations for how to get optimal results out of occlusion culling. Please visit www.umbrasoftware.com for more information about Umbra.Part II Part III

>access_file_
1682|blog.unity.com

Come Learn with Learn

So you’ve decided to download and check out this newfangled “Unity” thing. You open it up, create a project, and are presented with the Unity editor. At this point you’re probably thinking to yourself, “OK, now what?” That’s where we come in. We are the Unity Learn team and our goal in this crazy, hectic world is to labor tirelessly to bring you the best content to learn from and utilize in your games. Of course, now you are probably thinking to yourself, “That’s an interesting claim, faceless-internet-article-writing-man, but certainly your content can’t help me. I make special games!” Nay, I say to you. Our content can help anyone learn to use Unity to make all kinds of games. Just look at what we have to offer (the Learn portion of Unity’s website can be found at Unity3d.com/Learn).You like tutorials. We get that. That’s why we’ve made a bazillion of them and we keep adding more. We get that you’re too busy to read all sorts of words. That’s why our tutorials are video tutorials in stunning high definition! You never have to guess where an option is or what a button looks like. Just grab a bowl of popcorn and your favorite caffeinated beverage, queue up our videos, and follow along. You’ll be a pro in no time (warning: watching videos actually takes some time due to them not existing inside a black hole)!Come check our newest initiative: Live Training! That’s correct, come hang out with a real person as we teach concepts and answer questions in real time! Right now you’re thinking, “Blargpfpfpf” (that’s the sound of your brain exploding). Not only do we deliver content live, we actually really enjoy it! Come check out what we have scheduled. You can also watch past sessions to see just what you’re getting yourself into. We look forward to seeing you there. I mean you specifically, John (your name is probably not John, but if it is, I just blew your mind).Perhaps you’re the type of person that prefers to drudge through tons of documentation. Never fear, we have that too. Chances are most of your questions and curiosities can be resolved simply by flipping through the posted articles and examples. So feel free to dive right in. There’s nothing wrong with being a lone wolf. We won’t tell anyone.It can be very frustrating when you have a specific question that no resources seem to address directly. Luckily, Unity has a fantastic community. While not directly controlled by the Learn team, it’s still on our page and so it will be mentioned here (and there’s nothing you can do about it). Stop and in say “Hi” to fellow Unity users in the forums. Also, swing by the Unity Answers section to ask specific questions and get an amazing level of help! We’re all in this together!The Unity Learn team is a giant collection of superhuman awesome-sauce. We are here to provide you with content and to lower the barrier to entry into game development. We recognise that you would rather make games than learn to make games, so let us expedite the process for you. Swing by our live sessions or check out our pre-recorded videos to start learning.Got questions, comments, suggestions, snide remarks, or personal anecdotes? Hit us up on twitter:@Unity3D@mikegeig (That’s me!)@willgoldstone (He’s like a British Ryan Gosling)@theantranch (a.k.a Little Angel)@robotduck (He is an actual duck... no kidding)@rodulator (Scottish and angry, best leave him alone)Now go and make games. We expect to see progress!

>access_file_
1683|blog.unity.com

From camping in the classroom, to a real game dev studio

Kenneth and I wanted to found a start-up studio with a team of around 10 people. We wanted to make big, ambitious games. Kenneth dedicated himself to becoming a badass programmer; I focused on becoming a design and business guru. I spent months planning a team structure, what kind of people we needed and what they would do. I also wrote a game bible for our game, which was always changing, but it allowed us to have a detailed fundament. Now, we just needed to find the rest of the team.Then we set out to get exactly who we wantedWe were teacher assistants at the time, so we knew who the brightest and best were in our classes. We had to get the right people interested in our idea. We had to motivate them to work hard without an immediate pay-off. We invited some exceptional students to an exclusive meeting. We told them we had chosen them to join our special project, based on their awesome dedication and skill. We shared our vision of making games with them. And we told them that we couldn’t pay them. At the end of that first meeting we already had a team of 9 and it was time to start developing our game.Kenneth and I wanted to found a start-up studio with a team of around 10 people. We wanted to make big, ambitious games. Kenneth dedicated himself to becoming a badass programmer; I focused on becoming a design and business guru. I spent months planning a team structure, what kind of people we needed and what they would do. I also wrote a game bible for our game, which was always changing, but it allowed us to have a detailed fundament. Now, we just needed to find the rest of the team.We were teacher assistants at the time, so we knew who the brightest and best were in our classes. We had to get the right people interested in our idea. We had to motivate them to work hard without an immediate pay-off. We invited some exceptional students to an exclusive meeting. We told them we had chosen them to join our special project, based on their awesome dedication and skill. We shared our vision of making games with them. And we told them that we couldn’t pay them. At the end of that first meeting we already had a team of 9 and it was time to start developing our game.Half a year passed and we realized that being nine noobs on our virgin game journey equalled an extreme challenge. We underestimated the work it would take to establish a proper pipeline to create a beautiful 3D game. And, getting 9 people to work efficiently without bottlenecks was, and is, a challenge.We realized that to get this done we had to focus exclusively on our work.Dedicating ourselves full-time to game development without a salary required us to skip classes. We also started to camp out in an empty classroom during the summer vacation. By some miracle no one discovered our “camp”. So we stayed, for seven months. Some of us actually moved out of our apartment to take up residence at the University. We had a gym, baths and a kitchen in the teacher’s room—everything we needed.Then one morning, a teacher randomly walked in and saw 8 guys brushing their teeth in their underwear. We were kicked out of course, but those seven months of living together had turned us into a team. We proved to each other, and ourselves, how committed we were to making our game.After getting kicked out of the university, we decided that the whole team would move in together and share the rent. We Googled the cheapest place to live in Denmark, and a few weeks later we were living in a massive house with 3 floors, far away from our families and friends.It felt so awesome to finally have our own place without worrying about being kicked out. We lived and worked together in the house for a year. In that time we changed, from a group of friends, to a team of professionals. At one point we were 16 people living together, which resulted in unforeseen problems. Like the massive amounts of garbage (we ate a lot of frozen pizzas that year) to the arguments about cleaning up that we often took in our team meetings. But we managed it pretty well. We all wanted the same thing, to release our game.How did we manage to get so far on so little money? First, we didn’t get paid for our work. We’ve reached the point of (almost) finalizing our game with the help of 30 developers who have received no salary. Second, we had a couple of key breakthroughs with funding. We got a much-needed cash infusion when the Danish Film Institute gave us almost $40,000. We used that money on team transportation, the rent for our house, hardware, software and conferences.We also launched a Kickstarter project in October 2012. With only one week to go we still lacked 35% of the funds. We put out a photo album that told the story I’m telling here. It gave our project the emotional punch we needed to get more backers, and just 8 hours after posting the album we surpassed our funding goal.Currently we are in a new office in Copenhagen. We now have 10 full-time developers and one part-timer. There are new hurdles to jump, such as how to get on Steam. There are also new rewards, like winning for Best Danish Game Developer 2013.In my opinion being an indie studio can be just like being a professional football team; it’s full of financial uncertainty yet requires boundless dedication and a love for what you do. Realize that, and start failing so you can start winning.Video: A chat with Steffen Kabbelgaard at Unite Nordic 2013Our story continues at https://forcedthegame.com/story/

>access_file_
1684|blog.unity.com

Learn Unity update no. 3: Phase 1 and lab testing

Here at Unity, since last August we've been pushing ahead with our plan to create a totally new learning area on the site, and as a larger concept - a new focus on the web for people young and old who are new to game development, and want to get started. Naturally we want to serve our existing users too, and as this new area develops, we hope there will be something for everyone to inspire fresh ideas, and ultimately, awesome games and interactive content.If you've missed the previous updates on this project, I recommend you read up on where we've come from so far in these previous blog posts -https://blog.unity.com/community/learn-unity-coming-soonhttps://blog.unity.com/community/learn-unity-update-1https://blog.unity.com/community/learn-unity-update-2At this stage, we're still on target to launch the first iteration of the project in late March, and you'll see a lot of beginner content arrive around then. We'll also be bringing this content to GDC to chat to anyone who wants to stop by the Unity booth and talk about game development.As stated previously, we don't want to wait until everything is recorded to get you started using this new learning area, so we plan to ship phase one with a lot of the basics of game development in Unity available for beginners to get started. Then over time we'll be adding more content, covering more topics, and making good on our promise of democratizing game development, by giving you as much knowledge on the topic as we possibly can. In the first phase we plan to ship -The Robot Lab environmentBeginner Scripting lessonsBeginner EditorBeginner Physics LessonsBeginner Graphics LessonsBeginner Audio LessonsBeginner Physics Assignments'Stealth' - a larger game level tutorialAt the time of writing, we have our first tutorial environment ready to ship - The Robot Lab, with all manner of crazy props from a giant robot arm, to a sci fi battering ram! This has taken time as we are producing the level to the highest standards of detail, to try and inspire you to experiment, learn and have fun with these assets. We'll be using this environment to deliver the bulk of the learning content that you'll see in phase one, aside from the larger level project 'Stealth'.To make sure this environment is up to your standards, today we're pushing this project to the Asset Store to let you get your hands on it, and let you start experimenting with the props we've created. As a former tutor I know how valuable it can be to have cool assets to inspire your students so I wanted to get this content out to you as soon as we were happy with it.We'd also like feedback on any bugs you find so please write a comment on this post or email me directly on will [at] unity3d dot com during this testing period. We'll be adding more scripts, a few collision meshes and more sound effects but for now our only known bug is a lightmapping issue when opening on mac. So what are you waiting for? grab the project now and have a play with the lab!In terms of video tutorial content, we have our Beginner Editor, Physics and Scripting Lessons produced and on our staging site which is also currently mid-production. The Stealth game is our first larger 'Project' (as opposed to Lesson or Assignment, our smaller pieces of content), and is currently being pieced together by the team, ready to be recorded as video steps in the coming weeks. The game level is designed to teach you how to put together a game level in Unity, comprising a metal gear solid style 'sneak em up' with security cameras, guards, keycards and a battle bus! This project will help you learn about Character animation for player and enemies, Raycasting, Collision, Game logic and various other tips and tricks! We'll have more to show of this soon, but for now here's a sneaky peek at our main character.We are also continuing to prototype other ways of teaching game development with Unity, and we'll have more news on a piece of new tech we're developing with schools in mind, towards Q2 of this year.For now, if you are a teacher at any level, we'd like to hear from you, and get your feedback on how we can better support you - drop me a line on will [at] unity3d dot com and we'll add you to our database of tutors we're compiling.

>access_file_

[ 2012 ]

3 entries
1685|blog.unity.com

Learn Unity update no. 2

Here at Unity we've been working hard on an entirely new area of the website to help you learn game development with Unity. We've posted twice so far about this, and given you an outline of how the system is going to work. Take a look at our first two posts if you're unfamiliar with what we're working on -https://blog.unity.com/community/learn-unity-coming-soonhttps://blog.unity.com/community/learn-unity-update-1So hopefully you know that we're working on a Retro-futuristic sci-fi game world, in which we'll base all of our tutorials. To flesh this out, I wanted to share some of the concepts of the world, to get you excited about the environments and learning content we have planned.The tutorials are set on the island research facility of Unity Labs. This top secret place is where our experts create simulations of game development, so that we can make Unity the best game development tool in the world! Let's take a look at some of what you'll encounter at Unity labs (we don't want to give everything away right now..) -This is where it all begins. This little slice of paradise hides all of Unity Labs' dark secrets!This is where our engineers play with physics experiments and create gameplay! We plan to make this environment available as part of the launch plan.One of our chief scientists, Astrella is one of several characters you'll encounter in the Unity Labs world..Part of our physics assignment experiments, the battering ram & blast doors help us test physics joints at Unity labs.Currently we're creating plenty of content to flesh out the learning area - all based in the world of Unity labs. We plan to launch our first iteration of the system in March. It will feature one large tutorial project, and two to three of our topic areas with many small lessons and assignments to help you learn Unity, or if you are a tutor - to support you teaching your classes.We hope to bring you another update in a few weeks time with a preview of what we've done, but rest assured that this project is something we're taking our time over as we plan to deliver only the best quality content both in terms of visual AAA fidelity, and in video / training content production. We hope you're as excited about it as we are!

>access_file_
1686|blog.unity.com

Unity Serialization

So you are writing a really cool editor extension in Unity and things seem to be going really well. You get your data structures all sorted out are really happy with how the tool you have written works.Then you enter and exit play mode.Suddenly all the data you had entered is gone and your tool is reset to the default, just initialized state. It’s very frustrating! “Why does this happen?” you ask yourself. The reason has to do with how the managed (mono) layer of Unity works. Once you understand it, then things get much easier :)What happens when an assembly is reloaded? When you enter / exit play mode or change a script Unity has to reload the mono assemblies, that is the dll's associated with Unity.On the user side this is a 3 step process:Pull all the serializable data out of managed land, creating an internal representation of the data on the C++ side of Unity.Destroy all memory / information associated with the managed side of Unity, and reload the assemblies.Reserialize the data that was saved in C++ back into managed land.What this means is that for your data structures / information to survive an assembly reload you need to ensure that it can get serialized into and out of c++ memory properly. Doing this also means that (with some minor modifications) you can save this data structure to an asset file and reload it at a later date.How do I work with Unity's serialization? The easiest way to learn about Unity serialization is by working through an example. We are going to start with a simple editor window, it contains a reference to a class which we want to make survive an assembly reload.When you run this and force an assembly reload you will notice that any value in the window you have changed will not survive. This is because when the assembly is reloaded the reference to the ‘m_SerialziedThing’ is gone. It is not marked up to be serialized.There are a few things that need to be done to make this serialization work properly: In MyWindow.cs:The field ‘m_SerializedThing’ needs to have the attribute [SerializeField] added to it. What this tells Unity is that it should attempt to serialize this field on assembly reload or similar events.In SerializeMe.cs:The class ‘SerializeMe’ needs to have the [Serializable] attribute added to it. This tells Unity that the class is serializable.The struct ‘NestedStruct’ needs to have the [Serializable] attribute added to it.Each (non public) field that you want to be serialized needs to have the [SerializeField] attribute added to it.After adding these flags open the window and modify the fields. You will notice that after an assembly reload that the fields retain their values; that is apart from the field that came from the struct. This brings up the first important point, structs are not very well supported for serialization. Changing ‘NestedStruct’ from a struct to a class fixes this issue.The code now looks like this:Some Serialization RulesAvoid structsClasses you want to be serializable need to be marked with [Serializable]Public fields are serialized (so long as they reference a [Serializable] class)Private fields are serialized under some circumstances (editor).Mark private fields as [SerializeField] if you wish them to be serialized.[NonSerialized] exists for fields that you do not want to serialize.Scriptable Objects So far we have looked at using normal classes when it comes to serialization. Unfortunately using plain classes has some issues when it comes to serialization in Unity. Lets take a look at an example.This is a contrived example to show a very specific corner case of the Unity serialization system that can catch you if you are not careful. You will notice that we have two fields of type NestedClass. The first time the window is drawn it will show both the fields, and as m_Class1 and m_Class2 point to the same reference, modifying one will modify the other.Now try reloading the assembly by entering and exiting play mode... The references have been decoupled. This is due to how serialization works when you mark a class as simply [Serializable]When you are serializing standard classes Unity walks through the fields of the class and serializes each one individually, even if the reference is shared between multiple fields. This means that you could have the same object serialized multiple times, and on deserialization the system will not know they are really the same object. If you are designing a complex system this is a frustrating limitation because it means that complex interactions between classes can not be captured properly.Enter ScriptableObjects! ScriptableObjects are a type of class that correctly serializes as references, so that they only get serialized once. This allows complex class interactions to be stored in a way that you would expect. Internally in Unity ScriptableObjects and MonoBehaviours are the same; in userland code you can have a ScriptableObject that is not attached to a GameObject; this is different to how MonoBehaviour works. They are great for general data structure serialization.Let’s modify the example to be able to handle serialization properly:The three changes of note here are that:NestedClass is now a ScriptableObject.We create an instance using the CreateInstance function instead of calling the constructor.We also set the hide flags... this will be explained laterThese simple changes mean that the instance of the NestedClass will only be serialized once, with each of the references to the class pointing to the same one.ScriptableObject Initialization So now we know that for complex data structures where external referencing is needed it is a good idea to use ScriptableObjects. But what is the correct way to work with ScriptableObjects from user code? The first thing to examine is HOW scriptable objects are initialized, especially from the Unity serialization system.The constructor is called on the ScriptableObject.Data is serialized into the object from the c++ side of unity (if such data exists).OnEnable() is called on the ScriptableObject.Working with this knowledge there are some things that we can say:Doing initialization in the constructor isn’t a very good idea as data will potentially be overridden by the serialization system.Serialization happens AFTER construction, so we should do our configuration stuff after serialization.OnEnable() seems like the best candidate for initialization.Lets make some changes to the ‘SerializeMe’ class so that it is a ScriptableObject. This will allow us to see the correct initialization pattern for ScriptableObjects.On the surface it seems that we have not really changed this class much, it now inherits from ScriptableObject and instead of using a constructor has an OnEnable(). The important part to take note of is slightly more subtle... OnEnable() is called AFTER serialization; because of this we can see if the [SerializedFields] are null or not. If they are null it indicates that this is the first initialization, and we need to construct the instances. If they are not null then they have been loaded into memory, and do NOT need to be constructed. It is common in OnEnable() to also call a custom Initialization function to configure any private / non serialized fields on the object, much like you would do in a constructor.HideFlags In the examples using ScriptableObjects you will notice that we are setting the ‘hideFlags’ on the object to HideFlags.HideAndDontSave. This is a special setup that is required when writing custom data structures that have no root in the scene. This is to get around how scene loading works in Unity.When a scene is loaded internally unity calls Resources.UnloadUnusedAssets. If nothing is referencing an asset the garbage collector will find it. The GC uses the scene as ‘the root’ and traverses the hierarchy to see what can get GC’d. Setting the HideAndDontSave flag on a ScriptableObject tells Unity to consider that object as a root object. Because of this it will not just disappear because of an assembly reload. The object can still be destroyed by calling Destroy().Some ScriptableObject RulesScriptableObjects will only be serialized once, allowing you to use references properly.Use OnEnable to initialize ScriptableObjects.Don’t ever call the constructor of a ScriptableObject, use CreatInstance insteadFor nested data structures that are only referenced once don’t use ScriptableObject as they have more overhead.If your scriptable object is not rooted in the scene set the hideFlags to HideAndDontSave.Concrete Array Serialization Lets have a look at a simple example that serializes a range of concrete classes.This basic example has a list of BaseClasses, by clicking the ‘Add Simple’ button it creates an instance and adds it to the list. Due to the SerializeMe class being configured properly for serialization (as discussed before) it ‘just works’. Unity sees that the List is marked for serialization and serializes each of the List elements.General Array Serialization Lets modify the example to serialize a list that contains members of a base class and child class:The example has been extended so that there is now a ChildClass, but we are serializing using the BaseClass. If you create a few instance of the ChildClass and the BaseClass they will render properly. Issues arise when they are placed through an assembly reload. After the reload completes every instance will be a BaseClass, with all the ChildClass information stripped. The instances are being sheared by the serialization system.The way to work around this limitation of the serialization system is to once again use ScriptableObjects:After running this, changing some values, and reloading assemblies you will notice that ScriptableObjects are safe to use in arrays even if you are serializing derived types. The reason is that when you serialize a standard [Serializable] class it is serialized ‘in place’, but a ScriptableObject is serialized externally and the reference inserted into the collection. The shearing occurs because the type can not be properly be serialized as the serialization system thinks it is of the base type.Serializing Abstract Classes So now we have seen that it’s possible to serialize a general list (so long as the members are of type ScriptableObject). Lets see how abstract classes behave:This code much like the previous example works. But it IS dangerous. Lets see why.The function CreateInstance() expects a type that inherits from ScriptableObject, the class ‘MyBaseClass’ does in fact inherit from ScriptableObject. This means that it’s possible to add an instance of the abstract class MyBaseClass to the m_Instances array. If you do this and then try and access an abstract method bad things will happen because there is no implementation of that function. In this specific case that would be the OnGUI method.Using abstract classes as the serialized type for lists and fields DOES work, so long as they inherit from ScriptableObject, but it is not a recommended practice. Personally I think it’s better to use concrete classes with empty virtual methods. This ensures that things will not go bad for you.When do ScriptableObjects get persisted into scene / prefab files? GameObjects and their components are saved into a scene by default. Asset types (Materials / Meshes / AnimationClip / SerializedObject's) that are created from code are saved in the scene so long as a game object or their components in the scene references it.Asset types can also be explicitly marked as assets using AssetDatabase.CreateAsset. In that case they will not be saved in the scene but simply referenced. If an asset type or game object type is marked as HideAndDontSave it also not saved in the scene.Questions?

>access_file_
1687|blog.unity.com

Learn Unity coming soon.

Well its been a long time coming but we're finally working on a totally new learning section on the official Unity site. Our existing Support section is very out of date, and we made a conscious decision last year to replace it rather than try and update parts of it. With plenty of experience in education within the company, we have a great bed of talent to create learning materials for free so that you can pick up Unity not only as a migration from other systems but also as a way to learn game development from scratch.My past Unity tutorial project - https://unity3dstudent.com was an experiment I created during my time teaching BA Interactive Media Production at Bournemouth University. Since then, many people have learned Unity with that site and I'm happy to say the approach of smaller modules of content that work independently was proved valuable. We now plan to take this approach and expand upon it for the official site. This means that soon you will see a new section to replace the 'Support' area of the website, that contains an all new tutorial area, as well as the documentation and other support material.In interactive industries, many of us spend time teaching ourselves software from online resources. The games industry is no exception, and we see millions of fantastic online resources created by our community to help each other learn unity. This is one of the factors which has meant we could take time to create our own resource, safe in the knowledge that the community would help itself in the meantime - and for that we applaud you.Something that I haven't seen too much application of in interactive software training is the use of non-linear approaches. Simply put - most training materials force you to follow a pre-determined route through your learning material. This echoes the traditional classroom approach of presenting steps for students to follow and is tried and tested. However, the problem inherent in this approach is that as students we are then unable to prioritise what we wish to learn, or get directly to what we need to know, if simply using learning materials as a reference. For example - want to know how to use a trigger zone? you don't want to spend 20 minutes fast-forwarding through a long video to find that part out.For this reason, content you will see in our new learning area will take a modular approach with short videos or articles that you can dive into whenever you need, let's take a look at how this works.The learning area will be split into a hierarchy of -Levels (eg. Beginner, Intermediate, Advanced, Artist, Architect, Level Designer)Topics (eg. Graphics, Physics, Scripting, Audio, Characters, Animation)Lessons, Assignments & ProjectsLevels of content will be presented with complexity levels or Beginner, Intermediate and Advanced, but also show custom arrangements of content for Artists, or Architects for example. Eventually we hope to allow users to create their own custom level of content by picking whatever lessons they wish - this will hopefully benefit tutors teaching Unity who wish to create their own syllabus from our content. Each level will have Projects associated with it.Topics should be considered as playlists or groups of content on a particular topic, containing lessons and assignments on that topic. A single topic at a particular level should be seen as one Module of content - for example Beginner Physics.Lessons will be short videos you can watch to understand a concept - kind of like checking the Script Reference in docs works now. They will not require you to follow steps but simply explain. Assignments will take what you can learn from several modules and combine them to make a small part of a game - a mechanic or piecing together an environment for example. Finally, Projects will be the result of several Assignments, that give you the chance to make a small working demo. As you progress through incrementally complex levels of content, you'll create more detailed examples of gameplay - taking you through a variety of game development scenarios.We're also hoping to integrate this with your Unity developer network sign on - to allow you to track your progress, resume watching content etc. This may not be in the first iteration but is something we know will benefit users and be working to provide. This tracking also allows us to see what you're interested in, and provide targeted new learning content when we create it in the future.For the style of these tutorials, we wanted to develop a fairly unique and interesting style that will inspire you to learn our software. Having looked at many current art styles of games, we took a few of our own creative influences and have come up with a style that blends Retro-future art, Hi-tech, and the concept of a research resort - think Lost meets Portal, Thunderbirds, and well.. Unity! We hope you like what we're coming up with, in the meantime, there's a sneak peek at the art slice Dave has been working on at the top of this post.As you're likely aware, Unity supports C#, Javascript (aka Unityscript) and Boo (a derivative of Python, but rarely used). For this system we will support C# and Javascript - and by support I mean we'll primarily show C# in our video content but provide a Javascript conversion in the code listing beneath the video on the page. We had a take a decision on what to do in this regard, and felt that recording with both languages would slow us down - if we find that we have time to add this once we're in production later, we may change tack to having both languages recorded. Leave your thoughts in the comments!As a fan of action movies, I've always secretly wanted to utter the words 'I'm putting a team together' and fully expected this to be followed by a montage of myself and several others constructing some kind of battle tank, A-Team style. However, in the case of the team creating Unity tutorials, we've kept it a little more low key - and we've put together a small team that will be focused over the next few months on getting a set of Unity tutorial content together to help you learn- let's meet the team -Will Goldstone - Project Manager, PresenterI am Content manager at Unity, so I create the video material you see on our website, and work with our web team in marketing as they add new cool stuff to the site. I'll be presenting and recording the tutorials for this system.David Llewelyn - Technical ArtistDave joins us as artist for the project, from a background in triple-A console titles that include the Lego series of games.James Bouckley - ProgrammerJames has been with us for some time in the support department, helping thousands of users with problems in all areas of Unity development - and he also has a degree in maths and theoretical physics - cool!Emil 'AngryAnt' Johansen - Code OverlordIf you don't know Emil, you haven't used Unity for too long! but never fear, you'll get to know him. Emil is overseeing the quality of the content we produce and knows everything there is to know about Unity dev.Ethan Vosburgh - Artist extraordinaireEthan is another vet of Unity tech, and has been providing art content to demos and other projects we've given you over the past few years, if you've seen it, he's crafted it, and he is joining Emil in overseeing the quality of our content.

>access_file_

[ 2009 ]

1 entry
1688|blog.unity.com

Unity 2.5 for Mac and Windows now available!

Yes, it's true, we've done it. Yesterday we shipped Unity 2.5 which among other things finally offers support for Unity authoring on Mac OS X and Windows! From the announcement email I sent out (as company front-man):Today we are extremely happy to announce the release of Unity 2.5. For the first time Unity development is now available for use on both Mac OS X and Windows! True cross-platform development with Unity has now been realized. This has been an enormous project that has taken well over a year to complete, it's a release that we're very proud of having accomplished. What's more is that during this effort we've also nearly doubled in size as a company and so there is a lot more on the way, it's going to be an exciting year!While a key feature of this release is in fact the introduction of authoring support on Windows it's worth noting that we put a lot of work into general editor improvements that all content authors can take advantage of. What that means is that this is a significant release for both our existing users and all those potential new users waiting to try Unity for the first time. Here is the high-level overview of what you'll find in Unity 2.5:Windows editor supportAn all new tabbed, and fully customizable authoring interface3DS Max support on Windows (ala our Maya support on Mac OS X)New and improved scene navigation and object placement toolsGoogle Chrome supportand more...I don't want to repeat too much information here as we have a bunch on our site already. Check out the what's new page we have posted:What's New in Unity 2.5Both existing users and those wanting to evaluate Unity can download the latest installer from our trial download page:Trial DownloadOr you can of course just cut to the chase and buy now by visiting our online store:Buy UnityIt goes without saying that these are some exciting times for both Unity Technologies and the awesome community we have around us. And 2009 is just gettin' started!

>access_file_
< prev1...8485next >