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

[FEATURE] More public get-properties for fields #428

Open
2 of 6 tasks
soraphis opened this issue Aug 28, 2023 · 2 comments
Open
2 of 6 tasks

[FEATURE] More public get-properties for fields #428

soraphis opened this issue Aug 28, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@soraphis
Copy link
Collaborator

soraphis commented Aug 28, 2023

Is your feature request related to a problem? Please describe.
Currently it's sometimes hard to write own tools or editor scripts (or even own components) that work with atoms, because a lot of fields are private only and have no public getter property.

Describe alternatives you've considered
Reflection is currently the only alternative

Additional context

Event References

  • getter for _usage
  • getter for _event, _variable, _eventInstancer, _variableInstancer - name the getter: "InternalEvent"/"InternalVariable"/... to make it clear that you're accessing inner workings.
  • bool IsUnassigned property that returns whether or not the _variable/_event/... is assigned.

AtomReference

  • getter for _usage
  • getter for _constant, _variable, _variableInstancer - name the getter: "InternalEvent"/"InternalVariable"/... to make it clear that you're accessing inner workings.
  • bool IsUnassigned

TODO check instancers and listeners for hidden private fields, that might come in handy for users.

mark those getters/method with the UnstableApiAttribute.

/// <summary>
/// Custom attribute to mark methods, properties, or fields that are not part of the stable API.
/// They can change or being removed entirely even in minor or patch releases.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, 
                Inherited = false, AllowMultiple = false)]
public class UnstableApiAttribute : Attribute
{
    /// <summary>
    /// Initializes a new instance of the <see cref="UnstableApiAttribute"/> class.
    /// </summary>
    public UnstableApiAttribute()
    {
        // Constructor logic, if needed
    }
}
@soraphis soraphis added the enhancement New feature or request label Aug 28, 2023
@mgmhunt
Copy link

mgmhunt commented Sep 4, 2023

Just encountering this same problem - with Input System Interpreters. Have had to edit the package directly to add some public properties to "CallbackContextInterpreter.cs" so I can set the input phase events programmatically.

@mgmhunt
Copy link

mgmhunt commented Sep 15, 2023

"check instancers and listeners for hidden private fields" - a setter for Base for Instancers at runtime to swap out prefab generated. I've added a setter so I can initialise the template prefab values at setup.

FYI Use Case: rather than having the data inside project SO's, I've setup an import from BakingSheets (ie Google Sheets) that generates the Atom SO's and wires them up on import - so can adjust and inspect data/events and observables are created at runtime but a bunch of Atom SO's are auto generated from spreadsheet. Instancers represent the DB Row prefab values... ie a table of monster archetypes for example, where each row then gets translated to a Prefab with Instancers for the monster properties. Instances of the prefab then have values based on the initial spreadsheet values. So the Base should represent the value imported from the spreadsheet and is set in code, not via Inspector.

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

2 participants