Hello everyone. I got this compiler warning which is driving me nuts because it just wont leave.
The class defined in the script file named 'VectorGrid' is not derived from MonoBehaviour or ScriptableObject!
This kind of confuses my because I got more classes that are not derived from any of these.
Edit: This was not the root of my “can not build for IOS” problem. Though it confuses me. I could not build the iOS app cause I didnt read the Vectrosity Documentation (using source code now instead of dll and it works)
Here is the class that causes the error:
public class VectorGrid{
private float strength;
private float height;
private float lineOffset;
private int lineCount;
public VectorLine line;
public VectorLine smallLines;
public VectorGrid () {
strength = 0.5f;
height = 0.5f;
lineOffset = 10f;
lineCount = 10;
float xOffset = -((lineCount-1) * lineOffset);
float zOffset = -((lineCount-1) * lineOffset);
Vector3[] arr = new Vector3[lineCount*4];
// z axis
for(int i = 0; i < lineCount*2 ; i+=2){
arr _= new Vector3(i*lineOffset+xOffset, height, zOffset);_
_ arr[i+1] = new Vector3(i*lineOffset+xOffset, height, (lineCount-1)lineOffset2+zOffset);_
-
}* -
// x axis*
_ for(int i = 0; i < lineCount2 ; i+=2){_
_ arr[i+20] = new Vector3(xOffset, height, ilineOffset+zOffset);_
_ arr[i+20+1] = new Vector3((lineCount-1)lineOffset2+xOffset, height, i*lineOffset+zOffset);_
-
}* -
line = new VectorLine("Line", arr, Color.gray, null, strength);* -
}*
-
public void alignTo(GameObject go){*
-
GameObject line = GameObject.Find("Vector Line") as GameObject;* -
if(line == null)* -
throw new Exception("VectorGrid: Line not found on scene");* -
line.transform.parent = go.transform.GetChild(0);* -
line.transform.position = go.transform.TransformPoint(Vector3.zero);* -
line.transform.rotation = go.transform.GetChild(0).rotation;* -
line.transform.Rotate(Vector3.right, 90f);* -
}*
}
I appreciate any answer, comment or thought
Do you have another component called VectorGrid (in Plugins etc) perhaps not written by you but a plugin? Sounds like it's getting confused.
– whydoidoitNope just that single class.
– MexallonWhere do instance(s) of this class exist? (For example, as a variable inside a MonoBehaviour class.) Was this class ever a MonoBehaviour that was attached to a game object? Is any class trying to run SendMessage or BroadcastMessage on it?
– TonyLiJust one instance of this class exist in an MonoBehaviour that is on the same object as another monobehaviour that sends messages to all scripts on that object. Is that a problem?
– MexallonGetChild() is an undocumented, probably unsupported feature. I think they removed it because children are unordered. Can you rewrite alignTo() without using GetChild()?
– TonyLi