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 at 03:42 PM

eurosat7\'s gravatar image

eurosat7
132 7 8 15

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

1 answer:

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 at 09:30 PM

Eric5h5\'s gravatar image

Eric5h5
56.4k 32 105 420

(comments are locked)
10|3000 characters needed characters left
 moderation talk
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:

x1704
x271
x24

Asked: Mar 03 at 03:42 PM

Seen: 1821 times

Last Updated: Mar 03 at 03:42 PM

powered by Qato - Enterprise Q&A