Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[OPEN SOURCE] TypeSafe - Replace 'magic' strings with automatically generated code

Discussion in 'Assets and Asset Store' started by Simie, Aug 3, 2015.

  1. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    This is a simple and effective tool. Thank you for creating it.

    I'm converting all the project to use TypeSafe, and so far so good :)

    Just a few questions:
    1. how to force a rebuild if the auto rebuild is disabled?
    2. what is the best approach to rename the prefix/suffix after that I already used the default one in the code? I could disable the auto rebuild, refactor it with Monodevelop, change the settings with the new prefix/suffix and then re-enable the auto rebuild?
    3. I want to exclude some folders from my resources. So I added in the filters "Menu/" but it doesn't seems to work. How should I specify just that folder and not any file containing the word "Menu" inside?

    Thanks
     
  2. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    @mcmorry, thanks for purchasing, I'm glad you like it!

    1. There is a menu item (Assets/TypeSafe Refresh) that can trigger a scan manually.
    2. Yes, this would be the best approach in my opinion.
    3. Right now the folder blacklist can only filter folder names (i.e. every component of a path is compared against the filters, rather than the path as a whole). In the update I'm submitting tomorrow you will be able to blacklist paths instead of just folder names. If you send me a PM with your email address I can send you the build as soon as I submit it so you don't have to wait for the asset store approval.
     
  3. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thank you for your detailed explanation.

    About the point 1 my very personal opinion is that if possible would be better to have all the commands in the same menu. In the case of TypeSafe would be Window/TypeSafe. I use many plugins and is very hard to remember for each of them where to look in the menu. I was also expecting to see a button appearing in the setting windows to start the scan as soon as I unchecked the auto scan.

    I'll wait for the update on the store. Thank you anyway for you kindness :)

    One more thing I was thinking about is the option to support a loading of resources by enum. For example I define a list of cars model inside an enum, and in my code I use this enum to set what car to load.
    Now I have to convert it to string to load the car from a path, and I can't use a typesafe approach, unless I use a switch statement that should be updated every time a new model is added.
    Would be nice to have TypeSafe to use directly the enum and internally implementing the switch. But I'm not sure how it could be implemented.
     
  4. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    @mcmorry, I will definitely add a button to the settings window to trigger a scan. I don't see a reason why there shouldn't be one there just in case people find it useful. The refresh menu item is in the Assets menu so it appears in the right-click menu when working with assets to make it easy to access. If you want to set up a custom menu item somewhere you could use the MenuItem attribute and the TypeSafeApi to trigger scans.

    For your enum use case, could you instead use SRResources.YourCarPrefabs.GetContents<YourCarPrefabType>() as your list? The prefabs are not actually loaded until you instantiate them, so the performance should be fine.

    Everyone else, TypeSafe 1.2.0 has been submitted to the Asset Store. Hopefully it should be available soon. Here is the changelog:

    1.2.0
    ----------

    New:
    - Input axes are now included in generated code (as defined in the Input Manager)
    - 'Whitelist' mode allows you to specify only the folders/assets you want to include.
    - Select what can trigger automatic scan (resources, layers, scenes, etc).
    - Customise the output directory from the settings window.

    Improvements:
    - Settings window updated with new layout, added changelog tab to welcome window.
    - Can opt-in to including disabled scenes in the generated code (useful for development when not including all scenes of your game in test builds)

    Fixes:
    - Prevent '.' character in naming scheme class names.
    - (Mac) Prevent settings asset from being overridden when reimporting project.
     
    movra and mcmorry like this.
  5. gskinner

    gskinner

    Joined:
    Aug 28, 2014
    Posts:
    43
    Yes excellent, that would be perfect. Thanks!
     
  6. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hey everyone, 1.2.0 has been approved and is now available on the Asset Store. Thanks to the Asset Store team for a quick turnaround on this one!

    @gskinner, the latest update has the scene feature included. Check the settings panel!
     
    movra likes this.
  7. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Sorry but I'm not understanding.
    I load a prefab like this:
    Code (CSharp):
    1. enum CarModels {
    2.   Car1,
    3.   Car2,
    4.   Car3
    5. }
    6.  
    7. CarModels myCar;
    8.  
    9. var carPrefab = Resources.Load("Cars/" + myCar);
    10. var carTr = GameObject.Instantiate<Transform>(carPrefab);
    11.  
    How should I change it based on your suggestion?
    Thanks
     
  8. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    I was thinking something like this:

    Code (CSharp):
    1. var carModels = SRResources.CarPrefabs.GetContents<GameObject>();
    2.  
    3. // Use an index to determine selected car type
    4. var selectedCar = 0;
    5.  
    6. // Resource name can be used to give feedback to the user
    7. var selectedCarName = carModels[selectedCar].Name;
    8.          
    9. var instance = Instantiate(carModels[selectedCar]);
    That would let you add new cars by simply adding another prefab in the resources folder without updating an enum.

    I do like your idea of a resources enum for each resource folder, though. I will look into the possibility of adding something like that. One problem I foresee is that there would be no type-checking on things loaded by enum.
     
  9. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thank you very much. I suppose that the list of prefabs will keep the same alphabetical order of the files. In that case I could just cast my enum into an integer. It will not be 100% safe, but at least will trace a moved or renamed folder.

    If TypeSafe generates enums based on the files, it should be type safe. For example removing Car5, CarModels.Car5 will not exist anymore and should throw an exception. The risk is when the enum value is assigned to a component using the inspector, or through deserialization. I don't know what happens if you deserialize an enum with a value that doesn't exist anymore. Probably a runtime exception. But it is still better than to load prefabs by string or by integer.
     
  10. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I'm working with Animator triggers and I find myself typing
    Maybe TypeSafe could do its job also here ;)
     
  11. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    @mcmorry, don't forget that you can also leverage TypeSafe to generate static code specific to your project.

    See: Custom Data Source

    I was one of the ones (the only one?) pushing for this feature, so I might be a bit biased, but it really helps out. I've got it generating static code for my object pool management (i.e. the accessible names of each pool) and it works really, really well.

    It might take a little bit to understand the API, but it's really powerful. @Simie did a great job on it.
     
    mcmorry and Simie like this.
  12. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    This has been requested quite a few times now. I'll look into it and see if I can find a good way to implement it. ;)

    Interesting trivia: All of the built-in generators (apart from Resources) also use this API now!
     
  13. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    I'm not sure if all of them used it when I popped the hood with the early, undocumented version you sent me, but I'm actually really glad you did that as I used it as a reference point to understand how to implement it myself.

    Thankfully there's documentation now, so nobody should have to do that anymore, but it's sweet that you've got everything but Resources using it!
     
  14. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thank you. It's very interesting and the documentation is very detailed.
    If I can ask, just a small example would help to avoid going by trial and error, and to better see the use case. :p
     
  15. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Heh, my generator code would probably confuse you more than help. @Simie might be able to give you something a bit more readable.

    If not I'll see if I can extract out some kind of example.
     
  16. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thank you. Mainly to describe a possible real use case, and how this API will resolve the problem. The implementation should not be that hard.
     
  17. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
  18. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes the code is very clear. You could add this to the documentation :)

    So for example I could use this to create my collection of custom data based on an external sources (xml, json, google drive, etc.).
    It will look something like an hardcoded database.
    It's interesting.

    @electroflame, can I ask you for what you needed this feature?
     
  19. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Absolutely!

    I needed it to generate static variables that represent the names/keys for my object pooling. Say, for example, I have a pool named "Enemies" I wouldn't want to access my pool by typing in "Enemies" everywhere -- especially if, later, I decide that I need to split the pool up into "Easy Enemies" and "Hard Enemies".

    I've since added support to generate string names for my Resources as well (as I need to have a compile-time constant for some class decorators).

    I was using my own static code generation before I ran across TypeSafe, so I wanted to move all of the generation over once I made the switch. @Simie was kind enough to work with me on this until TypeSafe's API fit my use-cases.
     
    mcmorry likes this.
  20. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thanks. Your are right. The object pooling could be also improved in this way :)
     
  21. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    604
    This is very nice asset. Thank you very much. But I have a problem to report.

    I'm getting a compilation error after TypeSafe generates the resources.generated.cs file. One of my resources has a script class which is defined as "internal" instead of public. I don't like to define classes as "public" when I'm not developing a class library. All of my game classes are internal by default. Since TypeSafe is declaring Resource members as "public", I get this error...

    Assets/Scripts/TypeSafe/Resources.Generated.cs(85,79): error CS0053: Inconsistent accessibility: property type `TypeSafe.Resource<PartialViewTemplates>' is less accessible than property `TypeSafe.Resources.PartialViewTemplates'

    Here, my PartialViewTemplates class is internal but TypeSafe.Resources.PartialViewTemplates member is public.

    Can you declare the access modifier of members same as their type modifiers please?
     
    mcmorry likes this.
  22. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Thanks for reporting this issue. I will add a check for the access modifier of types when using them as resources to prevent this problem. If you like, I can send you a prerelease build with this issue fixed once I have implemented it.
     
  23. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    604
    Thank you. My problem is not urgent now.
     
  24. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Hi, I'm working on memory management inside Unity and as you probably know is not easy at all...
    I instantiated a prefab (using Unity standard methods) and then destroyed.
    Then I tried to use Resources.UnloadAsset() passing the prefab reference loaded with Resources.Load(), but it throws an exception:
    "UnloadAsset may only be used on individual assets and can not be used on GameObject's / Components or AssetBundles"

    I saw that TypeSafe uses UnloadAsset, so how you do with prefabs? Is it possible to unload them?
     
  25. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi @mcmorry,

    You've actually picked up on something that is also a bug in TypeSafe (it calls Resources.Unload on prefabs, which causes the same exception). I'll need to fix this in an update.

    My understanding of assets used by prefabs is this:
    - Assets remain unloaded until the prefab is loaded via Resources.Load
    - Once the last instance of the prefab is removed from the scene and the prefab is not referenced anywhere in code...
    - Calling Resources.UnloadUnusedAssets() should clean up those assets.

    In my past projects I have used a system like this:
    - Ensure all references to resources in C# are set to null
    - Call GC.Collect() to force the C#-side objects that represent assets to be cleaned up
    - Call Resources.UnloadUnusedAssets()

    Setting the references to null is important, as the docs for Resources.UnloadUnusedAssets say..

    "An asset is deemed to be unused if it isn't reached after walking the whole game object hierarchy, including script components. Static variables are also examined."

    I hope this helps, and thanks for bringing this up so I noticed the bug in TypeSafe.
     
  26. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thank you for your feedback. That are the same things I do. I was hoping to selectively unload some assets without using the more aggressive UnloadUnusedAssets. It seems not possible with prefabs. So the only alternative to that is to create my own cache to be sure that UnloadUnusedAssets will not unload something that I'll need to keep in memory.
     
  27. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hey folks, I've just submitted TypeSafe 1.2.1 to the asset store for approval. Sorry for the delay in putting out this bug-fix release. Update notes are below as usual.

    1.2.1
    ----------

    Changes:
    - Menu items are no longer specified in the .dll file, instead are located in TypeSafe/Editor/MenuItems.cs to allow for user customisation.
    - No longer aborts compile process if a C#-safe name for a resource cannot be found, instead skips and prints a compile error.
    - Added "Start Scan" button to settings window.

    Fixes:
    - Resources with a custom type that is 'private' are now declared as 'internal' to prevent "Inconsistent accessibility" errors.
     
    movra likes this.
  28. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    1.2.1 has been approved and is now available for download!
     
  29. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    Hey there. Just bought TypeSafe. Really liking it so far. I'm trying to update my code to use the TypeSafe system for resource loading, but I've run into a problem.

    I'm currently saving objects in my scene to a json string, and then loading them later based on a resources folder path, and an object "type" which is in the json string.

    How can I use the TypeSafe static class to find a specific prefab to load when all the information about an object is coming from a json string? Or rather, what would be the ideal way to save an object to a string so that I can load it back up using TypeSafe dot notation?
     
  30. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi @jeffreyschoch, thanks for purchasing. I'm glad you like it so far.

    TypeSafe is not suited to loading dynamically via strings, it is intended as a replacement for hard-coded paths in your code.

    The dot-notation is simply accessing static C# classes that have been generated by TypeSafe. It's not possible to use this dynamically via strings. However, you can iterate over the resources via SRResources.GetContents() to find the particular resource you are looking for.
     
  31. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    @Simie Thanks for the response. Perhaps there should be a function for getting a resource by string path or relative path? SRResources.myPrefabsFolder.GetContentsByPath(string) or something similar? Which may only match the given string to a path property within the static class. I guess that would just be an iteration behind the scenes anyway. Not sure if that defeats the purpose of the asset or not, but would provide a way to use dot notation in combination with a partial path.

    Or perhaps simply a .Path property for folder classes in the event that I'd like to build the path manually from a partial path? So for instance SRResources.myPrefabsFolder.Path + prefabPath. Where prefabPath could be a complex path loaded from json.

    I would just like to avoid having to iterate over contents when loading each asset, because that won't scale well as the contents grow.
     
    Last edited: Nov 16, 2015
  32. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    I like the idea of adding a method for getting the path of a resource folder. I've added that to the todo list.

    In your situation I would create a Dictionary<string, IResource> from the contents of your prefab folder that you want to have dynamically loaded. Then, you can do fast lookups via string on that dictionary from your JSON to get the associated prefab. Example:

    Code (CSharp):
    1. var dict = new Dictionary<string, TypeSafe.PrefabResource>();
    2. var list = SRResources.Prefabs.GetContents<UnityEngine.GameObject>();
    3.  
    4. for (var i = 0; i < list.Count; i++)
    5. {
    6.     dict.Add(list[i].Path, (PrefabResource)list[i]);
    7. }
    I'll consider adding a lookup via string to folders for a future version, though.
     
  33. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    @Simie Thanks very much for the consideration and the advice. We may opt to keep our current string-y solution for the time being, but your solution definitely seems like it will do the trick for avoiding lots of runtime iteration. I look forward to the future releases.

    Thanks again.
     
    Last edited: Nov 17, 2015
  34. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    I loaded everything in (much later than I actually intended), and it's been great - however, one thing I'm curious on is performance. With a large project, it's taking about 24 seconds to process everything.

    Would it be possible to add, well, rather, configure, the white list, so that it doesn't actually search the whole project, but rather just the places in the whitelist?

    Basically entirely removed strings from my project. Fantastic.
     
  35. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    @Plutoman, good to hear it's all working great for you!

    There is a configurable white-list in the "Filtering" tab in the settings window (make sure you're on the latest version!). You can drag the folders you want into this list and it will only include those.

    EDIT: Also, I'm interested in why it is taking so long to scan. Do you have a lot of custom asset types in your project? For most resources TypeSafe simply scans the file name to determine the type, which is very fast, but it can't do that for custom assets so has to query Unity for the type.
     
  36. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    Yeah, I was using the whitelist, but it didn't really change the time-span involved, unless by a small factor. No custom asset types, unless you mean a prefab with a custom game script or somesuch. It's.. iirc, exclusively prefabs, materials, shaders, at this point.

    I restrict it to a very small set of the project, but since it didn't change the time-span by much, I assumed it was probably still searching the whole project and skipping those not in the whitelist, since I do have quite a lot of assets (easily in the tens of thousands I would guess, when I have the testing folder included with all my extras, like the substance database).

    Edit: And does TypeSafe Refresh, the contextual menu item, only refresh folders at and below the point clicked on? IE, if I use it on Resources/Prefabs/Doodads, would it refresh the doodads folder and all sub-folders, or does it do a full refresh?
     
    Last edited: Dec 5, 2015
  37. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    The TypeSafe Refresh does a full refresh every time.

    Would you mind sending me your TypeSafe.log (YourProject/Temp/TypeSafe.log) file after a long scan has completed? I'd like to take a look to see if there are signs of assets being queried from Unity instead of having their types picked from the file extension. My email is simon@stompyrobot.uk.

    I'll look into the whitelist code and see if there are any optimizations I can do there, too.
     
  38. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    Sent one off!

    Just to recap the e-mail, though, the two things I notice are 1) logging can take a lot of time, and 2) the whitelist is definitely scanning all assets and skipping those not in the whitelist, so it might be faster to have a full-path based whitelist where it directly only scans those assets.

    Edit: if I'm correct, you might be using this => http://docs.unity3d.com/ScriptReference/AssetPostprocessor.OnPostprocessAllAssets.html which I guess would preclude just searching manually, unless you do a manual file-search, though. Could be wrong! Manual file searches are sometimes annoying to keep platform agnostic.
     
  39. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    @Plutoman, thanks for the log file. I've sent you an updated build with some performance optimizations that should significantly improve the scan times for your project. Let me know how that goes!

    Out of interest, how were you determining that the logging is taking a lot of time?
     
  40. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    Sorry, no performance numbers, just a guess based upon the logging I do in my own program. It tends to increase times by 2-3x, just by nature of strings. When it's a text file in the 2MB+ size, it's usually taking some time to process, unless the entire time was a stringbuilder that was maintained across and written once. Even for example, debug.log statements from Unity, processing more than 5-10 a frame is impossible (those have more overhead, obv, but strings in general are painful).

    I'll plug in that one and try it out!

    If I could request a test, though, is it possible to test the numbers with/without logging? I would imagine for those who have a fairly stable setup that it could increase the speed even more dramatically. Then you can turn it on when something isn't working right, and back off when it is.
     
  41. robstardotstar

    robstardotstar

    Joined:
    Jan 12, 2016
    Posts:
    6
    Hi I'm new to Typesafe.
    I've got it installed, scanned can it's generated things in usr.
    SRResources isn't available in my scripts.
    Intellisense isn't working either.

    I'm using MonoDevelop (Unity 5.3.1f1)

    Any idea what I might be missing?

    Thanks
     
  42. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    604
    This may be out of topic but... Please use VS2015 community edition (for free) instead of MonoDevelop. If MonoDevelop is the same thing going to Moon, VS is the thing going to Jupiter. If you are on Mac, please ignore me unless you like to install VS on a virtual machine.
     
  43. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    That sounds like the generated files are not present in the MonoDevelop solution. Could you try closing MonoDevelop and deleting the .csproj and .sln files generated by Unity, then executing the menu item "Assets/Sync MonoDevelop Project" in Unity? That will hopefully fix it.
     
  44. robstardotstar

    robstardotstar

    Joined:
    Jan 12, 2016
    Posts:
    6
    I'm on a Mac but thanks :)

    This fixed it. Thanks very much, Although there's no "Sync MonoDevelop Project" option, it was "Open C# Project".
    Anyway, perfect! Thanks
     
    Simie likes this.
  45. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    Hey guys,
    Is there anyway to use a dynamic string to select resources to instantiate?

    eg.

    SRResources.Actors.Vehicles[vehicleType]

    Where vehicleType is a dynamic value either a string or an enum property setup by a level designer from an enum selection or something in the editor.

    class Vehicle : MonoBehaviour
    {
    [SerializeField]
    private VehicleType vehicleType;​
    }​

    enum VehicleType
    {
    Vehicle1,Vehicle2,Vehicle3​
    }​
    This can be achieved with a dictionary but is it beyond the scope of TypeSafe?


     
  46. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi @pixxelbob, generating enums is something I looked into but decided against.

    TypeSafe aims to minimise the errors and bugs brought about by deleting and renaming resources, and there is no clear way to prevent such bugs if an enum is regenerated with different values (i.e. all the uses of the enum in the inspector may change as a result of an enum entry being removed and all the enum values shifting by one.)

    However, you can iterate over the contents of a folder with SRResources.Actors.Vehicles.GetContents() and compare the Name property of the returned items.

    Details here.

    EDIT:

    If you are happy taking the risk of resources being removed and references breaking, I whipped up this editor extension a while ago that you could use:



    Source Code

    You'll have to pass the strings to Resources.Load so won't be able to use the TypeSafe system, but you might find it useful. I haven't tested it much, so keep an eye out for bugs.
     
    Last edited: Jan 29, 2016
    pixxelbob likes this.
  47. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    Yeh I guessed I probably use the safety TypeSafe provides
    I'll give it a try but yeh I'm a bit wary it feels like I'm trying to do something that shouldn't be done.
    Trying to bridge the gap between dev & designer in an elegant way, it's tough :D

    Thanks very much
     
  48. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    That most definitely looks to me like something that should be generated at runtime; you can iterate across and build your own lists of resource references via the GetContents method. It seems a bit custom for the TypeSafe system as well, as that particular type of usage is harder to handle directly.. losing the safety, for sure.
     
  49. LouisHong

    LouisHong

    Joined:
    Nov 11, 2014
    Posts:
    69
    I'm using this in conjunction with Cross Platform Native Plugins, one of the most popular assets for mobile development, and compiling these two assets together gives

    Assets/StompyRobot/TypeSafe/usr/Resources.Generated.cs(1585,93): error CS0234: The type or namespace name `EditorGameCenter' does not exist in the namespace `VoxelBusters.NativePlugins.Internal'. Are you missing an assembly reference?

    I can fix this if I go into the generated file and delete everything that has to do with VoxelBusters, but it's really easy to forget with I upload the build to Unity Cloud Build.

    edit:
    I figured it out, just add Assets/Resources/VoxelBusters to the blacklist and it'll be fixed.
     
    Last edited: Jun 11, 2016
  50. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    Hey, Does anyone know how to work with UI Sprites from SRResources that doesn't involve creating new Sprites in memory?
    I have UI sprites with their Texture Type set to Sprite (2D & UI) but they come in to SRResources as Texture2D not Sprite so apply them to a UI image gives type missmatch etc.

    I have to alloc a new Sprite object which seems a bit wasteful given the original asset is a Sprite

    (Unity 5.3.5, TypeSafe 1.2.1)