I am trying to open a project in Unity but it is very slow and it says it is "baking resources". How can I make it faster?
Depends what do you want to achieve.
If the building while doing changes is problematic go to "Window/Ligthing/Scene" and turn the Bake build auto OFF.
If you are making the finall product you may turn the quality of the shadows and light maping down for less details better performance and building time.
"Window/Ligthing/Scene"
1 Turn off "Precomputed Realtime GI" or turn it down to 1.
2 Play with "Baked GI" Resolution.
3 Window/Ligthing/Object select the biggest complexed objects (like terrain) and set the "Scale In lightmap' down a little
4 If you have a lot of static complex items like trees turn the "static" off. A static forrest could build in to 1GB map or a nonstatic one in to 100MB :)
Its always something in exchange, performance/quality/building time/memory...
Related
Recently I joined project with low quality codebase and I want to set analyzer to strong-mode and set a bunch of strict linter rules. But when I did that, I get more than 3K errors.
I can't rewrite all codebase at once.
Is there is a way to set new strict analyzer options only for new code and code that was edited?
Maybe something like second analyzer_options_strict.yaml file with applyOnlyTo/exclude: [filenames] option.
How to migrate all codebase to strict mode gradually in the right way?
If you are picking an old project that is a monolith, a nice first step is to divide into multiple packages, that way you can fine each one part by part and evolve the analyzer in a step by step way
In NatTable version 2 an autoscale was added while the tables are being created, supported by default DPI converters: DefaultHorizontalDpiConverter, DefaultVerticalDpiConverter. In version 1 everything under 96 DPI was not scaled down, however, now in version 2 for lower DPIs NatTables are scaled down hence images look ugly, fonts are ok:
72dpi - not ok:
96dpi - ok:
What would be the simplest way to prevent default scaling under 96 DPI?
The feature that was added with NatTable 2.0 is a complete dynamic scaling and the full support for all DPI. The following blog post should give some more details NatTable – dynamic scaling enhancements
Actually I wonder what is "ugly" with lower DPIs. At least on modern displays it should not be an issue. The only thing I could think of are the images. But typically downscaling doesn't make images ugly. So it would be really interesting to know what the issue is.
You have two options to handle that:
As you can scale NatTable dynamically at runtime, you can simply execute the ConfigureScalingCommand to force the scaling you want. Note that this needs to be done AFTER NatTable#configure().
if (Display.getDefault().getDPI().x < 96) {
natTable.doCommand(
new ConfigureScalingCommand(new FixedScalingDpiConverter(96)));
}
If you even want to block lower scalings on the dynamic scaling, you can implement a custom ConfigureScalingCommandHandler that checks for the dpiFactor in the IDpiConverter and if that is lower than 1 register a FixedScalingDpiConverter on the SizeConfigs. That custom ConfigureScalingCommandHandlerthen needs to be registered on the DataLayer to replace the default.
The second approach is probably a bit more complicated and needs a better understanding of NatTable internals. And it blocks the dynamic scaling feature to really zoom out on huge tables. So it depends on your use cases which approach to use. Typically the first option should be sufficient.
BTW, if the images are the issue, changing the scaling at runtime without re-registering the images could also cause a rendering issue. The reason for this is that images are stored in the ImageRegistry and they need to be updated there in case of scaling changes. For approach 1. that means to register all images in the ConfigRegistry again after the ConfigureScalingCommand. At least if you are not using themes or CSS styling.
I'm new to AnyLogic and trying to figure out how Agent-based models should be set there. There is a famous Epidemic model, which I'm trying to reproduce. Most tutorials on classical ABM deal with old GUI settings.
For example, in version 8.5+, which is actual now, the Environment object (that was used for positioning of layouts) has been deprecated.
Now I see that new object Canvas is used to put the layout with agents on the page. But the structure of source code file is a bit unclear for me and I've failed to find relevant description how Canvas can be set for the purpose. (Besides I'm not sure that this is recommended way of doing this task.)
Question: I would love to learn the right way to arbitrary position the area with agents on the page. Below you may see what I get by default.
After some playing around, the 'minimalistic' functionality is as follows.
One should create some population with arbitrary name Person (population name people adds automatically).
The following structure of the Project is to be reproduced (arbitrary names are marked with yellow).
Comment: after adding a Canvas called mapCanvas one adds the function setCanvasCellColor with following body:
mapCanvas.fillCircle(person.getX(), person.getY(), 3, color);
It is clear that former two arguments stand for coordinates of a given point, then its size (i.e. 3) and color. Do not forget to add two arguments used in the body, namely, person as Person and color as Color.
From Entry Action of the statechart named state call the just made function. I've put black color here just for the sake of demonstration; chartreuse constant gets used instead in the Epidemic example.
main.setCanvasCellColor(this, black);
Finally, you may run the model to get the following picture.
Note
If one is reluctant to bother with Canvas, use Main - Presentation - xxx_presentation and click Draw agent with offset to this position checkbox.
I have this lamp object. And i marked with a red circle the part i want to cut and make as a different object. Only the yellow part i want to make it object. So i can later use it in the game is object and also as item.
This is the lamp inspector:
Create a prefab of the lamp object and export it as a unity package.
You can then import it in other project as Custom package.
Source : https://docs.unity3d.com/Manual/HOWTO-exportpackage.html
Depending on the type of the model u have (obj, fbx etc) u need to go to 3d Modelling software like Blender or Max to modify the model. There u would be able to do any change to model u would like to including diving in too and maybe changing of shapes! Once done u can import them back into unity and have two different objects!
Taking the model into max as suggested would be the right idea. You'll likely take it in as an FBX.
Once you seperate the lamp from the post you may want to affect it's pivot.
For MAX look here
Be careful when exporting out the fbx again. I have noted that it seems to be best to export the model back out in metres. Automatic unit conversion may give unwanted results.
I want to write my own editor that would allow me to search the whole Assets folder for object type of X and make an AssetBundle from them.
I went through all the manuals and docs and it seems that they all use the Selection class to build the Assets Bundle.
But what if there are 10 000+ objects scattered in different folders and I don't want to select each manually, yet I still want to track their dependencies. Is there a way to do so?
I have already tried editing Selection.objects, but as much as I understand it's limited to one concrete scene.
Is it possible to skip the whole Selection class and just use BuildPipeline.BuildAssetBundle() method? If yes, how to get the correct list of objects that can be used? Do I need to write my own deep threading loop to get the dependencies?
All you need is a list of objects. That's it. How you get them is irrelevant. You can do that with the Selection class, but if you have other means of finding the assets, that's no problem either.
As for dependencies, keep in mind that your final call will be something like:
BuildPipeline.BuildAssetBundle(main_asset, objects_array, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets);
See that BuildAssetBundleOptions.CollectDependencies? It will make sure that all the necessary dependencies for the objects you've specified get included as well.