Comments (14)
No problem!
from assetpathattribute.
Hey Nanof,
AssetPathAttribute
does currently support generic list. The following does work
[AssetPath.Attribute(typeof(GameObject))]
public List<string> m_Players;
Cheers,
Byron
from assetpathattribute.
Hi Byron,
that's what I tried but it seems it's not working for me, when I declare the List I get in the inspector "Attribute invalid for type List 1" and it's not possible to drag and drop any prefab.
Cheers
Nanof
from assetpathattribute.
Hey Nanof,
Asset Path Attribute is just a fancy inspector for string fields. You are seeing that because your code most likely looks like the following.
[AssetPath(typeof(Object)]
public List<GameObject> m_Players;
You need to make sure it's the following
[AssetPath(typeof(Object)]
public List<string> m_Players;
If you have a list of GameObjects there is no point of using AssetPathAttribute because you are using a hard reference.
from assetpathattribute.
I have this
[AssetPath.Attribute(typeof(Object))] public List<string> myList;
and really it's not working :(
I'm in Unity 2018.1
from assetpathattribute.
Hmmm,
It looks like in 2018.1 property.propertyType != SerializedPropertyType.String
is false for List<string>
. which is weird. Any who I will try to take a look when I get home.
from assetpathattribute.
It should not be a big deal to fix but I will have to install 2018.1.
from assetpathattribute.
Ah, that should explain the weird behavior, thanks Byron!
from assetpathattribute.
Hey Nanof,
What is the exact version you are using? In 2018.1.0f2
it works fine with the code copied pasted.
Thanks,
Byron
from assetpathattribute.
Ok I've discovered that the problem is related to having Odin Inspector plugin installed in the project, it seems that its serialization system is colliding with AssetPath, don´t know if is something that could be "fixed" or they are just incompatible
from assetpathattribute.
Yeah I avoid using Odin myself.
Could you tell me what property.propertyType
evaluates too in your code?
from assetpathattribute.
It's "Generic", I post the complete content of a property
from assetpathattribute.
Hey,
Could you change the line
if (property.propertyType != SerializedPropertyType.String)
to
if (property.propertyType != SerializedPropertyType.String || (property.isArray && property.arrayElementType == "string"))
From there if that works it's not a big deal to create a workaround. However if the drawer is not functionally that is a bigger issue.
from assetpathattribute.
Unfortunately it's not working :(
from assetpathattribute.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assetpathattribute.