|
I have 2 questions:
(comments are locked)
|
|
You can turn off the rendering of a GameObject by disabling its MeshRenderer component, e.g.
You can disable a GameObject entirely by making it inactive, e.g. where does this text go and what do i attach it to? i just get error if i put it into the update and attach it to an object.
Oct 14 '11 at 05:03 PM
tensus2000
you cannot use adjust a property on an uninstantiated object (e.g. a function call) GetComponent("RPGCamera").enabled = true; I would go into your RPGCamera script and generate some setters and getters. then you could say: if (Input.GetKeyUp (KeyCode.F)){ MainCamera.setEnabled = false; RPGCamera.setEnabled = true; }
Nov 14 '12 at 01:13 AM
Cyber_Defect
@tensus2000 It is important that you use Unity 3. If you use Unity 4 you should use this script http://docs.unity3d.com/Documentation/ScriptReference/GameObject.SetActive.html
Jan 05 at 06:59 PM
Lost_C4
ok, apparently you can... odd.
Mar 22 at 12:38 AM
Cyber_Defect
Hi technicat! Two small additions to these good answers
Apr 23 at 02:22 AM
psantoki
(comments are locked)
|
is a shortcut you can use to do the same thing as the first example. I just realized today I forgot about the shortcut in my answer! The shortcut also has the advantage of working with non-mesh renderers (I assume), like LineRenderer. Still, for those getting used to the Unity model, it's useful to make obvious the conceptual connection between the line of code and manually clicking that particular component checkbox in the Inspector.
Nov 17 '09 at 02:45 AM
technicat
(comments are locked)
|
|
Just to answer your question regarding physics..
(comments are locked)
|
|
i have a question, if i set gameObject.active = false; does it stop the engine from making calculations (like physics ones) ? I am preallocating 10 objects and placing them out of screen, but i don't want them to generate any collision/calculation,etc when i have them in this "not used" state. Would gameObject.active = false; achieve this? Thanks @pablo I think you should copy this question into a new question as you should only reply to the first question if you have the answer or a comment. Hope you will understand.
Oct 14 '11 at 05:29 PM
BerggreenDK
(comments are locked)
|
|
maybe set renderer.material.color.a = 0 to set alpha to 0, then you could even put the camera behind or inside the character and view from inside that mesh at like .25 opacity, depending on how cartoony youre going this could like kinda sweet
(comments are locked)
|
1 2 next page »
