Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API - How to get an existing component?
#1
I have a GameObject (named "Player") with an attached SplineController.  Based on user input, I want to start/stop movement along the spline.  I tried to reference the controler
Code:
controller = GameObject.Find("Player").GetComponent("SplineController")
but I get an error that the result is a Component instead of a SplineController.  What is the correct way to access an object that already exists?
Reply
#2
Hi,

This is a question regarding Uniy in general, and not Curvy Splines in particular. For such questions, I recommend using perplexity.ai, which gives sourced answers.

For example, it gave me the following answer to your question, which is the correct one:
https://www.perplexity.ai/search/i-have-a-gameobject-named-play-ZYVNV7G7S9qKZKLISWKb0A

Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
Thanks, 
I'll give that a try.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I attach the component to the mesh generated from the spline? Chanon 1 3 02-11-2023, 09:17 AM
Last Post: _Aka_
Question Add Component to created mesh? HarvesteR 1 16 05-25-2022, 07:21 PM
Last Post: _Aka_
  Split existing segment(s) with additional control points KStress71 1 279 09-09-2021, 05:46 PM
Last Post: _Aka_
  Creating splines from the surface of existing 2d colliders Monomirror 2 486 08-18-2021, 03:55 PM
Last Post: Monomirror

Forum Jump: