Profile Picture

Unity Auto Setup

Posted By Victor.Soupday 3 Years Ago
Rated 5 stars based on 11 votes.
Author
Message
Victor.Soupday
Victor.Soupday
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)

Group: Forum Members
Last Active: 1 hour ago
Posts: 556, Visits: 8.3K
felgryn (7/25/2023)
Hello,
When i start a new scene or save content, sometimes this triggers a reloading of Unity Setup shaders, even though no changes have been made to the scene.
I also see this reload occur when i am editing another scene with no Unity Setup content - but it nonetheless triggers a reload.
This can sometimes take up to a minute for each event - and these occur very frequently across working sessions and has slowed down development. Is anyone else seeing this frequent reload triggered by unrelated scenes and are there any settings/workflows we should consider to avoid the reload?



Configuration is:
  • Unity 2021.3.4f1
  • HDRP 12.1.7
  • CC/iC Unity Tools HDRP 1.3.8



Is the character import window still open when it does this?

The window holds onto a reference to the currently selected character and materials, it could be recompiling shaders for it when the scene lighting changes, even though it's not technically in the scene.

Closing the importer window should release the character data and could/should stop it recompiling the shaders.
j_a_booth
j_a_booth
Posted Last Year
View Quick Profile
New Member

New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)

Group: Forum Members
Last Active: 4 Months Ago
Posts: 3, Visits: 9
Victor.Soupday (7/26/2023)
j_a_booth (7/20/2023)
I started a clean new project in Unity 2022.3.5f1 LTS, imported the unity auto set up. Imported a character fromCC4, And I got a warning of a memory leak. It said to do something with a cmd line command or something to find out more, but I haven't figured out how to do that. I did all this because I had this happen in my ongoing game project and narrowed it down to this being the problem. Any kind of help would be appreciated, Whether it be how to solve the memory leak or how to do the cmd command.


Seems to be related to the generation of the default animator controller for the character. Later versions of Unity don't like it (or don't like the way it is added to the prefab) and it causes this memory leak whenever Unity tries to load it or look at it.

Deleting the generated animator controller will stop the warning, but only after Unity is restarted. Once the memory leak happens Unity complains about it non-stop until it's restarted.


Thanks for the reply, I'll try deleting it and restarting then.

felgryn
felgryn
Posted Last Year
View Quick Profile
Senior Member

Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 15, Visits: 331
Hi Victor, 

 Many thanks for the quick reply! I think the importer window is open, that would explain this. I'll try closing next time this crops up. Many thanks!

 Cheers!

P.S. love these tools! Amazingly realistic characters in Unity - especially with HDRP!
felgryn
felgryn
Posted Last Year
View Quick Profile
Senior Member

Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)Senior Member (323 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 15, Visits: 331
Hey Unity Auto SetUp Fans!

 Just wanted to share a clip that shows the hair physics you can get in Unity >out of the box< with Unity Auto Setup 1.50 for HDRP and available settings. This is using a CC4 avatar with elements from hair builder. The cloth physics components that Soupday automatically adds creates this. I thought i would have to go into blender and add bones and do more detail - but being able to have this as a baseline is very impressive.

https://drive.google.com/file/d/1X7559MHrukTQgt5G-2xyy_eFXpBIfZUe/view?usp=drive_link

Edited
Last Year by felgryn
jmi3
jmi3
Posted Last Year
View Quick Profile
New Member

New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 5, Visits: 35
I have a support ticket and Rampa wants me to ask about it in here. I can't use the unity cc4 addon because my developers don't want to use up the extra space in unity just for a character importer. I do have an issue though. When I export the character from CC4 to Unity export I get a -90 rotation. Is there any way to get this to come in without the rotation???https://forum.reallusion.com/uploads/images/3a0af313-b68a-4b05-bf63-1c96.png
Victor.Soupday
Victor.Soupday
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)

Group: Forum Members
Last Active: 1 hour ago
Posts: 556, Visits: 8.3K
Unity Auto-setup Release 1.5.1

Built-in (Unity 3D): https://github.com/soupday/cc_unity_tools_3D/releases
URP: https://github.com/soupday/cc_unity_tools_URP/releases
HDRP: https://github.com/soupday/cc_unity_tools_HDRP/releases

