- Home /
BCE0019: 'order' is not a member of 'Object'.
I am being hit with this error when trying to run the bootcamp example on Android and am hoping someone here can help.
The code causing the error is:
@script RequireComponent(Camera)
@script ExecuteInEditMode
private var _tex : RenderTexture[] = new RenderTexture[2];
function OnEnable () {
if (!SystemInfo.supportsImageEffects || !SystemInfo.supportsRenderTextures)
enabled = false;
}
function OnRenderImage (source : RenderTexture, destination : RenderTexture)
{
_tex[0] = source;
_tex[1] = RenderTexture.GetTemporary(source.width, source.height);
var releaseMe : RenderTexture = _tex[1];
var index : int = 0;
var sorted : Array = new Array();
var i : int = 0;
for (var fx : PostEffectsBase in GetComponents(PostEffectsBase))
{
if(fx && fx.enabled)
{
sorted[i++] = fx;
}
}
while (sorted.length)
{
var indexToUse : int = 0;
var orderValue : int = -1;
for(i = 0; i < sorted.length; i++) {
if(sorted[i].order > orderValue) {
orderValue = sorted[i].order;
indexToUse = i;
}
}
var effect : PostEffectsBase = sorted[indexToUse];
if (effect.PreferRenderImage3())
{
effect.OnRenderImage3(_tex[index], _tex[1-index]);
}
else
{
effect.OnRenderImage2(_tex[index], _tex[1-index]);
index = 1-index;
}
sorted.RemoveAt(indexToUse);
}
Graphics.Blit(_tex[index], destination);
RenderTexture.ReleaseTemporary(releaseMe);
}
line 35 seems to the be line
Answer by vexe · Oct 08, 2013 at 08:53 AM
You're using an Array
, (similar to ArrayList
in C#, which stores objects) you need to cast it back to PostEffectsBase
at line 35 (of course, order
isn't contained inside Object
). From this:
"Javascript arrays are therefore somewhat easier to use than built-in arrays, however they are more costly in terms of performance. Another potential downside is that there are certain situations where you need to use explicit casting when retrieving items because of their 'untyped' nature"
Instead, don't use Array
, use a generic List.
var sorted : List.<PostEffectsBase> = new List.<PostEffectsBase>();
Also, since in your previous question you had trouble with missing variables, make sure that order
is actually located in PostEffectsBase
- You also now have to change any sorted.[Ll]ength
to sorted.Count
I get
The name 'List' does not denote a valid type ('not found'). Did you mean 'UnityEngine.Light'?
Please visit the link in my answer. You have to do include the right namespace for it: using System.Collections.Generic;
[C#] - import System.Collections.Generic;
[JS]
when I have done that ..error now says Assets/Scripts/Unity/ImageEffectsOrder.js(36,38): BCE0019: 'order' is not a member of 'PostEffectsBase'. what to do now
Your answer
Follow this Question
Related Questions
Bootcamp demo for Android compile error (Unity 3.3) 1 Answer
Bootcamp Android - SmoothFollow.js(31,9): BCE0005: Unknown identifier: 'wantedRotationAngle 1 Answer
'TerrainData' does not denote a valid type 1 Answer
Android level doesn't want to work after Application.LoadLevel 1 Answer
What do I pass into Application.OpenURL to open up the Android market from an app? 2 Answers