- Home /
isStatic not fully working... or so it seems.
I'm using isStatic in my code to switch off the Static mode of certain gameObjects at runtime and it appears to be working in that the Static box unticks when I play the game, however the objects are still behaving as though they are Static (i.e., they won't animate). If I check them off manually in the editor it works as expected.
Any ideas as to why this might not be working for me as expected?
Thanks!
You can't change it during runtime. Static objects are optimised to never be moved and isStatic only exists in the editor, not in a build.
Answer by yantraVR · Jan 05, 2014 at 06:21 PM
Well that definitely explains why it wasn't working as expected. Thanks for the reply... I appreciate that! I guess what I need now is to figure out how to switch the objects to "static" mode using an editor script before baking the lightmaps.
I found the following code that should do the trick but can't figure out how to make it work with tagged objects yet:
GameObjectUtility.SetStaticEditorFlags(go,StaticEditorFlags.LightmapStatic);
If I can get it working then I'll follow up with the working script.
Thanks again for your help!
Your answer
Follow this Question
Related Questions
How to display GUI in sequence in trigger 3 Answers
script linking 1 Answer
why won't my code work? 1 Answer
problem at adding script 1 Answer