Documentation
: https://soupday.github.io/cc_unity_tools/
Full install instructions here: https://soupday.github.io/cc_unity_tools/installation.html#

Changelog:
1.5.1
  • Character Build no longer creates and adds a default animation controller due to bugs in Unity 2022/2023 causing memory leaks when applying animation controllers to prefabs.
  • Instalod and other renamed object/material name matching improvements.
  • Cloth physics fix for extracted non physics materials using 2-pass hair.
  • Shaders recompiled for URP10/12/15.
1.5.0
  • Animation player system rebuilt to remove AnimationMode and operate in play mode (in Editor).
    • New system includes foot IK preview, variable speed and camera bone targeting and play mode operation.
  • Optional (WIP) HDRP dual specular shader added for HQ skin. (Enabled in the import window options)
  • HDRP mask detail mask correction. (Export from CC4 not using correct micro normal mask)
  • HDRP lighting fix when first loading preview scene.
  • Batch processing window added.
  • Physics sphere collider support added.
  • Import procedure now processes all <character_name>_Motion.Fbx files with the character.
  • Fix to character build crash in Unity 2023.1
  • Fix to Diffusion profiles not saving to default volume asset in 2023.1.
dan.goyette
dan.goyette
Posted Last Year
View Quick Profile
Veteran Member

Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)

Group: Forum Members
Last Active: 4 Months Ago
Posts: 83, Visits: 379
One small feature request: It would be nice if AnimRetargetGUI.WriteAnimationToAssetDatabase would update existing animations, instead of recreating them. The reason is: If something is referencing the animation already, and I re-import the model, the Animation Clip gets deleted and recreated, and the reference gets lost. I tried this modification, where it just checks if there's already a file exactly matching the path, and if so, loads and sets that value. I believe this all works fine, and preserves references to the Animation clip when used:


AnimationClip asset = AssetDatabase.LoadAssetAtPath<AnimationClip>(assetPath);

            if (asset == null)

            {

                // New

                Util.LogInfo("Writing New Asset: " + assetPath);

                AssetDatabase.CreateAsset(outputClip, assetPath);

            }

            else

            {

                Util.LogInfo("Updating Existing Asset: " + assetPath);

                outputClip.name = asset.name;

                EditorUtility.CopySerialized(outputClip, asset);

                AssetDatabase.SaveAssets();

            }



EDIT: It looks like under 1.5.1, the Prefab object (which gets saved to the Prefabs dir) gets recreated every time the import is run, which breaks references to it. Specifically, the FileID of the prefab changes, so things that reference the Prefab (such as the Slate sequencer) lose references. This appears to be due to a change in Importer.cs since 1.4.9:

// Unity 2023.1 crashes if saving a new instance over an existing prefab, so delete it first

bool assetExists = Util.AssetPathExists(prefabPath);

if (assetExists)

{

   AssetDatabase.DeleteAsset(prefabPath);

   AssetDatabase.Refresh();

}


I appreciate trying to avoid crashes, but the impact of the prefab getting deleted every time I update a character, and losing all references to it, is pretty catastrophic in a project. Maybe there's some other way to avoid the crash that doesn't delete the prefab? In any case, I'm on Unity 2021 LTS, and if I simply comment out that code the importer runs fine without crashing, and I don't lose prefab references.
Edited
Last Year by dan.goyette
dan.goyette
dan.goyette
Posted Last Year
View Quick Profile
Veteran Member

Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)Veteran Member (719 reputation)

Group: Forum Members
Last Active: 4 Months Ago
Posts: 83, Visits: 379
A couple of things I noticed when updating from 1.4.9 to 1.5.1:

First, RL.cs contains the following statement, which doesn't compile:

using Codice.Client.Common;


