-1
\$\begingroup\$

I want to add resource to an inspector directly which could be done by drag and drop resource to the inspector. However, I want to know if there's a programmatic way to do this so, I will not need to add it hand by hand to perform a better performance than Resource.Load()

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Look into custom editors. They should be able to do what you want. \$\endgroup\$
    – Ben
    Jun 29, 2015 at 5:02

1 Answer 1

0
\$\begingroup\$

As Ben's suggestion, help me to found an answer.

  1. Mark [ExecuteInEditMode] on top of the Monobehavior class that I need to assign var to.
  2. Use AssetDatabase.LoadAssetAtPath to load the resource I need into variable type that I want.
  3. Save scene.
  4. Remove script that add recently if you don't need it in production.
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .