#📈-compilation-visualizer
📦 : https://github.com/needle-tools/compilation-visualizer
Hi everyone! I was just wondering if anyone knows of a way to perform a compilation with flags similar to what happens during the build step? So without UNITY_EDITOR define for example. We want to perform a build compilation test regularly and the only way we figured out to do that is to actually trigger a player build.
Sorry if this isn't the right place for this question. But if it is indeed possible, it might be cool to add into the visualiser tool aswell 🙂
Are you guys using Rider / do you know about Player projects?
Not using Rider, no. We're on VS17 still. We know player projects exist (i think they appeared in VS when we started development for consoles for some reason?), but never had a use for them or knew what they are there for.
Ah, Rider has them as well, I assume it is the same in vs(?) But they compile without UNITY_EDITOR for example so show you what will cause compiler errors once u try actually building your project
This is getting out of hands... Doesn't seem like Visual Studio is really built to handle this many projects in one solution... 😬
Yeah I don't think it will be feasible for us to keep the player projects active during development. This just makes visual studio super sluggish to work with. A few minutes of waiting when it needs to reload the projects...
I mean it wasn't super fast before with all the assembly definitions, but adding the player projects just seemed to explode the times 😦
But thanks for the suggestion! We might be able to cook something up with this so our build server can check for build compilation issues without needing to trigger a build.
Do you have experience in Rider with this many projects in a solution and a large code base? Does it perform fine still?
We have similar performance issues from time to time but it might be EAP related and for me it got better in recent releases. (Not sure how many projects exactly right now but relatively big as well)
Another idea might be using ScriptsOnlyBuilds?
For comparison about reload: last week i had many reloads around 20 sec which was very annoying. Didnt had reloads that slow this week so it was ok
Minutes is def way too slow
I see. Perhaps I'll check if Rider can handle it better. We're still undecided if we should upgrade our VS licenses anyways, so a switch to Rider wouldn't be totally out of the question if it runs much smoother.
Let me know when you tried, would be interesting to hear how it compares
And maybe <@519636239658385605> has ideas about your original question. I havent done much with the compilation pipeline in Unity so far
Yes I do, and in fact I forgot to reply on your question in the Unity Slack I assume 😅
For one, there's some internal methods you can use to kick off the compilation pipeline with specific defines
For two, and our preferred solution, is to compose projects from local packages - e.g. have art + assets in one package, have scripts in one or usually multiple other packages.
What this allows you to do is have multiple projects that have subsets of those packages, e.g. one is "art prep only", one is "code only", one is "everything together". Especially the "code only" one is interesting; it allows the devs to work on code without having to worry about hours of asset import times, and it makes build tests that check for compilation or run tests trivial - there's no (or a very limited set of) assets, thus builds are pretty fast.
It does require some rethinking and structure around what goes where but ultimately it's worth it
(and quite unrelated, but our devs are mostly on Rider by now and some projects have > 500 solution projects since we're using packages and AsmDefs pretty granular. Works fine.)
Interesting approach, though i'm having difficulties picturing this package approach working for us. I feel like too much of our code is quite reliant on assets being present to function properly, apart from maybe environment models and textures, i guess. I'd also be weary of issues cropping up in only some subsets or combination of packages? We've also started production on the new project now, so we won't be able to rework the project on such a level. Might be a good idea to keep in mind for the next one though, we do struggle with having too much stuff in the editor often.
But anyways, we'll check out the internal compilation methods, thanks for pointing that out!
Assets go also in packages for us :)
Yeah, everything is a package for us nowadays, the Assets folder is empty besides some configuration stuff. I think the current project I'm spending the most time with has 10 or so local packages. If you are strict about AsmDef usage (e.g. never use AutoRef, always use OverrideReferences) and properly specifying dependencies between your own packages, you can eliminate those combinatorial issues.
You can totally bundle assets and the code they belong to into one package, but you can also do fancy stuff like have "greybox packages" that use the same prefab interfaces as the actual "heavy art packages". All depends on scale and scope of the project of course, some of these make sense for smaller ones (package composition) others more for larger ones or multiplatform (mock packages, prefab interfaces)
We do consulting for these kinds of things, so if you're starting on a larger project that might make sense to have some scalable foundations in place or set up a company-specific registry or... - just saying 😅
As I said, we're past the point of reworking our project structure for this upcoming one, so it'll be a while before we will tackle this topic again. If you're still in the consulting business in ~2023/24, I might get back to you 😁 It certainly does sound very interesting though! Mainly from a productivity standpoint through impostor/mock packages and such. I don't think we'd have much need for scalability options since we're only targeting PC, PS5 and XSX/S, which we can most likely use the same assets for. Here's to hoping the theoretical Switch 2 doesn't come our for a while 😬
I gotta get back to this one real quick though: What is the Unity Slack? Is there a bigger community somewhere to discuss stuff like this?
I just checked again, the question sounded incredibly similar ("Is there any way to run a scripts-only build without having completed a normal build first?") but was from someone totally unrelated, my bad. I'm referring to Unity's company slack (I'm an external guest there for some topics, e.g. packages), that's not public
There's the Unity community discord but that is 99% noise. Hence we started our own here, I feel this has become a nice place to discuss professional topics 😄
Happy to open specific channels for future discussion (e.g. not bombing the poor compilation visualizer)
Oh, and also now that I checked that again here's the right call and hopefully also the right answer to your question: https://docs.unity3d.com/ScriptReference/Build.Player.PlayerBuildInterface.CompilePlayerScripts.html
But seems there's no way to run the IL2CPP compilation on top of that without triggering an actual build.
Ah ok, we're also part of the Unity Slack for some developer contacts and the spotlight team, but I was wondering if you were talking about something else.
The level of Unity knowledge and discussion in this server (and the tools you provide) are very much appreciated! On almost every open community (forum, reddit, ...), discussion usually stays pretty much on a surface level and never seems to align with the problems and questions we face on big(ger) projects.
Yea and sorry about the topic hijack in here 😂
Thats what I found aswell, we'll check it out soon 👍
<@!93804453479579648> you might like this, I added a "Compile Player Scripts" button right in Compilation Visualizer. Was immediately useful here 🙂
Oh sweet, so the discussion in here wasn't totally misplaced after all 😄
It wasn't! I tested it and realized that (unexpectedly) Unity reports proper compilation events for that call, which means that what CompViz shows actually matches the expected result (that is, seeing the timeline for that player compilation call)
(it's a bit buggy in the incremental compilation on 2021.2 and I already reported some bugs about that to Unity)
Hi, got back from vacation and finally got to check out the Comp Vis update!
Player scripts compilation works like a charm, thank you!
Though it seems the Dependant/Dependency Count visualization has a bit of an issue after player compilation. All bars are rendered completely white. When doing editor recompile it shows red/green bars as expected.
(Unity 2020.3.8)
Ugh, what is that... Do you happen to have some fast domain reload settings on?
do you mean these?
Yep, thanks. I'll take a look - there have been changes to how Unity handles static fields in editor windows in some 2020.3 version (patch release breaking a lot of things / requiring different initialization), so the same might hit here. Interesting that we haven't seen this so far (CompViz is in every production project here)
Hey all, just released a maintenance update for Compilation Visualizer that fixes some changed file names in the 2021.2 TECH stream, and also some issues around reload times when entering playmode. Enjoy!
[1.7.0] - 2021-11-10
fixed null texture warning in some cases after domain reload
fixed pid filtering in 2021.2.0f1+ (change in release - no support for 2021.2 beta anymore)
fixed reload timings incorrectly being changed when reloading assemblies on entering playmode
New update! 1.8.0 comes with a feature that has often been requested. Zooming! 🔎
https://twitter.com/hybridherbst/status/1499881914915819525?t=J0r-WHDhuaH3YmjgRCrazw&s=19
Not sure if this is maintained anymore but I posted this a bit ago and it seems due to some conflicting IO Stream operations: https://github.com/needle-tools/compilation-visualizer/issues/15
but that's the best I've been to suss out so far
Thanks for the bump! I'll try to take a look