question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] `Create` button in variables create events as nested scriptable objects.

See original GitHub issue

Is your feature request related to a problem? Please describe. You can have multiple scriptable objects in the same asset file. Instead of having separate event scriptable objects, we can have events of every variable nested in that variable. image image

It will reduce the clutter of the project.

Describe the solution you’d like There is already a way to create an event scriptable object. Create button in the variable should create event nested in that variable.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
AdamRambergcommented, May 10, 2020

Thanks for this issue @mnarimani! I think this is a great idea.

We need to make sure that it is possible to both nest and un-nest Events to Variables. My thoughts on this:

  • Just default to always nest Events created via the Inspector.
  • If an Event is nested, add a button to un-nest the Event from the Variable.
  • If an Event is not nested to a Variable, then in the Event’s editor, add an ObjectField that takes a Variable + add a button to nest the Variable to the Event.
  • Name this feature either: “Create Molecule” or “Fuse / Diffuse”.

@mnarimani @soraphis What are your thoughts on my suggestions?


Furthermore, tested this myself using the following code snippet in AtomDrawer.cs:

try
{
    // Create asset
    T so = ScriptableObject.CreateInstance<T>();

    // Assign the newly created SO
    property.objectReferenceValue = so;

    if (property.GetParent() is AtomBaseVariable ab)
    {
        so.name = drawerData.NameOfNewAtom;
        AssetDatabase.AddObjectToAsset(so, ab);
        AssetDatabase.SaveAssets();
        AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(ab));
        AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(so));
        property.objectReferenceValue = so;
    }
    else
    {
        AssetDatabase.CreateAsset(so, "Assets/" + drawerData.NameOfNewAtom + ".asset");
        AssetDatabase.SaveAssets();
    }
}
catch
{
    Debug.LogError("Not able to create Atom");
}

The code above is not 100%, but it covers the case of ensuring that the target is a Variable (might be a problem with Constants).

0reactions
tarragonflycommented, Apr 4, 2021

This would be amazing to have. +1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scriptable Objects workflow
In this thread I want to discuss how we would work with ScriptableObjects and create architectures using them.
Read more >
Nested Scriptable Object Attributes (Field and List)
Selecting a dropdown value creates a new ScriptableObject asset as a nested subasset of the root ScriptableObject. They also each provide a 'Remove'...
Read more >
Unity Nested Scriptable Objects - Tutorial - YouTube
In this video we will look how to make Nested Scriptable Objects. ➤Git - https://github.com/KasperGameDev/ Nested - Scriptable - Objects -Example ...
Read more >
Scriptable Objects in Unity (how and when to use them)
Learn how to use Scriptable Objects in Unity to manage your game's data and make building your game easier, in my complete beginner's...
Read more >
[FEATURE] Adding variables to Event Listeners requires ...
Create an Event Listener of any type. Change its Event Reference to be a Variable; Create a new variable with the "create" button....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found