Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Kangaru · Feb 03, 2017 at 08:53 PM · buildscriptableobjectresourceschild objectresources.loadall

Resource.LoadAll Not Working On Child Assets In Stand Alone Build

I'm attempting to make a quest/objective system using ScriptableObjects and it's working in the Unity Editor but not in a build. I have a Quest object that I create than give it objectives and rewards, which the quest object keeps reference to in two seperate lists. These objectives and rewards are also scriptable objects and are childed to the quest object when they're made.

Now the problem. I have a QuestBoard object which has a list of quests that it can give to the player. When the player attempts to get a quest, it works in the Unity Editor, but not in a stand alone build.

From debugging build I've found that the Quests that the QuestBoard has a list for, have empty lists for their rewards and objectives, yet they still contain their proper names(string). So I believe it's finding the quest asset but not the children. But I'm confused why the editor can use the same code and get all the assets.

Here's how I'm trying to load the quests from the 'Resource/Quest' folder, 'Resource/Quest' is included in the passed in string

 public static Quest LoadQuest(string questPath)
     {        
         Object[] assets = Resources.LoadAll(questPath) as Object[]; //assets.length = 1 (In build) //so it's only loading the quest asset, no reward/objective children
         Quest quest = CreateInstance<Quest>();
         List<QuestReward> rewards = new List<QuestReward>();
         List<QuestObjective> objectives = new List<QuestObjective>();
 
         foreach (Object asset in assets)
         {
             if (asset is QuestObjective)
             {
                 objectives.Add(asset as QuestObjective);
             }
             else if (asset is QuestReward)
             {
                 rewards.Add(asset as QuestReward);
             }
             else if (asset is Quest)
             {
                 quest = asset as Quest; //Get the quest
             }
         }
         quest.objectives = objectives; //Add objectives to quest
         quest.rewards = rewards; //Add rewards to quest
         return quest;
     }


Would the children assets be excluded from the build because the list of quest references containing references to the objectives/rewards isn't enough? Any help, suggestions for a fix or alternative method would be greatly appreciated.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image estevan95 · Feb 04, 2017 at 02:11 AM 0
Share

The correct path string is probably different from Editor and Stand Alone Build. $$anonymous$$aybe this helps: https://docs.unity3d.com/ScriptReference/Application-dataPath.html

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Stuck while building for Android - Compiling Resources | Repackages Resources 1 Answer

Resource folder doesn't build. Why is it empty? 1 Answer

Why these files get built ? 1 Answer

resources not loadable in bulid 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges