Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by StuwuStudio · Sep 29, 2015 at 08:43 PM · classcustomvalueusingunityengine.object

How to create a custom function out of script (See the answer for more)

I want to know if there's a way to create custom function, like a script plug-in:

I'll show you an explample for the result i want: using UnityEngine.plugin_name

 Calculate.position.add.x = value; 

will execute :

  gameObject.transform.position = new Vector3(gameObject.transform.position.x + value, ... , ...);

i don't no if you understand, if not, just tell my how i can make my question better. Sorry for short question and bad english...

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mako-Infused · Sep 29, 2015 at 08:47 PM 0
Share

So, if I understand correctly you want to execute a function when the user changes the value of "Calculate.position.add.x"?

avatar image StuwuStudio Mako-Infused · Sep 29, 2015 at 09:01 PM 0
Share

"Calculate.position.add.x" is just an exemple, what i really want is a custom 'something or function' which you can give an output or input, example: Calculate.position.add.x = value; This 'something or function which i don't know the name' is an output, like a code shortcut. When the player write this in a script, this shortcut will be executed. I want also to make an custom 'something or function which i don't know the name' input... When write in a script: variable = Calulate.outputexample; So, yes you understand my "un-understandable" question.

avatar image Jessespike StuwuStudio · Sep 29, 2015 at 09:11 PM 0
Share

Extension methods maybe?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by RChrispy · Sep 30, 2015 at 07:30 AM

Hey if you mean extensions then here is an example on another post of mine just scroll down:

http://answers.unity3d.com/questions/571414/is-there-a-way-to-check-if-an-animatorcontroller-h.html

Extensions can be used to "extend" existing functionality.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

29 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

transform in a custom class 2 Answers

PropertyDrawer: Enum to select extended class 0 Answers

Error message when accessing class array 1 Answer

Custom inheritance classes and custom inspectors 2 Answers

"Null Reference Error" when using a custom class as an array 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges