Hi RainyRizzle,
I hope you are fine!
I want to get the following value from the script as bool value.
I found a workaround but I appericate if there's a native solution.
My Solution:
Adding _PlayOnce endfix to animation clip.
3. Use the following code:
// Check if the animation is not looped
private bool CheckIfNotLooped(string animClipName)
{
// You could use a dictionary or other logic to check if the animation should not loop
return animClipName.Contains("_PlayOnce");
}
Thanks in advance!
Hi! I found the native solution. There was IsLoop variable.
Code example:
private bool IsAnimLooped(int portraitIndex, string animClipName) { var portrait = portraits[portraitIndex]; if (portrait == null) return false; // Find the animation clip by name var animClip = portrait._animClips.Find(clip => clip._name == animClipName); if (animClip != null) { bool IsLooped = animClip.IsLoop; if (IsLooped) { Debug.LogWarning($"Animation clip '{animClipName}' is looped"); } else { Debug.LogWarning($"Animation clip '{animClipName}' is not looped."); } return IsLooped; } // If animation clip is not found, return 0 Debug.LogWarning($"Animation clip '{animClipName}' not found in portrait {portrait.name}."); return false; /* // You could use a dictionary or other logic to check if the animation should loop if (animClipName.Contains("_PlayOnce")) { return false; } else { return true; } */ }
Thank you!
Hi!
Sorry for the late reply.
In the meantime, you found the answer.
Yes, you can use the IsLoop property of apAnimClip to find out whether the animation is looped or not.
We have integrated the answer to this into another post you recently made.
Please check the answer in that post as well.