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 Andrew Cherkashin · Mar 23, 2010 at 12:46 AM · rotationscalecreate

Object Creation

I have script that create GameObject. What i want:

  • Create that object [x]
  • Give a name [x]
  • Put in right position [x]
  • Rotate [x]
  • Change size [x]
  • Put texture on it [ ]

I need a c# solution.

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 runevision ♦♦ · Mar 23, 2010 at 02:33 PM 0
Share

Your question could have been made more general by splitting it up into simpler questions. Please see this section in the faq: Break multi-part problems into simpler questions.

2 Replies

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

Answer by Andrew Cherkashin · Mar 23, 2010 at 01:05 AM

Everything expect texture:

                anotherplayer =  GameObject.CreatePrimitive(PrimitiveType.Plane);
                anotherplayer.name = updatexml.players[i].username;
                anotherplayer.transform.localScale = new Vector3(0.0903f, 0.0903f, 0.0903f);
                anotherplayer.transform.eulerAngles = new Vector3(62.68924f, 184.4452f, 4.010004f);
                anotherplayer.transform.position = new Vector3(updatexml.players[i].x_coordinate, updatexml.players[i].y_coordinate, updatexml.players[i].z_coordinate);

Comment
Add comment · Show 1 · 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 Andrew Cherkashin · Mar 28, 2010 at 12:35 AM 0
Share

anotherplayer.renderer.material = new $$anonymous$$aterial (Shader.Find("Transparent/VertexLit")); anotherplayer.renderer.material.mainTexture = Resources.Load("Sasuke", typeof(Texture2D)) as Texture2D;

Texture

avatar image
1

Answer by straydogstrut · Mar 23, 2010 at 02:04 AM

For assigning a texture to the object, I believe you can use the following (Javascript) placed on the object in question:

var myTexture: Texture2D;

function Start(){

 renderer.material.mainTexture = myTexture;

}

A similar forum post and the Unity Scripting Reference.

I don't know C# unfortunately but this post would seem to suggest you can use a similar line like the following:

public Texture mytexture;

void Start() { renderer.material.mainTexture = mytexture; }

Hope that helps.

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 Andrew Cherkashin · Mar 24, 2010 at 05:37 AM 0
Share

okey, but what's value of mytexture?

avatar image straydogstrut · Mar 28, 2010 at 06:59 PM 0
Share

Sorry for the tardy reply, you've probably worked it out by now, but incase you haven't: 'myTexture' is a variable for storing a reference to the texture you want to put on the object. In the example, the JS one at least, it should show in the Inspector and allow you to choose a texture by dragging it into the slot.

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

No one has followed this question yet.

Related Questions

Scaled sprite distorts on rotation in different resolutions 0 Answers

Weird Rotation Issue 0 Answers

postion scale and rotation greyed out and not working 1 Answer

Common 2D Collider flip problem 4 Answers

Child Gameobject Scale When Camera Rotates. 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