- Home /
Question is off-topic or not relevant
Javascript containing List<> - can not make them work in WebPlayer
I made some scripts with Lists. They work in Editor, but I could not make them work in the WebPlayer. Then I added
import System.Collections.Generic;
statement in all the scripts using Lists, but that did not help. They still work in the Editor and not in the Webplayer. Any suggestions, please!
Im surprised it worked w.o the imort sys.coll.gen declaration. As Berenger said, we need some code here..
These are terribly long scripts. I think I have to try to get rid of lists and see if it works.
Basically it just contained data declarations: var palettes: List.; var GUIpalettes: List.; then palettes.IndexOf() to find elements
Thanks to all. Have tracked the reason which was the static batching enabled on the WebPlayer settings, while the scripts were manipulating with meshes and colliders on static object. So the solution was either to uncheck the object static or to disable static batching
Answer by hijinxbassist · Jun 26, 2012 at 06:51 AM
In javascrit(actually unityscipt, but i always hated ppl criticizing me :P) you would add a period before the first carrot
var palettes:List.<List.<Object> > = new List.<List.<Object> >();
My example is a 2D List which can be turned into a jagged list of any type in javascript(unityscript)
for c#
var palettes = new List<List<object> >(); //allows for all system types
Maybe the problem is you never construct them? Impossible to tell w/o code, so far so good i guess except the inner List portion, which is a big deal... You must specify the occupying type, easiest being Object (object in C#). This allows for any type of variable to be place into the list.
That is exactly how I had it done with just Texture in place of Object The comment field did't display right the code I pasted.
Thank you very much for taking your time anyway. Looks like the reason for the script not working in the WebPlayer is quite different and I am still tracking and getting closer and closer to it.
Follow this Question
Related Questions
A node in a childnode? 1 Answer
List appears null? C# 2 Answers
Lies! You don't need pragma.etc for lists! 1 Answer
Using DLLS in a Webplayer 0 Answers
Webplayer includes some DLL's for no apparent reason 1 Answer