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

Question about usage with ScriptableObjects #1

Open
MostHated opened this issue Dec 22, 2022 · 1 comment
Open

Question about usage with ScriptableObjects #1

MostHated opened this issue Dec 22, 2022 · 1 comment

Comments

@MostHated
Copy link

Hey there,
I was just wondering if this package happened to handle ScriptableObject asset names out of the box?

Example:

public class BaseObject : ScriptableObject {}

public class ObjectTypeA : BaseObject {}
public class ObjectTypeB : BaseObject {}

// Where the following 
MyObjectA.asset == typeof(ObjectTypeA)
MyAdditionalObjectB.asset == typeof(ObjectTypeB)

What I am looking for is a way to easily have the names "MyObjectA" and "MyAdditionalObjectB" be generated as type-safe code.
I tried to look through the docs for "ScriptableObject" to see if it specifically had a section or notes on that, but I did not see anything.

Thanks,
-MH

@Simie
Copy link
Member

Simie commented Dec 31, 2022

In what way do you mean "handle"? There's no generation for anything unless it's a resource or part of a data source. I'm not sure what your use case is for needing to generate the name.

If you are talking about resources...

public static bool GetAssetType(string assetPath, out Type type, out TypeSource source)

The code for determining an asset type does load the asset and call GetType() on it, so in theory it should be the concrete type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants