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

Support for AudioClips that can be played when double-clicking on an asset #44

Open
Fydar opened this issue Jun 22, 2021 · 0 comments
Open
Assignees
Labels
✨ enhancement New feature or request

Comments

@Fydar
Copy link
Owner

Fydar commented Jun 22, 2021

When a ScriptableObject asset that has either:

  • An [AssetIcon] attribute is on a member that returns an AudioClip.
  • An [AssetIcon] attribute is on a method that accepts an IAssetPreview as a parameter.

And when:

  • The user double-clicks the ScriptableObject asset.
  • The user right-clicks the ScriptableObject asset and selects 'Open'.
  • The user selects the ScriptableObject asset and presses return.

The action associated with the ScriptableObject is invoked.

Playing an AudioClip should also be configurable. Every play of the AudioClip should allow the user to vary the following:

  • The volume of the AudioClip.
  • The pitch of the AudioClip.
  • How long the AudioClip should be played.

Examples

An AudioClip should be quickly and easily associated with the ScriptableObject.

using AssetIcons;
using UnityEngine;

[CreateAssetMenu]
public class ItemInformation : ScriptableObject
{
    [AssetIcon]
    public AudioClip PickupSound;
}

An IAssetPreview should be used to allow the user to have more control over how the ScriptableObject icon is previewed.

using AssetIcons;
using UnityEngine;

[CreateAssetMenu]
public class ItemInformation : ScriptableObject
{
    public AudioClip PickupSound;

    [AssetIcon]
    public void OnPreviewAsset(IAssetPreview assetPreview)
    {
        assetPreview.PlaySound(PickupSound, 0.5f, 0.95f);
    }
}
@Fydar Fydar added the ✨ enhancement New feature or request label Jun 22, 2021
@Fydar Fydar self-assigned this Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant