Code Monkey home page Code Monkey logo

Comments (4)

AdamRamberg avatar AdamRamberg commented on May 31, 2024

Great idea! I think that just adding the postfix "Changed" to the Event as the default name will suffice for now or what do you think @mutmedia? The tricky part implementing this would be to get the parent of of the SerializedProperty in the AtomDrawer. You would then use the name of the parent Atom (if there is one) + the name of the property of the Atom you are creating. Eg: if you have a Variable called MyVariable and you click Create for the Changed event of that Variable the default name would be MyVariableChanged.

from unity-atoms.

soraphis avatar soraphis commented on May 31, 2024

(untested):
in the event drawer, you can get property.serializedObject.Name which should yield the Scripts's name or the scriptableObjects's asset name.

and of course you could get the property.Name to get the variable name itself.


scenario 1: you're in an IntVariable AtomVariable named "fooBar" you click "create" for the "changed" event of type IntEvent.

scenario 2: you're on an GameObject Player in a Script named Health you click "create" for the "reachedZero" event of type BoolEvent.

pattern scenario 1 scenario 2
<parent>On<Event> IntVariableOnChanged HealthOnReachedZero
<parent>Changed IntVariableChanged HealthChanged
<object name>Changed fooBarChanged PlayerChanged
<object name><parent>Changed IntVariablefooBarChanged PlayerHealthChanged
<object name><parent>On<Event> IntVariablefooBarOnChanged PlayerHealthOnReachedZero

from unity-atoms.

AdamRamberg avatar AdamRamberg commented on May 31, 2024

I think pattern 3 (row 3) works best for scenario 1, however it isn't great for scenario 2. Maybe we could via reflection see if the parent is an Atom Variable or not? If it is we use the <object name>Changed pattern, otherwise we just default to AtomEvent or maybe <property name>?

from unity-atoms.

AdamRamberg avatar AdamRamberg commented on May 31, 2024

Fixed in #317

from unity-atoms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.