Skip to main content

Timeline for How to optimize this code (C#)

Current License: CC BY-SA 3.0

15 events
when toggle format what by license comment
Jan 16, 2018 at 13:00 comment added Zhaph - Ben Duguid You would be better off putting this script directly on the Camera GameObject in that case, or you could expose a GameObject parameter that you can then drag your camera object onto and reference it directly - that way GetComponent (or GetComponentsInChildren) would be limited to just that branch of the tree - if you accidentally move the camera in the hierarchy, this script will break horribly.
Jan 16, 2018 at 1:21 comment added NoobProgrammer Please see the image : Image Reference . Only the Camera GameObject is what I'm aiming. So if i use the getcomponent<bloom> to get all all the bloom then also the other camera from my horse,camera,env will also be there so that's not what i am aiming for . Only for the Camera GameObject.
Jan 16, 2018 at 1:08 comment added Stephan Does the parent object have more than one copy of bloom and depthoffield? If not you can use getcomponent<bloom> to shortcut so you don't run the risk of your indexes ending up out of bounds or other than expected. This is why an image of your object hierarchy is important to include with the question.
Jan 16, 2018 at 1:04 comment added NoobProgrammer @Stephan what i am trying to do here sir is that i need to get the game object through getchild() and then access the gameobject component that has been get by using the getchild and disable the script bloom.cs and depthoffield.cs that is what i'm trying to achieve here. I'm using get child so that i don't need to drag/apply it from hierarchy to the component.
Jan 15, 2018 at 16:38 comment added Stephan @NoobProgrammer You have accepted an answer, but you haven't finished clarifying what you're doing for the answer to truly be THE answer. Why are you traversing an object hierarchy in that manner? What is the hierarchy of in the first place? In order for a question to have value to other people, you have to clearly state the problem you are trying to solve, not just an obscure code snippit.
Jan 15, 2018 at 10:13 comment added Philipp By the way, we also have codereview.stackexchange.com - a stackexchange site specifically for getting constructive feedback for code you wrote.
Jan 15, 2018 at 9:39 comment added Valamorde @NoobProgrammer no problem!
Jan 15, 2018 at 9:38 comment added NoobProgrammer I get the idea . Thank you . Though its a lil bit too far from there. Still i got the idea so thank you very much @Valamorde
Jan 15, 2018 at 9:36 comment added Valamorde @NoobProgrammer I've answered your question to give you an example but your question is not very clear as to what you are trying to achieve, provide more information so I can help you better. As mentioned you should probably learn some programming first before you jump into unity!
Jan 15, 2018 at 9:34 vote accept NoobProgrammer
Jan 15, 2018 at 9:32 answer added Valamorde timeline score: 2
Jan 15, 2018 at 8:34 comment added Bálint Then maybe start with learning programming. Don't jump into unity without that
Jan 15, 2018 at 8:33 comment added NoobProgrammer @Bálint I know what it is but i don't know how to implement it sir.
Jan 15, 2018 at 8:30 comment added Bálint Do you know what for loops are?
Jan 15, 2018 at 8:23 history asked NoobProgrammer CC BY-SA 3.0