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 Oleg · May 25, 2010 at 08:42 PM · assetbundleloadlevelrendersettingsbuildplayer

RenderSettings in AssetBundles

I've got streamed scene loaded by Application.LoadLevelAdditive function.

It works fine by I lost all RenderSetting, no SkyBox and Fog.

I've tried to create Game Object with script that contains RenderSettings info and update this after loading as here:

http://answers.unity3d.com/questions/1311/do-streamedscenes-contain-rendering-settings-data

But AssetBundles can't contain scripts and this example doesn't work.

I've tried this example too http://angryant.com/2010/01/05/downloading-the-hydra/ If I get this right I've got to create dll from my original class, so I took the class from the first example and created dll.. but what's next? I can't attach it to Game Object and can't export it to AssetBundles

Please help.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by jonas-echterhoff · May 25, 2010 at 08:50 PM

While you cannot make scripts contained in an AssetBundle, what you can do is to make a script to set up your RenderSettings in Start(), and set up the parameters for that script as member variables. Then you set up a prefab GameObject, where you set up the correct parameters as an inspector. This prefab can be added to an AssetBundle just fine - or directly to the level you want to load. That way, you don't actually store the script in the AssetBundle, but the data which the script uses, which is all you need.

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 Oleg · May 25, 2010 at 09:27 PM

Thank you for so fast answer. Here is my script:

using UnityEngine;

public class RenderSettingsController : MonoBehaviour { public bool fog; public Color fogColor; public float fogDensity; public Color ambientLight; public float haloStrength; public float flareStrength; public Material skybox;

void Start()
{
    RenderSettings.fog = fog;
    RenderSettings.fogColor = fogColor;
    RenderSettings.fogDensity = fogDensity;
    RenderSettings.ambientLight = ambientLight;
    RenderSettings.haloStrength = haloStrength;
    RenderSettings.flareStrength = flareStrength;
    RenderSettings.skybox = skybox;
}

}

I created an Empty GameObject, and attached this script. Then assigned all variables, added an Empty Prefab and dragged the GameObject to it.

Now I use BuildPipeline.BuildPlayer to export all scene to AssetBundles and Application.LoadLevelAdditive to load it:

WWW stream = new WWW("url"); AssetBundle ab = stream.assetBundle; Application.LoadLevelAdditive("Scene_name");

After that I see my RenderSettings GameObject with all variables assigned but it looks like Start() function never works and my RenderSettings never get changes.

Comment
Add comment · Show 1 · 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 jonas-echterhoff ♦♦ · May 25, 2010 at 10:18 PM 0
Share

Do a Debug.Log() to see if Start really hasn't been called - that would be sort of strange, though. Have you tried putting the GameObject directly into the scene you are loading?

avatar image
0

Answer by Oleg · May 27, 2010 at 07:50 AM

The script should be in both scenes.

Resolved.

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

No one has followed this question yet.

Related Questions

Loading game objects dinamycaly 1 Answer

Building asset bundles with dependencies in the player build? 2 Answers

How do i define BuildPlayerOptions.assetBundleManifestPath without a custom script? 0 Answers

Why is my AssetBundle causing "Exception: WWW download had an error:Invalid Unity Web File" 0 Answers

Webplayer displays garbage on Application.LoadLevel 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