Jump to content

Airblader

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by Airblader

  1. The documentation for anything seems pretty much non-existent. I don't know a way either, I just thought it might be possible to somehow do that in a workaround manner (getting the corresponding game object and so on). Like I said, it'd definitely be a less preferable solution, though.
  2. I don't know about a redraw, but just in case it doesn't exist: maybe you can trigger closing and reopening the menu programatically (the redraw is definitely a better solution if possible).
  3. Have a look at the HotRockets plugin, I believe it is being done there.
  4. I should add that using a different effect name for exhaust flames, they will work fine even without atmosphere. So there seems to be a difference in their configuration, but I can't figure out which one. Any ideas?
  5. Hi everyone, so I finally got my ParticleEmitter setup working right – and then I go test it on the Mun just to realize that ParticleEmitters don't seem to work there. I tried landing on Duna to make sure it's not some coordinate problem or whatever and indeed, there it works fine. Does anyone know why ParticleEmitters wouldn't work outside the atmosphere* and, more importantly, how I can get them to work without one? The actual game object is created using GameObject emitterGameObject = (GameObject) UnityEngine.Object.Instantiate( UnityEngine.Resources.Load( "Effects/fx_smokeTrail_light" ) ); and I can only assume that the problem lies at using a KSP-builtin effect. However, I don't know what properties cause this. *) I know how gas behaves if released into space, but I am not trying to use this for gas.
  6. Yes, it only introduced a wrapper method, getting rid of using "gameObject". Like Thalur said, it's only a bit of cosmetics. You can omit the "this", by the way.
  7. public T AddChild<T>() { return gameObject.AddComponent<T>(); } should do it. You could limit the generic type to a valid type but apparently Unity doesn't even do that (and instead just throws a runtime exception). Definitely take a look at generics, they're not as complicated as they might seem. As for the entire thing: I haven't looked at it, but I always think it's great if someone does the work to try to offer the community part of his work for reuse. Thumbs up!
  8. That is a great resource, too, thanks. I do need moving emitters, though, but any code that gets me started is good – nothing preventing me from expanding it I might use the FXGroup for a proof-of-concept of my idea and then when I get into having to use custom particles I'll look more into it.
  9. Sorry that it took me so long – I've just been too busy at work. I finally got around to try this and with small modifications it works just fine in a partless mod. Thank you! However, I have a follow-up question. I found this overview of available effects. However, I'd like to make a custom one – but how? The effects seem to come from the (binary) file KSP_Data/ressources.assets, so I'm assuming this is where I'll have to actually use Unity. Before I get started with that, is it really the case that I can just create the effect in there and export a custom assets file or are there limitations with KSP?
  10. I'm not trying to work with the list. Granted, I am new to C# itself (coming from Java), but so much as assigning a property to a local variable should not throw an exception. If it's null, that's alright. But accessing any property should never throw. See http://msdn.microsoft.com/en-us/library/ms229006.aspx:
  11. Hello everyone! I am trying to figure out how to display particles/a particle system in a partless mod (e.g. display dust zooming by the vessel during flight or other funny things). It seems that gameObject has a particleSystem property of type ParticleSystem – sounds good and there are Unity tutorials on how to make it work with that. However, this property is null. So AddComponent won't work because it already exists and instantiating it doesn't work because it's read-only. Of course this might not be the best approach altogether, maybe there is a better solution to tackle this. [KSPAddon( KSPAddon.Startup.Flight, false )] public class CanIHazParticles : MonoBehaviour { // Step 1: create mod dummy // Step 2: ??? // Step 3: sup3r fLy p4rt!cleZ } This question may come from my lack of knowledge of the Unity engine so please forgive me if the answer is rather easy. I tried to look at a few different mods to see if I can find anything, but without any luck.
  12. There definitely are events for attaching/detaching. I believe they were GameEvents.OnPartAttach and GameEvents.OnPartRemove. Beware that most other events do not work in the VAB/SPH and that there is no active vessel in the editors. I'm also not sure if OnPartAttach will fire for the root part (even though I just played around with these events a few days ago…). I would also recommend wrapping access to SortedShipList in a try/catch as I experienced a bug with it (in case you're still working with it): http://bugs.kerbalspaceprogram.com/issues/2021
  13. First off a big thanks for TacLib and the tutorials -- I started off wanting to make a partless mod with a GUI window and looking through several resources, these tutorials and the library were the most helpful to me. Also a thanks for the support in IRC. Just to have Google hopefully show this sometime when someone is looking for it: I added TacLib to my mod in VisualStudio Express 2013 and everything compiled fine, but I would get the following error messages in the KSP.log: [LOG 03:11:53.966] Load(Assembly): MyPlugin/Plugins/MyPlugin [LOG 03:11:53.968] AssemblyLoader: Loading assembly at C:\Program Files (x86)\Steam\SteamApps\common\Kerbal Space Program\GameData\MyPlugin\Plugins\MyPlugin.dll [LOG 03:11:54.033] AssemblyLoader: Loading assemblies [ERR 03:11:54.057] AssemblyLoader: Exception loading 'MyPlugin': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool) at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0 Additional information about this exception: System.TypeLoadException: Could not load type 'Tac.Icon`1[T]' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type 'Tac.PartExtensions' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type 'Tac.PopupWindow' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type 'Tac.ToolbarButton' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type 'Tac.ToolbarWrapper' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type '<>c__DisplayClass6' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type '<>c__DisplayClasse' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type '<>c__DisplayClass2' from assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Someone in the chat hinted me to how to solve this: The project target has to be changed to .NET 3.5, then everything works fine. @TaranisElsu Another thing I found is that TacLib (in parts) requires the Toolbar plugin. Maybe you could add that somewhere in the README or whatever. It's probably obvious to experienced mod developers, but mentioning dependencies is probably not a bad idea either way.
×
×
  • Create New...