Coder Social home page Coder Social logo

Lists about assetpathattribute HOT 14 CLOSED

nanof avatar nanof commented on July 25, 2024
Lists

from assetpathattribute.

Comments (14)

ByronMayne avatar ByronMayne commented on July 25, 2024 1

No problem!

from assetpathattribute.

ByronMayne avatar ByronMayne commented on July 25, 2024

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.

nanof avatar nanof commented on July 25, 2024

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.

captura

Cheers
Nanof

from assetpathattribute.

ByronMayne avatar ByronMayne commented on July 25, 2024

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.

nanof avatar nanof commented on July 25, 2024

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.

ByronMayne avatar ByronMayne commented on July 25, 2024

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.

ByronMayne avatar ByronMayne commented on July 25, 2024

It should not be a big deal to fix but I will have to install 2018.1.

from assetpathattribute.

nanof avatar nanof commented on July 25, 2024

Ah, that should explain the weird behavior, thanks Byron!

from assetpathattribute.

ByronMayne avatar ByronMayne commented on July 25, 2024

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.

nanof avatar nanof commented on July 25, 2024

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.

ByronMayne avatar ByronMayne commented on July 25, 2024

Yeah I avoid using Odin myself.
Could you tell me what property.propertyType evaluates too in your code?

from assetpathattribute.

nanof avatar nanof commented on July 25, 2024

It's "Generic", I post the complete content of a property

captura de pantalla 1

from assetpathattribute.

ByronMayne avatar ByronMayne commented on July 25, 2024

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.

nanof avatar nanof commented on July 25, 2024

Unfortunately it's not working :(

from assetpathattribute.

Related Issues (4)

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.