Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 greatUnityGamer · Aug 19, 2013 at 06:13 AM · animationscalingbasic programming

How do You Scale a Character/Object up and down?

Basically i want to have my character slightly scale up and down at some speed.

I'm reading stuff about localScale but just nobody has clear examples.

I just want to scale up and down.

Comment
Add comment · Show 1
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 greatUnityGamer · Aug 19, 2013 at 06:37 AM 0
Share

This is not working and i dont understand why

using UnityEngine; using System.Collections;

public class BreathALive: $$anonymous$$onoBehaviour{ void start( ){

 }
 
 void update(){
    transform.localScale += new Vector3( this.x + 0.1F, 0, 0);
 }

}

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Musabbir · Jul 21, 2018 at 10:39 AM

     float speed = 3f;
     float depth = 1f;
 
     void Uodate(){
     float scaleInOut = Mathf.Sin(Time.time * speed);
     transform.localScale = new Vector3(scaleInOut, scaleInOut, scaleInOut) * depth;
 }

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

Answer by beayfergm · Aug 19, 2013 at 06:52 AM

Your code should be something like:

 using UnityEngine; 
 public class BreathALive: MonoBehaviour
 { 
     void Start( )
     {
          // Initializations here...
     }
  
     void Update()
     {
         // warn: the scale will grow constantly with no end
         transform.localScale += new Vector3(0.1f, 0, 0);
     }
 }
Comment
Add comment · Show 2 · 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
avatar image greatUnityGamer · Aug 19, 2013 at 06:55 AM 0
Share

Thanks alot. Well but your example was basically the same as the other thing i tried before and didn't work either.

Could it be the mac version 4.1.5 has bugs?

Cause people say transform.localScale works but hasn't worked for me and the script is attached to my character.

Your void start() says intializations here, but in my case i dont need any right?

avatar image greatUnityGamer · Aug 19, 2013 at 06:57 AM 0
Share

wait, now it worked. mmm i wonder what i did wrong before?

i did the exact transform.localScale += new vector3(0.1f, 0, 0);

i did though put a capital F for the flotat ins$$anonymous$$d of a small f. could that have been the problem?

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

17 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

Related Questions

Animated Child Snapping to Parent's Coordinates 1 Answer

Can the animation editor create local rotational data? 3 Answers

Adding animation clips via script 2 Answers

Make object scale pulse smoothly when selected. 1 Answer

Parallel animation play using iTween 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