Commenting it out fixes the issue (that library wasn't actually being used it seems), but I assume this will break things for people who can't easily edit the source.

Second, I tried out the new feature that imports animations from the _Motion.fbx. However, it seems like this only importing the Humanoid animation properties, but none of the Blendshapes. 

For example, if I export an FBX that contains both the Model and the animations, the importer will correctly create Animation Clips with all the blend shape values for all the model's SMRs. But if I export the FBX to put the animations into a _Motion.fbx file, the importer creates all of the correct Animation Clips, but the clips don't have any blend shapes in them.

Thanks for a really impressive tool, by the way. It's really made using CC4 in my project easier then I expected. 
Edited
Last Year by dan.goyette
Victor.Soupday
Victor.Soupday
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)

Group: Forum Members
Last Active: 1 hour ago
Posts: 556, Visits: 8.3K
Unity Auto-setup Release 1.5.2

Built-in (Unity 3D): https://github.com/soupday/cc_unity_tools_3D/releases
URP: https://github.com/soupday/cc_unity_tools_URP/releases
HDRP: https://github.com/soupday/cc_unity_tools_HDRP/releases

Documentation
: https://soupday.github.io/cc_unity_tools/
Full install instructions here: https://soupday.github.io/cc_unity_tools/installation.html#

Changelog:
1.5.2
  • Animation Retargeter fixes.
    • AnimationMode removed.
    • Clip generation file name suffix corrected.
    • Animation Clip overwrite no longer breaks references.
    • Clip settings (foot IK, mirror, speed) reset to defaults on opening retarget window.
  • Character prefab generation no longer breaks references. (Except 2023.1.1-5 due to Unity bugs)
  • Rogue usings removed from code.
  • Animation processing fixes.
    • Correct character prefab used to retarget _motion.fbx files.
    • Animation Clip overwrite no longer breaks references.
Edited
Last Year by Victor.Soupday
Victor.Soupday
Victor.Soupday
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)Distinguished Member (5.6K reputation)

Group: Forum Members
Last Active: 1 hour ago
Posts: 556, Visits: 8.3K
dan.goyette (7/31/2023)
One small feature request: It would be nice if AnimRetargetGUI.WriteAnimationToAssetDatabase would update existing animations, instead of recreating them. The reason is: If something is referencing the animation already, and I re-import the model, the Animation Clip gets deleted and recreated, and the reference gets lost. I tried this modification, where it just checks if there's already a file exactly matching the path, and if so, loads and sets that value. I believe this all works fine, and preserves references to the Animation clip when used:


AnimationClip asset = AssetDatabase.LoadAssetAtPath<AnimationClip>(assetPath);

            if (asset == null)

            {

                // New

                Util.LogInfo("Writing New Asset: " + assetPath);

                AssetDatabase.CreateAsset(outputClip, assetPath);

            }

            else

            {

                Util.LogInfo("Updating Existing Asset: " + assetPath);

                outputClip.name = asset.name;

                EditorUtility.CopySerialized(outputClip, asset);

                AssetDatabase.SaveAssets();

            }




Seems to be a new "feature" that slipped past me, generating new guids when overwriting some assets. This helps a lot.


EDIT: It looks like under 1.5.1, the Prefab object (which gets saved to the Prefabs dir) gets recreated every time the import is run, which breaks references to it. Specifically, the FileID of the prefab changes, so things that reference the Prefab (such as the Slate sequencer) lose references. This appears to be due to a change in Importer.cs since 1.4.9:

// Unity 2023.1 crashes if saving a new instance over an existing prefab, so delete it first

bool assetExists = Util.AssetPathExists(prefabPath);

if (assetExists)

{

   AssetDatabase.DeleteAsset(prefabPath);

   AssetDatabase.Refresh();

}


I appreciate trying to avoid crashes, but the impact of the prefab getting deleted every time I update a character, and losing all references to it, is pretty catastrophic in a project. Maybe there's some other way to avoid the crash that doesn't delete the prefab? In any case, I'm on Unity 2021 LTS, and if I simply comment out that code the importer runs fine without crashing, and I don't lose prefab references.


This particular Unity bug has been fixed in 2023.1.6, so only 2023.1.1 to 2023.1.5 will now recreate the prefab completely. Everything else overwrites safely now.

There were a few other bugs in the animation processing, see if the _motion files retarget all the blend shapes correctly now.
Edited
Last Year by Victor.Soupday



Reading This Topic