Search Unity

[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
    When you select the file itself in the resource folder the Inspector shows the settings for a texture. So even if you set a texture type as "Sprite (2D & UI)" it is still a texture asset.
    But is possible to load directly a sprite from the resources, so probably TypeSafe is not checking that the type is Sprite and is still loading a Texture2D.

    Maybe @Simie could improve this.
     
  2. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    Yeh sorry that's exactly what I meant :)
    It's loading in as a Texture2D instead of a Sprite resource.
     
  3. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi folks, I just submitted a new version of TypeSafe to the asset store to address this! :) Should be available in a few days once approved.

    1.2.2
    ----------

    Changes:
    - Textures set to the "Sprite" import mode will now use the Sprite type in resources.
    - Changes to assets in blacklist no longer trigger automatic scan.
    - When whitelist is enabled, changes to assets not in whitelist no longer trigger automatic scan.
    - Items in blacklist/not in whitelist no longer have heavy processing (should speed up scan time significantly on large projects).
    - Custom asset types are now cached so subsequent scans are faster.
     
    pixxelbob, mcmorry and LiterallyJeff like this.
  4. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    TypeSafe 1.2.2 has been approved and is available on the Asset Store :)
     
    pixxelbob likes this.
  5. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    Hey @Simie
    That's great. Any possibility of adding support for AudioMixers in a future release?

    Thanks
     
  6. dthurn

    dthurn

    Joined:
    Feb 17, 2015
    Posts:
    77
    Hey, quick question: does TypeSafe support resources in AssetBundles, or is it only stuff in the Resources folder?
     
  7. Wilbert-Blom

    Wilbert-Blom

    Joined:
    Aug 13, 2011
    Posts:
    109
    Is it possible to use TypeSafe for Animator States?
    I use Animator.CrossFade("StateName") a lot and if this would work with intellisense it would help me very much.
     
  8. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
  9. Yieldgame

    Yieldgame

    Joined:
    Sep 30, 2016
    Posts:
    1
    Hello. I have two feature suggestions that I really miss in this asset:
    1) I want to have something like SRResources.SomeFolder.GetPath() to dynamicaly load Resources. To work with it like:
    Code (CSharp):
    1. string path = SRResources.LevelsPrefabsFolder.GetPath();
    2. var level = Resources.Load(path + "/Level" + levelNum + ".asset);
    2) I like the SOMValueAttribute from the StringOMatic Asset. Can you implement something similar, but better as always :). It will be very handy.
     
  10. Simie

    Simie

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

    1. You can use SRResources.LevelPrefabsFolder.GetContents<GameObject>() to get all the prefabs in the folder and look up their name with the .Name property. No need to deal with paths directly.

    For example, using LINQ to find the level:
    var levelPrefab = SRResources.LevelPrefabsFolder.GetContents<GameObject>().Single(p => p.Name == "Level2");

    2. I have a script that implements a similar functionality as that SOMValueAttribute available here. I don't feel including it in TypeSafe itself is the correct decision, because I feel it implies a level of "safety" that it simply doesn't provide. For example, changing a resource name will break all references that use it with no error message, which is contrary to the aims of TypeSafe. But feel free to use the script if you find it useful.
     
  11. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi everyone. A new update for TypeSafe, 1.3.1, has been submitted to the asset store for approval and should be available soon. The change log is below.

    You can access this version early by visiting our Source Auth page to get access to the gitlab repository and visiting the "tags" page.

    1.3.1
    ----------

    New:
    - Support for Audio Mixers parameters and snapshots.
    - Support for Animator parameters and layers.
    - Added checkboxes in advanced tab for disabling individual data sources.

    Changes:
    - Minimum supported Unity version is now 5.4.
    - Unity 4 is no longer supported.
    - Custom asset type cache is now stored separately from settings so it can be excluded from source control.

    Edit: Latest version will now be 1.3.1, a bug was found and fixed in 1.3.0.
     
    Last edited: May 16, 2017
    electroflame and mcmorry like this.
  12. ekt

    ekt

    Joined:
    Jul 9, 2012
    Posts:
    28
    does this include animation states? that is, the string you would use in
    Code (CSharp):
    1. animator.Play(Animator.StringToHash("Base Layer.my_clip"));
     
  13. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Yes! From the settings window you can now drag animators you wish to be "stringified" into a list and they will have code generated for them and be monitored for changes.

    More info.
     
    ekt likes this.
  14. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @Simie Feature request

    Is quite important to instantiate a GameObject by specifying the parent, as this avoids the allocation of a root hidden object that will be disposed the moment a SetParent method will be called on the new instantiated object, and also improve performances on Unity 5.6
    At least this is what is explained at Unity 2016:


    So, could you please add all the overloads of Object.Instantiate in the PrefabResource class?

    Thanks! :)
     
  15. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    @mcmorry, sure. I'll have the missing overloads added in the next version.
     
    mcmorry likes this.
  16. TinyLabProd

    TinyLabProd

    Joined:
    Aug 30, 2013
    Posts:
    17
    Hey there. I'd like to request a feature. Could you allow thing generation to be turned off?

    For example we only need to generate Sorting Layers, Layers and Tags. it would be nice if we could switch other things off.
     
  17. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi,

    This is already implemented. In the advanced tab of the settings window you can toggle any data sources you want on/off. You can then uncheck "Rebuild Automatically" on the General tab to disable Resources generation, then delete any already generated files you no longer need.

     
  18. thestroyer_

    thestroyer_

    Joined:
    Oct 12, 2015
    Posts:
    10
    Hi,
    Are ScriptableObjects compatible with TypeSafe? I mean, I put some ScriptableObjects inside the Resources folder and clicked on TypeSafe Refresh and then a lot of error logs appeared in the console. It's like it has lost all the references. Could you help me?

    Thanks in advance :D
     

    Attached Files:

  19. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi Segibote,

    TypeSafe should support scriptable objects no problem. Are those classes that are not being found accessible from the place where TypeSafe has placed the generated files (e.g. if you've put the usr folder in an asmdef assembly then you won't be able to access custom classes outside of that assembly), or are they editor only scripts?
     
  20. thestroyer_

    thestroyer_

    Joined:
    Oct 12, 2015
    Posts:
    10
    Hi, sorry for taking a while to answer.
    We finally fixed the problem. The mistake was that we put the StompyRobot folder inside the StandardAssets folder. :confused:
     
  21. ricke44654

    ricke44654

    Joined:
    May 8, 2016
    Posts:
    8
    Update: Well, I backed up a few more folders and blew away my ProjectSettings, Packages, and UnityPackageManager folders, at which point Unity was unsure of the project version. I loaded into Unity 2018.3.10f1 and everything rebuilt fine and the Settings and Guide windows displayed without issues. I upgraded the project to 2019.1.0f2 and everything still worked, so I restored my project settings from backup and all appears well at this point. Strange issue, but appears to be resolved from what I can tell. Thanks.

    Hi there. I've used TypeSafe in the past with great success and have been very happy with it. I'm trying to integrate it into an existing project that I recently upgraded to Unity 2019.1.0f2 and I'm having a bit of a problem. When I import into the project, it loads all the files and performs the type rebuild process without issues. However, when I try to display the Settings or Guide window, I get several errors like the one below. I was able to load it into a new project using Unity 2018.3.10f1 and Unity 2019.1.0f2 without issues, so it seems like something specific to my project in some way. I blew away my Library and obj folders to let Unity rebuild the asset database, but I still have the same issue. Any thoughts would be greatly appreciated. Thanks for your time. :)

    MissingMethodException: bool UnityEngine.Texture2D.LoadImage(byte[])
    TypeSafe.Editor.Embedded.get_BGLight () (at <27e87d39ce324283b5d63699e402e480>:0)
    TypeSafe.Editor.Unity.TypeSafeGUI.BeginDrawBackground () (at <27e87d39ce324283b5d63699e402e480>:0)
    TypeSafe.Editor.Unity.WelcomeWindow.OnGUI () (at <27e87d39ce324283b5d63699e402e480>:0)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:345)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:339)
    UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:139)
    UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:295)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:481)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent () (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:455)
    UnityEngine.UIElements.UIR.ImmediateRenderer.Draw (UnityEngine.UIElements.UIR.DrawChainState dcs) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderers.cs:447)
    UnityEngine.UIElements.UIR.UIRenderDevice.ContinueChain (UnityEngine.UIElements.UIR.RendererBase head, UnityEngine.UIElements.UIR.DrawChainState dcs, System.Boolean outerChainsWithMeshRenderer) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderDevice.cs:841)
    UnityEngine.UIElements.UIR.UIRenderDevice.DrawChain (UnityEngine.UIElements.UIR.RendererBase head, UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection, UnityEngine.Texture atlas) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderDevice.cs:824)
    UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:218)
    UnityEngine.UIElements.UIRRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:190)
    UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:70)
    UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:589)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
    UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
     
    Last edited: Apr 21, 2019
    LuiBroDood likes this.
  22. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hey, glad the issue has sorted itself out. I suspect Unity's assembly updater was not running when opening your project, so TypeSafe was attempting to use an out-of-date API. You can manually trigger Unity's assembly updater from Assets -> Run API Updater
     
  23. ricke44654

    ricke44654

    Joined:
    May 8, 2016
    Posts:
    8
    Thanks Simie, I'll keep that one in mind for next time. :)
     
  24. InScatterbrain

    InScatterbrain

    Joined:
    Mar 7, 2017
    Posts:
    234
    I'm getting the same MissingMethodException on a new project in Unity 2019.1.0f2. Haven't added anything but TypeSafe. So maybe an issue with the latest version? Always worked fine for me with other versions. :)
     
  25. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hey, can you try reimporting the TypeSafe package (just choose to overwrite all files)? I was able to trigger the API updater by doing that, which fixes the missing method exception.

    For some reason running the API updater from the Edit menu doesn't seem to be working.
     
  26. denlee0710

    denlee0710

    Joined:
    Mar 9, 2015
    Posts:
    36
    I've tried deleting the folder and reimporting. Nothing triggers the API updater...
    Just to add that triggering update from menu also doesn't seem to fix the missing method issue.
     
  27. InScatterbrain

    InScatterbrain

    Joined:
    Mar 7, 2017
    Posts:
    234
    Sorry for the late response. Just tried reimporting, but doesn't seem to solve the issue for me either, unfortunately.
     
  28. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    @denlee0710 @InsaneScatterbrain hey guys, sorry about this. I'm working on an update that will convert TypeSafe to use asmdef files instead of precompiled DLLs, that should fix the issue with the API updater not working.
     
  29. InScatterbrain

    InScatterbrain

    Joined:
    Mar 7, 2017
    Posts:
    234
    No problem. Thanks for looking into it. :)
     
  30. ben-rasooli

    ben-rasooli

    Joined:
    May 1, 2014
    Posts:
    40
    Hi. How am I meant to use your asset with Assembly Definitions(asmdef)? In my case, I added an asmdef to the TypeSafe folder. It can recognize a Prefab inside the resources folder, but not a ScriptableObject.
     

    Attached Files:

  31. LuiBroDood

    LuiBroDood

    Joined:
    Mar 13, 2019
    Posts:
    84
    i just bought the asset cause i need Typesafe strings,
    iam getting that problem ,
    i cant see Settings or Guide windows it throws a bunch of exceptions

    .. same error as ricke

    also, your site for getting your source code, gives me Internal Service Error
    i shot u an email too asking for source code

    ...
    Yeah i backedup,
    and removed Packages and ProjectSettings
    and opened in 2018.3
    then 2019
    and it works,

    but yeah ideally wouldnt have to do that...
     
    Last edited: Jul 20, 2019
  32. LuiBroDood

    LuiBroDood

    Joined:
    Mar 13, 2019
    Posts:
    84
    how do i use my own strings with TypeSafe?

    like i have a list of strings, how do i use it with typesafe?
    it keeps telling me when i do
    using TypeSafe.Editor;
    that TypeSafe.Editor does not exist .. (?)
     
    Last edited: Jul 21, 2019
  33. KuboS0S

    KuboS0S

    Joined:
    May 21, 2017
    Posts:
    1
    Hi,
    I just bought the asset and ran into an issue. Every time I tried doing a TypeSafe Refresh, a ReflectionTypeLoadException was thrown and the refresh was aborted (I haven't done a refresh yet, this was the first one).

    I'm running Unity 2019.1.9f1. This only happened in one of my projects. I tried it in another almost-clean project, and it worked correctly.

    Any idea what could be causing it? The only thing I can think of is that it might be happening because I'm working with extra assembly files and AppDomains, but I could be completely off.
    Code (CSharp):
    1. System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    2.   at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
    3.   at System.Reflection.Assembly.GetTypes () [0x00000] in <7d97106330684add86d080ecf65bfe69>:0
    4.   at TypeSafe.Editor.TypeSafeUtil+<>c__DisplayClass26_0`1[T].<GetInterfaceInstances>b__0 (System.Reflection.Assembly p) [0x00000] in <27e87d39ce324283b5d63699e402e480>:0
    5.   at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x00051] in <fc8f020b2cc84cefa8241445cf28089b>:0
    6.   at TypeSafe.Editor.TypeSafeUtil+<GetInterfaceInstances>d__26`1[T].MoveNext () [0x0010f] in <27e87d39ce324283b5d63699e402e480>:0
    7.   at TypeSafe.Editor.ScanController+<ScanProcess>d__24.MoveNext () [0x001d0] in <27e87d39ce324283b5d63699e402e480>:0
    8.   at TypeSafe.Editor.ScanController.Update () [0x0000a] in <27e87d39ce324283b5d63699e402e480>:0
    9. UnityEngine.Debug:LogError(Object, Object)
    10. TypeSafe.Editor.TSLog:Print(LogType, String, Object)
    11. TypeSafe.Editor.TSLog:Log(LogCategory, LogType, String, Object)
    12. TypeSafe.Editor.TSLog:LogError(LogCategory, String, Object)
    13. TypeSafe.Editor.ScanController:Update()
    14. TypeSafe.Editor.TypeSafeController:Step()
    15. TypeSafe.Editor.TypeSafeController:OnEditorUpdate()
    16. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
     
  34. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi,

    There is an issue with the current version of TypeSafe that prevents it from reading user-defined types in asmdef files. The update I'm working on to convert TypeSafe to use asmdef instead of a precompiled DLL will also fix this.


    Hi,

    TypeSafe.Editor namespace is only available from a script in an Editor/ folder. Make sure your script is in a folder tha will be compiled as an editor assembly (and if using asmdef, make sure it has a reference to the TypeSafe.Editor.dll).

    Once you have access to this namespace you can create a custom data source as documented here: https://stompyrobot.uk/tools/typesafe/documentation/#custom-data-source
     
    KuboS0S likes this.
  35. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi, sorry I missed your post somehow. Could you email me at contact@stompyrobot.uk with your invoice number and I can send you a preview of the latest version to try? It has some changes to the reflection that might fix this. Cheers.
     
  36. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hi everyone,

    A new version of TypeSafe is now available on the asset store. It should fix the issues people have been seeing with the assembly updater, as well as fixing the most common cause of the "ReflectionTypeLoadException" being thrown.

    This update has switched TypeSafe to using asmdef files instead of pre-compiled DLLs, which means the source code is now available as part of the package instead of something you have to request.

    Unfortunately this requires some manual work during the update to remove the old DLLs when updating.

    If upgrading from prior version, follow these steps before importing the latest package:

    - Delete these files from 'StompyRobot/TypeSafe/Editor/':
    - TypeSafe.Editor.dll
    - TypeSafe.Editor.xml
    - MenuItems.cs
    - TypeCache.asset
    - Delete everything in 'StompyRobot/TypeSafe' except 'Editor/' and 'usr/' folders.
    - Import 1.4.0 package.


    Any issues please let me know.
     
  37. ben-rasooli

    ben-rasooli

    Joined:
    May 1, 2014
    Posts:
    40
    I'm using a fresh install of 1.4.0 version, but it does not generate any path for ScriptableObject instances inside the 'Resources' folder. It does so for other types of assets like materials or prefabs, but not ScriptableObjects. The same issue is for scenes. I added the scenes to the Build Settings, but I don't see any path generated for them inside SRScenes.

    Also, I should mention that in the 'StompyRobot > TypeSafe > Editor' folder, when I check the Cache file, I see it has a reference to my ScriptableObject instance.
     

    Attached Files:

    Last edited: Jul 26, 2019
  38. baba_s

    baba_s

    Joined:
    Nov 25, 2013
    Posts:
    6
    Hi,

    I used TypeSafe 1.4.0, but SRScenes was empty.
    I checked and found that the condition of the SceneDataSource class was wrong.
    The condition of string.IsNullOrEmpty on the 37th line is reversed.

    Code (CSharp):
    1. if (!string.IsNullOrEmpty(name))
    2. {
    3.     TSLog.LogWarning(LogCategory.Scanner, "Scene name is empty, skipping.");
    4.     continue;
    5. }
     

    Attached Files:

    ben-rasooli likes this.
  39. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Thanks for reporting, I'll get that fixed in an update. Sorry!

    I have a test case in my project that reflects your use case:



    Which is generated into this code by TypeSafe:



    Is it possible that your class is private? Only public classes will be checked by TypeSafe to avoid compile errors trying to use types from other DLLs.

    Can you also provide your current Unity version and I'll give it a try in case there's some specific issue.

    If your class being private is not causing the issue would it possible for you to try and put together a minimum-repro in a fresh project that demonstrates the issue and send that to me at simon@stompyrobot.uk ?
     
    Last edited: Jul 29, 2019
    ben-rasooli likes this.
  40. ben-rasooli

    ben-rasooli

    Joined:
    May 1, 2014
    Posts:
    40
    Correct, my classes were all 'internal'. After changing them to 'public', everything is working now. Thanks :)
     
    Simie likes this.
  41. iangregsondev

    iangregsondev

    Joined:
    Mar 30, 2018
    Posts:
    3
    I don't see any Enums for the Animation Clips, is this possible ?

    For example, currently doing this

    _animator.Play("SpiderDead");

    Problem is that SpiderDead is a string here, I can see that it supports Animators, but Animation Clip isn't available there, at least I can't find it..

    The animation clip is what is displays in the Animation Window i.e. Create new animation Clip.

    Any ideas ?

    By the way, great library! Best asset i bought for a while!
     
  42. iangregsondev

    iangregsondev

    Joined:
    Mar 30, 2018
    Posts:
    3
    Hi, another question :)

    I have noticed that if i place my prefabs under a directory

    Resources/Prefabs

    then i can do

    Instantiate(SRResources.Prefab.Beetle);

    Does having things under a Resource directory cause a performance hit, if not whats the difference ?

    Before using the above I would do

    var gameobject = GameObject.Find("Beetle")
    Instantiate(gameobject)

    Means I need to move all my prefabs under a Resources directory but I am little confused to weather this is going to cause an issue. I know typesafe needs for it to be under the Resources directory for it to be indexed.

    What other files can I place under Resources ?

    Any help really appreciated

    thanks in advance
     
  43. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Hey! Sorry for the late reply, I've been away on holiday the past few weeks.

    Unfortunately "Clips" are not supported, only Animator Controllers (using parameters and layers). Documentation for animators is available here:
    https://stompyrobot.uk/tools/typesafe/documentation/#animators
    Here are some links to help understand the Resources folder and how it works:
    https://blog.theknightsofunity.com/unity-resources-folder-how-to-use-it/
    https://docs.unity3d.com/ScriptReference/Resources.html

    The tl;dr is that assets in the Resources folder are always included in your build, even if they never get used, as there is no way for Unity to determine automatically if they are referenced or not.

    I hope this helps!
     
  44. iangregsondev

    iangregsondev

    Joined:
    Mar 30, 2018
    Posts:
    3
    Thanks, no problems with regards to Animations, I will just create my own Enum, this is what I was doing previously anyway.

    With regards to resources, yes I understand that these are always included in the build. Correct me if I am wrong, but it seems an ok situation to place the prefabs as these are dynamically added to the scene from script. Also understanding that (as far as I know), if you don't add the prefabs etc under the Resources directory then TypeSafe will not create a value for it - so then i would either need to revert to using my own Enum (or similar) OR back to magic strings.

    Trying to understand the trade-off here, but I think I am right in saying that if I am confident that something is going to be used in a scene / project then adding it to the resources is a PLUS because otherwise TypeSafe will "NOT" index it and create valid types for me.


    Thanks again
     
  45. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    Sure, there is no issue using Resources if you know the assets within are going to be used. You mention reverting back to using magic strings to load assets from outside Resources, but assets outside the Resources folder can only be loaded by referencing them from scenes or prefabs (by assigning in the inspector). (Unless, of course, you use the new Addressables system that Unity is developing).
     
  46. LuiBroDood

    LuiBroDood

    Joined:
    Mar 13, 2019
    Posts:
    84
    when I import TypeSafe into my project from Asset Store i get this still:
    , happens on import, and whenever I try to open the dialogs, Window>TypeSafe> both
    (Unity 2019.1.0f2)

    iam going to update to newest Unity and hope it works then,
    as above in this thread, it fixes if i remove version info and reimport, but thats really annoying to do :/ .. and Ive had it break seemingly randomly before, and had to do that again... :/


    2 Errors
    (Error messages from Flyingworm's EditorConsolePro Asset)
    [Exception] NullReferenceException: Object reference not set to an instance of an object
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    Embedded.get_BGLight() Assets/90 Plugins/StompyRobot/TypeSafe/Editor/Embedded.cs:91

    TypeSafeGUI.BeginDrawBackground() Assets/90 Plugins/StompyRobot/TypeSafe/Editor/Unity/TypeSafeGUI.cs:66

    SettingsWindow.OnGUI() Assets/90 Plugins/StompyRobot/TypeSafe/Editor/Unity/SettingsWindow.cs:29

    MonoMethod.Invoke() <1f0c1ef1ad524c38bbc5536809c46b48>:0

    MonoMethod.Invoke() <1f0c1ef1ad524c38bbc5536809c46b48>:0

    MethodBase.Invoke() <1f0c1ef1ad524c38bbc5536809c46b48>:0

    HostView.Invoke() C:/buildslave/unity/build/Editor/Mono/HostView.cs:345

    HostView.Invoke() C:/buildslave/unity/build/Editor/Mono/HostView.cs:339

    HostView.OldOnGUI() C:/buildslave/unity/build/Editor/Mono/HostView.cs:139

    IMGUIContainer.DoOnGUI() C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:278

    GUIUtility.ProcessEvent()




    [Exception] NullReferenceException: Object reference not set to an instance of an object
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    Embedded.get_BGLight() Assets/90 Plugins/StompyRobot/TypeSafe/Editor/Embedded.cs:91

    TypeSafeGUI.BeginDrawBackground() Assets/90 Plugins/StompyRobot/TypeSafe/Editor/Unity/TypeSafeGUI.cs:66

    SettingsWindow.OnGUI() Assets/90 Plugins/StompyRobot/TypeSafe/Editor/Unity/SettingsWindow.cs:29

    MonoMethod.Invoke() <1f0c1ef1ad524c38bbc5536809c46b48>:0

    MonoMethod.Invoke() <1f0c1ef1ad524c38bbc5536809c46b48>:0

    MethodBase.Invoke() <1f0c1ef1ad524c38bbc5536809c46b48>:0

    HostView.Invoke() C:/buildslave/unity/build/Editor/Mono/HostView.cs:345

    HostView.Invoke() C:/buildslave/unity/build/Editor/Mono/HostView.cs:339

    HostView.OldOnGUI() C:/buildslave/unity/build/Editor/Mono/HostView.cs:139

    IMGUIContainer.DoOnGUI() C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:295

    IMGUIContainer.HandleIMGUIEvent() C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:481

    IMGUIContainer.HandleIMGUIEvent() C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:455

    ImmediateRenderer.Draw() C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderers.cs:447

    UIRenderDevice.ContinueChain() C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderDevice.cs:841

    UIRenderDevice.DrawChain() C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderDevice.cs:824

    UIRRepaintUpdater.DrawChain() C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:218

    UIRRepaintUpdater.Update() C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:190

    VisualTreeUpdater.UpdateVisualTree() C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:70

    Panel.Repaint() C:/buildslave/unity/build/Modules/UIElements/Panel.cs:589

    UIElementsUtility.DoDispatch() C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240

    UIElementsUtility.ProcessEvent() C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78

    GUIUtility.ProcessEvent() C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179
     
    Last edited: Oct 12, 2019
  47. Clawiste

    Clawiste

    Joined:
    Aug 10, 2014
    Posts:
    1
    Hey,

    used TypeSafe for a bit, and so far I love it... though I have a question, is possible to reference Addressables/AssetReference? or is there a plan to add support for it?

    Thanks!
     
    Yanek likes this.
  48. TommyTheITGuy

    TommyTheITGuy

    Joined:
    Jun 11, 2015
    Posts:
    53
    Was looking to buy this, but you removed it from the store?
     
  49. LouisHong

    LouisHong

    Joined:
    Nov 11, 2014
    Posts:
    69
    As a user it was very cumbersome to use, every Resource folder change triggered a recompilation that freezes Unity. I would not recommend it anyways.
     
  50. ben-rasooli

    ben-rasooli

    Joined:
    May 1, 2014
    Posts:
    40
    You could simply disable the Rebuild Automatically option in the setting. It is a great asset and I'm assuming the developer is moving on to a new project and not having time to maintain this asset.