Unity URP Light2D, set target sorting layers programmatically - sorting

Im working on a personal 2D game and have been looking into the Universal Pipeline Renderer and the Light2D object.
I currently have Light2D objects being generated dynamically during level generation which works fine except I cant find a way to set the Target Sorting Layers option programmatically I can only set them at runtime using the editor. Am I missing something obvious or is this not possible?
Thanks

This used to work in at least some of the experimental versions of URP using
[lightSpriteComponent].m_ApplyToSortingLayers
however, when it stopped being experimental, this stopped working and broke one of my projects.
A way to set this from code and a way to set the light's sprite at runtime like the old form
[lightSpriteComponent].lightCookieSprite = Sprite
would be fantastic. They both existed and you could probably go into the URP code and find a way to access them again but, as of now, I don't think it's possible without going to an older version.

Related

Angular 2 + routing + animations

I'm currently working on a project that uses the routing approach (not documentation yet for Dart):
https://angular.io/docs/ts/latest/guide/router-deprecated.html
And I wonder how could I control the transition between different views. I read about the CssAnimationBuilder, but there is no much documentation about this class.
Even though the question is related to the Dart environment, TypeScript and JavaScript programmers are welcome, since Dart is still a small group.
There is a new router coming again and there is also new animation feature work in progress and it looks like it is about to be shipped (https://www.youtube.com/watch?v=Hr4IKlr9mhg) I think it's better to wait until these become available.
If you need or want a solution immediately I would create a custom <router-outlet> that adds the new component, before it removes the old one and adds/removes CSS classes as required to make it easy to apply animations.

Xcode autocomplete showing results that don't exist on object

When using App Code, autocomplete will only show results directly related to my struct. This is a great feature as it keeps everything very clean and I know that accessing these properties isn't going to give me an error.
Except I don't like App Code and it's non native looking UI.
In Xcode it's quite different. Why am I getting flatMap, map, description, debugDescription?
Obviously if its my own code, I know which properties/functions are okay to use, because I wrote them. I can just ignore the noise. But if I'm using someone else's library this can slow things down. Especially when I'm just guessing or trying to remember a function.
Is there a way to fix this — to have Xcode not show me functions/properties that I can't use?
It always shows default system objects properties if the object/class is not found.
It's the behavior of Xcode

Refactoring Images in Xcode 7?

It is possible to refactor images in Xcode 7? I have a lot of images and I want to change their names. But I do not want to change every reference to this image manually.
I cannot find anything at Google.
Xcode can only refactor C and Objective-C code for now. You will have to do the refactoring manually, or simply using Find > Find and Replace in Workspace...
To avoid potential crashes that might be caused if you make a mistake, use R.swift, which makes it similar to how it works on Android.

Logic tests for OS X using Xcode 6

I want to implement unit testing in my Xcode project, and would like to run tests without requiring the application to be started.
Reasons for this are, I have a core data based document app, that also uses a cvdisplay link to control continuous rendering in a background thread.
It strikes me that I do not need a running application to test core data datamodel functionality, this should be distinct from view stuff anyway. Also I would like to isolate and performance test my background rendering processes, something that seems very difficult with the app running, but could easily do without the application running, just getting the right classes and feed it the correct data.
I've seen other questions that have answers for Xcode versions before six, but the answers don't seem to work for the current version.
The docs now make a distinction between application and library tests. Library tests are run against library targets.
I'm not sure i want to reorganise my code into distinct libraries at the moment, and would prefer to avoid it or fake it somehow.
I saw somewhere an openradar relating to this in ios, but I'm interested in osx.
Has anyone any insight into this?
EDIT : Learning to cope with the existing setup for now, testing with full app running, I can run some checks on that, then I close all documents and shut down the display link.
I can then run tests creating my own persistent store coordinator, in memory datastore and context, as well as testing my rendering classes without fear of conflict with the other display thread.
I'm now running into troubles with linking sources, I just can't seem to get it right, I fiddle with settings, it seems to work for a bit, then suddenly stops building again with Undefined symbols for architecture x86_64: errors, either that or problems linking with 3rd party private frameworks. I look through the web, change a few things, it starts working again. Then I add some tests, importing more of my classes, things stop working again.,.. Infuriating
EDIT 2: Pretty much all sorted now, but maybe not terribly efficient. For each test case class, I either open or close documents and start or stop the display link in the +(void)setup method. I don't do anything in the +(void)tearDown, and let the setup decide how to proceed based on the current state.
Although this means it's possible to flow from one test class to another minimizing document opens and closes, there doesn't seem to be a way to order the tests so that I could group them together.
BTW, I also solved my mentioned linking troubles (XCode 6 Testing Target Troubles), not really relevant to this question though.
It sounds like you landed on the standard solution: Give your app a way to tell when it's being stood up for testing rather than use, and then have applicationDidFinishLaunching: not do any of your usual launch-time behaviors, but leave it to specific tests to provide any setup they need.
You might benefit from creating multiple test suites to deal with different expected conditions, like all the tests that work around a specific document being open.

What is the best practice to resolve issues due to updated revisions in Three.JS?

I have some codes developed using Three.js R52. I need some features in some code developed using Three.js R56. While I tried to add those features to the original codes developed in R52 and replace the reference to R52 with that to R56, it tells me some some error.
For example, in the original code based on R52, THREE.Matrix4().multiplySelf function is used. After I change the reference to three.min.js from R52 to R56, I came across errors saying:
TypeError: multiplySelf is not a function.
Then I go through the changes listed in https://github.com/mrdoob/three.js/releases by searching "Matrix4", I did not see any note related to method 'multiplySelf'. I searched "multiplySelf" and it returns no entry found. I searched three.min.js R52 and found function "multiplySelf". But there is no 'multiplySelf' in R65.
Could anybody tell me what I should do now? And in general, what is the best practice to resolve issues due to updated revisions in Three.JS? Thanks...
I would create different sandboxes with the different versions of three.js. As such, I would be able to move from one sandbox to another and testing my functions without contaminating my code. I call sandbox a folder whose name is distinctive per three.js version where I only keep functionality relevant to that release and I never mix sandboxes. Usually you would have to keep a copy of your code in each sandbox until all the translations from one release to the other have been performed.
In addition you can use code like: if (THREE.REVISION < 58) to separate the different versions of three.js in your code.

Resources