Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting group assets override from script when using multiple assets #103

Open
qlee01 opened this issue Sep 18, 2024 · 0 comments
Open

Setting group assets override from script when using multiple assets #103

qlee01 opened this issue Sep 18, 2024 · 0 comments

Comments

@qlee01
Copy link

qlee01 commented Sep 18, 2024

Hey, I am currently not able to change group overrides from script if multiple assets are loaded (actually I can change override for the first group, but not for later ones). If only one asset is loaded all works without issues. Also it works completely fine in the GUI with multiple assets.

This is how I am doing the override now (maybe there is a better / more correct way?):

List<GroupAssetReference> groupAssetReferences = hairInstance.strandGroupSettings[0].groupAssetReferences;
groupAssetReferences.Clear();
//strandBasedHairProfileOverride.groups stores the groups to be selected to override
foreach (int groupIndex in strandBasedHairProfileOverride.groups)
{
    GroupAssetReference groupAssetReference = new GroupAssetReference();
    groupAssetReference.hairAssetGroupIndex = groupIndex;
    //not sure about this one here: tried both, always assigning the main asset, or assigning the other assets
    groupAssetReference.hairAsset = groupIndex==1 && prefab1!=null ? prefab1  : groupIndex==2 && prefab2!=null? prefab2 :  prefab0
    
    groupAssetReferences.Add(groupAssetReference);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant