|
Update I am updating the particle effect.. in the last part here:
that should be updating it.. sorry if that is not what you meant. could you not just open unity and try out the script? sorry if I'm being ignorant but I have only been using unity for about half a year. Hello, I am making a script that scales particleFX similar to transform scale so if you change scale to 2 then its twice as big.... I its working prefect except one problem. Once I enter play mode or delete the particle prefab from the scene and then drag a new one into the hierarchy the data for the scale is lost. along with this code I have a editor script that calls the UpdateScale function when a button is pressed.
Editor script:
So I was wondering if there is anyway to make that scale data get saved.... Hopefully I worded this correctly. I am in a hurry to get this code ready.. so any help would be greatly appreciated!
(comments are locked)
|
UpdateSee this related question I just asked. You need to explicitly tell unity the type of your array. You have to explicitly type the array with your target type. Simple. Use a built-in array or a List. For example:
Then you can allocate enough memory (since you can't use Add() any longer):
Another updateYou were allocating arrays in the loop. Also I cleaned up some of the code to make it a little more readable. Are you sure that you are updating the emitters somewhere along the way after you've edited them? hello statement. I tried what you said and no luck :( I edited my question with the new code maybe you can look at it and tell me if i edited it right?
Dec 09 '10 at 06:30 PM
3dDude
also I am using unity basic if that matters...
Dec 09 '10 at 06:31 PM
3dDude
Looking at the documentation again it says "Arrays of a serializable type". I don't know if Array host a "serializable type". Can you change it so that the arrays are typed? Like if your minsize is storing floats can you do private var minsize : float[];
Dec 09 '10 at 09:24 PM
Statement ♦♦
hmmmm I have tried that but then you cant accesses the Array.Add(); function :( and i need that function for the script to work... any ideas? thanks
Dec 09 '10 at 10:29 PM
3dDude
See my update. You need to allocate the array with the 'new' keyword before using it.
Dec 09 '10 at 10:33 PM
Statement ♦♦
(comments are locked)
|
|
Update: ok I am using the exact same code you posted and here is a pic of the Hierarchy:
ok sorry for answering instead of commenting but that would be the last comment, so then you could not write back. so still not working.. I might gave overlooked something.. thanks a lot for helping me this! here is the updated code: Instead of posting another reply, edit your question instead.
Dec 10 '10 at 12:12 AM
Statement ♦♦
... And I would write back. I get perfect messages from unityAnswers system that someone would reply to any of my posts :) So do not be afraid I notice you less if you post a comment in my answer.
Dec 10 '10 at 12:17 AM
Statement ♦♦
yeah sorry. I have noticed that it only allows 8 comments and there are 7 now so if I had commented then how would you have written back? thanks for the code cleanup I am kind of unorganized hehe updated the question anyway thanks for the code clean up and
Dec 10 '10 at 12:51 AM
3dDude
ok that was weird it cut of what I was going to say... I updated the question.
Dec 10 '10 at 12:52 AM
3dDude
Huh? It still doesn't work for you? have you seen my update? I went ahead and tried it myself. I create a game object, add your Scale script, and add a particle emitter to it. I set scale to some value, say 2 and press update. I see the many arrays are populated. I make a prefab out of it. I delete it and add it back to the scene and all values are there, as expected. I think you're doing something way different than what I assume you were doing with this script unless you haven't tried the new version.
Dec 10 '10 at 01:29 AM
Statement ♦♦
(comments are locked)
|

