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 /
  • Help Room /
avatar image
0
Question by nickonil · Apr 21, 2017 at 09:59 AM · transformrandomscalerandom.rangelocalscale

objects of same parrent random scale/size(xy and z)

I have objects that are collectibles, I want them too have a different scale or size I am having problems understanding the difference but basically if i have 5 of these spheres next too each other i want them all too have a different scale/size on the xyz axis that would look like (3, 3, 3) or (0.25, 0.25, 0.25)

preferably in a "minScale" value and a "maxScale" value

this script is on a empty parent object that has this script on it and 2 objects which makes up the "sphere"

this is what i currently have (it does not work at all) using System.Collections; using System.Collections.Generic; using UnityEngine;

 public class SizeMod : MonoBehaviour {
 
     Set minScale = 0.25;
     Set maxScale = 2;
 
     GameObject (GameObject source, float minScale, float maxScale);
 
     void Start ()
     {
         transform.localScale *= Vector3.one. * Random.Range(-minScale, maxScale);
     }
     
 }
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 nickonil · Apr 24, 2017 at 08:59 AM 0
Share
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class transformscale : $$anonymous$$onoBehaviour {
 
         public float $$anonymous$$Scale = 0.25f;
         public float maxScale = 2f;
         private float randomized;
  
         void Start()
         {
 
         randomized = Random.Range($$anonymous$$Scale, maxScale);
         transform.localScale = new Vector3(randomized, randomized, randomized);
         }
 
     }


so after i finally got a $$anonymous$$cher to look at my problem we found that i was basically calling my code wrong and we just used "new vector3" ins$$anonymous$$d of vector3.one and changed out the = with the private float "randomized" then now all the collectables spawn in at random sized scales :)

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

110 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 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

Create random numbers of object and move them 0 Answers

function works script-wise; doesn't work visually(only in game) 0 Answers

Saving default scale of an object c# 1 Answer

Player Prefab scale automatically goes to 1 x 1 x 1 whereas I have set it to 0.48 x 0.48 x 0.48 1 Answer

random question without repetition 0 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