x


Help needed: repairing the Spline Controller Script

This code seems outdated:

http://www.unifycommunity.com/wiki/index.php?title=Spline_Controller

Is there anybody skilled enough to fix it or is there a fix somewhere available?

You are trying to create a MonoBehaviour using the 'new' keyword.  This is not allowed.  MonoBehaviours can only be added using AddComponent().  Alternatively, your script can inherit from ScriptableObject or no base class at all
UnityEngine.MonoBehaviour:.ctor()
UnityEngine.MonoBehaviour:.ctor()
SplineInterpolator:.ctor() (at Assets\AI\SplineController\SplineInterpolator.js:1)
SplineController:OnDrawGizmos() (at Assets\AI\SplineController\SplineController.js:24)
UnityEditor.Handles:Internal_DrawBuiltinGizmos()
UnityEditor.Handles:Internal_DrawBuiltinGizmos()
UnityEditor.Handles:DrawBuiltinGizmos()
UnityEditor.SceneView:OnGUI()
System.Reflection.MonoMethod:InternalInvoke(Object, Object[])
System.Reflection.MonoMethod:InternalInvoke(Object, Object[])
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
UnityEditor.HostView:Invoke(String)
UnityEditor.DockArea:OnGUI()

[..\..\Runtime\Export\Generated\BaseClass.cpp line 1029]
more ▼

asked Mar 03 '10 at 03:42 PM

eurosat7 gravatar image

eurosat7
177 7 8 15

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Change the line in SplineController.js from

var interp = new SplineInterpolator();

to

var interp = gameObject.AddComponent(SplineInterpolator);

This gets rid of the warning, but then a ton of SplineInterpolators get added to the game object, so add

DestroyImmediate(interp);

to the end of the OnDrawGizmos function.

more ▼

answered Mar 03 '10 at 09:30 PM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3328
x520
x43

asked: Mar 03 '10 at 03:42 PM

Seen: 2422 times

Last Updated: Mar 03 '10 at 03:42 PM