Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

walkingsolutions

10
Posts
1
Topics
A member registered Oct 08, 2018

Recent community posts

(1 edit)

Ok i have a working mass object pivot centering but the problem is more involved, there's a lot of really badly designed workflows in Unity which prohibit automation/mass execution, they've done a lot to reduce it but the ghosts are still in there and i wouldn't feel comfortable asking people to go through separate steps, would rather have in a discrete scripted workflow, so i'll have to build an explicit splitter to create the assets and materials so it acts sort of like a tile splitter but for 3d objects. But so far this manual workflow is much faster now, i can export all the objects from a single bulk model with an array of submeshes then use my mesh remapper to set the pivots then your prefab tool and then alter materials, but what would be awesome would be a pallet selector for materials, so you dont just select a model you select geometry and a material, defaulting to the original material. I also need to look at ray casting edge snapping for objects that don't conform to grid, but conform to other models, like pipes etc.

lol ok :)  probably best i just write the code and send it to you :)

normal delete works fine, so you must mean something else. im using unity 2019.2.0b9

that sounds scary, I've only just started using this and haven't deleted anything yet lol, I'll test this in a sec and see what happens.

Here's an old script illustrating how a mesh can be recalculated/rebounded, i'll add this into the system shortly.

https://wiki.unity3d.com/index.php/SetPivot

Error below, i looked at the code thinking this was the cause of blank images but as i played with the system further i realised it's because submesh model generation leaves the mesh bounds unchecked so really you just need to recalc bounds when importing, so that was next on my list of things to do.

Your code is just cleaning up some temp data but the method throws the Denied, because you're trying to delete a dir and my guess is those things are currently open by the engine etc, and for a couple of years now Unity has strongly recommended you don't write to the local project dir because of permission issues with Windows, now personally in my projects i _do_ but that's because i know how to set windows permissions and how to write code that doesn't invoke problems like this, which was a long trial/horror thing :)  for one thing don't shortcut file cleanup with a request to delete the entire directory and re-create it, a permission / security model will absolutely scream about that because it's massively aggressive, and specifically with the recursive flag, that's the sort of stuff that requires root administrator privs in any system because it can destroy an entire o/s partition in no time at all, what if the dir contains a broken link to the root? maybe a symlink won't do that but what about junctures or the 6 other types of low level system links? what about system links that don't exist yet? it's a fairly remote chance but the outcome is apocalyptic so that makes it mad high risk :)  and it's a design approach problem anyway so you don't even need that risk, a better option is to manage state caches, don't delete anything because you're forcing a rebuild and discarding "progress", which is wasteful, just manage what you're displaying and manage a cache queue so if something changes then invalidate that particular item and pick it up in your rebuild schedule.  So it does create thumbs anyway, it just doesn't orient the models so in my case they're miles from origin on this kitbash set and since most kitbashes come in this form i'm looking at coming up with a splitting system to handle this.

Also unity has some standard paths you can use for this sort of thing, StreamingAssets is where you write stuff like this, or the user path, I can understand why you wouldn't want to use the user path, that's the dumbest thing that has emerged from game development, as if a users profile capacity is infinite and that you want 5 gigs of save files per game to occupy your high priority offsite DR/backup schemes.

Here's your code that emits the error;
string paletteImagePath = MAST_Asset_Loader.GetMASTRootFolder() + "/Etc/Temp";
if (Directory.Exists(paletteImagePath)) { Directory.Delete(paletteImagePath, true); }
Directory.CreateDirectory(paletteImagePath)

then it's onto extending that interface,  I need all objects at all times :) I mean this is literally Unity's problem, horrific navigation systems, so if i have to use those same nav systems to locate my resources to put into your wonderful interface - it's just adding an extra step in an already nightmarish navigation hell, so i'll see what i can do and then ship the code over to you :) May need to modify the UI resizing code a bit, the most sensible setup for me is a vertical list snapped to the left, but the buttons resize too big and occupy a heap of screen real estate when you do that so i'll take the minimalist approach if i can and see about snapping those to mini icons by user interaction (usually the << icon)


The error (and note, i have given this dir all permissions available, admin/root with full management (similar to grant/super etc, the max possible) so that usually means it's a lock, and verifying just now that dir is locked. So the delete/create usage probably just locked the file node for that dir (but Unity can still see the content, oddly):

UnauthorizedAccessException: Access to the path "Assets\FSP\MAST/Etc/Temp" is denied.
System.IO.Directory.CreateDirectoriesInternal (System.String path) (at <a8ed250850854b439cedc18931a314fe>:0)
System.IO.Directory.CreateDirectory (System.String path) (at <a8ed250850854b439cedc18931a314fe>:0)
MAST_Interface_State_Save.Save_Palette_State (System.Boolean forceSave) (at Assets/FSP/MAST/Scripts/Interface/MAST_Interface_State_Save.cs:46)
MAST_Interface.DisplayToolbarGUI () (at Assets/FSP/MAST/Scripts/Interface/MAST_Interface.cs:876)
MAST_Interface.OnGUI () (at Assets/FSP/MAST/Scripts/Interface/MAST_Interface.cs:615)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <a8ed250850854b439cedc18931a314fe>: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 <a8ed250850854b439cedc18931a314fe>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <a8ed250850854b439cedc18931a314fe>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:337)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:331)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:307)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:373)
UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:340)
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:298)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:483)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:466)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:447)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/Events/MouseCaptureDispatchingStrategy.cs:93)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:280)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:156)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:190)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:255)
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)

Confirmed, the thumbnail issue is related to mesh bounds, so we can run a meshbounds check and inverse scale the mode, easy :) also found a bunch of disk write errors  that i thought were the cause for problems, but it's actually just you doing some maintenance on a null ref, and it's not actually causing any problems at all., it just happens to throw errors around the same time other things are breaking  :) 

I thought that might be it but haven't slept in a while so my  brain is falling over,  thanks Keith! :)

When trying to add the script to prefabs and add them to the selection panel they end up being transparent. Checked the logs and can see it Throws a permissions error regarding writing the png files, despite granting all possible perms to Unity and the system authenticated user. Permissions don't actually seem to be it's problem, as i was trying several approaches to see if one would give before i tried pulling apart the code - and it seems when you CONVERT mesh's to Prefabs and THEN import t hem it all works well, so whatever failing we have in the add script phase it's avoided in the full Mesh > Prefab > Scripted > Selection Panel.  Unity 2019.2.0b9 (project dedicated to testing this potentially mind blowing tool)  :P

This is an awesome project, I had started writing one of these myself to handle modular/uniform data, voxels, kitbash, greebles etc, as Unity's interface drives me mental, but  this is a strong solution. I'd like to extend this if that's ok, I can setup a repo and grant you admin privs so you can integrate downstream extensions?  Another thing, how did you make the interface so sexy? not even Unity Tech themselves can manage that.  In almost 8 years and 1500 assets yours is the best looking editor asset i've come across. :)