Note that there are some explanatory texts on larger screens.

plurals
  1. POUnity3d BootCamp Tutorial UnityScript Array Order Anomaly in ImageEffectsOrder.js
    primarykey
    data
    text
    <p>I am new to <strong>Unity</strong> and grabbed the <strong>BootCamp project</strong> and ran it within <code>Unity 4.1.5f1</code> as a Windows Build without any modification</p> <p>I then tried to build to Android and had a bunch of errors (mostly variables not being declared)</p> <p>But I have one remaining that I just don't understand...</p> <p>In the following code in the file ImageEffectsOrder.js the javascript references an order method of the array <code>sorted[] as sorted[i].order</code> </p> <p>The compiler errors with 'order' is not a member of object.</p> <p>So I'm a little confused as to why the windows build supports this member but not android. This makes me wonder what other surprises await when converting from platform to platform.</p> <p>But for now can anyone point me to a workaround for the order member? And I'm not quite clear on what it is actually returning...it seems the variable <code>i</code> should give you the order.</p> <p>The order just seems intrinsic from the code, it is never set to any value, so what 'order' is it? I can't seem to find any docs on this '<strong>member</strong>' of the Array class.</p> <p>Here is the code:</p> <pre><code>var sorted : Array = new Array(); var i : int = 0; for (var fx : PostEffectsBase in GetComponents(PostEffectsBase)) { if(fx &amp;&amp; fx.enabled) { sorted[i++] = fx; } } while (sorted.length) { var indexToUse : int = 0; var orderValue : int = -1; for(i = 0; i &lt; sorted.length; i++) { if(sorted[i].order &gt; orderValue) { orderValue = sorted[i].order; indexToUse = i; } } ...more code... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload