Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 BazLevelUp · Jul 30, 2012 at 09:35 AM · iosprefabbuildlink

Breaking Links intentionally at Build

Hi people !

I have finished my iOS game using Unity, and now I need to make a Lite/Free version for the AppStore. There are somes changes to make, in the projet in order to switch from Lite to Full, and it would really be a pain in the ass to do it manually every time.

I have 2 or 3 scripts in the scene which link to the current background and music and so on, depending on the level currently played. But as you would have guessed, in my Free version there is only 1 bg, 1 music, etc...

If I keep the others bgs & musics linked to that prefab, all those heavy assets will be added to the app and my Free version will be the same size as the full one, which in not kweeel :(

.

Is there a way to breaks those links in some sort of pre-process so that when Unity will make my Build, it will not include the assets ;) ?

So far, I'm reading stuff about Editor class and BuildPipeline but I'm having trouble on how to use them.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Kryptos · Jul 30, 2012 at 10:20 AM

AssetBundle is what you are looking for, assuming you own a pro version of Unity.

You can download and try the official example project.

Comment
Add comment · Share
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
0

Answer by BazLevelUp · Jul 30, 2012 at 12:42 PM

Thx for your answer Nico but I have find another way of doing what I want.

I'm using EditorWindow (doc, script). It allows me to made all of my process in a few clicks. All I need is to be in the scene where my links are, and having those objects activated.

The script will find the prefab with the links, breaks them, and then will move the assets in the Project view, from Resources to another file. Thus, when building, those files won't be added. Of course clicking the button again reverse the process.

Here is a sketch of what I'm doing :


 Public class iOSBuilder : EditorWindow
 {
 
 [ MenuItem( "Tools/Switch iOS version" ) ]
 public static void Launch()
 {
 // We find the object that hold the links
 LevelMusicManager music = (LevelMusicManager) FindObjectOfType(typeof(LevelMusicManager)) ;
 IntroManager intro = (IntroManager) FindObjectOfType(typeof(IntroManager)) ;
 
 
 if (music.music2 == null) // We are currently in Free mode, switching to Premium
 {
     // We put references back in place
     [...]
 
 
     // we disable intro and children
      // We need this object to be activated for
      // our script to run but to be disactivated
      // in order to build
  intro.gameObject.SetActiveRecursively(false) ;
 
 
      // prefab for intro and background
         moveAssets(freePath, resourcePath) ;
  }
  else // we switch to free mode
  {
      // saving premium music references for further switching
     [...]

 
      // we disable intro and children
      intro.gameObject.SetActiveRecursively(false) ;
 
      // prefab for intro and background
      moveAssets(resourcePath, freePath) ;
  }
 
 
  private static void moveAssets(string before, string after)
  {
      string error = "" ; 
      error = AssetDatabase.MoveAsset(before+introPath+"bg1.prefab", after+introPath+"bg1.prefab") ;
      error = AssetDatabase.MoveAsset(before+introPath+"bg2.prefab", after+introPath+"bg2.prefab") ; 
  }



moveAsset doc

Maybe this will help someone in the futur?

Content de voir que tu travailles encore avec Unity, Nico ;)

Comment
Add comment · Share
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

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Getting rid of 'Development Build' watermark in simulator 0 Answers

Unity bugged after Ios Build 0 Answers

Xcode API build really small in size. 0 Answers

Unity Insantiated Objects become invisible on iOS 0 Answers


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