Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 calpolican · Jan 17, 2018 at 11:35 AM · prefabprefab connection

prefab: can you exclude a variable from beign tracked?

Can I exclude the scale of a prefab instance from being tracked? Unity already allows prefab instances to have independent rotation and position, can I exclude the scale likewise?

An example: Imagine I have a prefab of a tree that has built in functionality for my character to interact with. My scene takes place in a forest, so there are lots of trees... each tree is an instance of a prefab, and for design reasons, each has a different scale (carefully placed).
Imagine I decide to improve my tree prefab. Thing is I'd have to write some code to reset every prefab of every scene, and I have to make some script to store a scale, and call it whenever the prefab is updated. Both of this I can do with the PrefabUtility, I'm just wondering if there's a better way, and I can just exclude the scale or other variables

Comment
Add comment · Show 3
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 kaplica · Jan 17, 2018 at 01:49 PM 0
Share

How is your tree script structured? Are you using inheritance/composition? Tree is too abstract, so you would usually make it an abstract class and then different kinds of trees like maple tree would derive from tree. Prefabs are just like templates, you define a base template, attach a behaviour to it then instantiate and if there is a need you can modify stuff at runtime. You could also look at composition, so ins$$anonymous$$d of tightly coupling tree's functionality, for specific functionality you could use interfaces.

avatar image calpolican kaplica · Jan 17, 2018 at 09:30 PM 0
Share

$$anonymous$$aplica, thanks for answering. I guess my example was misleading. There's no prefab tree I have. $$anonymous$$y question is more of an hipotetical nature. I just want to know if it's possible to somehow stop tracking some variables from a prefab. $$anonymous$$any times already I found my self saying: "jeez, I wish there was a way to stop the prefab from updating just this particular variable". So I wanted to see if there was someone in this great comunity that may know how to do that.

avatar image TreyH kaplica · Jan 17, 2018 at 09:47 PM 1
Share

The OP isn't describing a component for trees. They're describing a scene with several copies of a single Tree prefab where they want to change a single value on that prefab, propagate that change across trees in the scene, and leave other values the same.


If you cannot find a way to change a single value, you could always write an editor extension to do so for trees in your scene.

0 Replies

· Add your reply
  • Sort: 

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

93 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Change Prefab Source/Change material on ALL prefabs in the scene 0 Answers

Patterns for reusing, inheriting from, or extending GameObjects or Prefabs. 0 Answers

Prefabs won't change? 1 Answer

PrefabUtility.ReplacePrefab overrides changes 0 Answers

How to make prefab reference in another prefab 2 Answers


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