Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1,088 Excellent

1 Follower

About xEvilReeperx

  • Rank
    Junior Rocket Scientist

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. You can use the same general idea. In this case, it's easier to straight hijack the live button once it exists. Most of the effort of this is figuring out how to get a reference to the thing you want (conveniently, RDController.Instance.actionButton) and how to manipulate it in a way that doesn't break stock code. Here is some prototype code to get you started: /* // RDController.Instance.nodePanel Panel_Right has components: ...c: UnityEngine.RectTransform ...c: KSP.UI.UIStatePanel ->Panel node has components: <-- this is the RnD panel (there are two panels in this GUI: RnD and arc
  2. Don't mess with the original models in GameDatabase. Instantiate a new GameObject using them instead or you'll blow things up later. I would be surprised if your first log was working; GetComponentInChildren only returns a component on active GameObjects (unless you use one of its overloads) and none of the model stuff should be active
  3. I've put together a bare-bones example that does what you want. Code: using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; using KSPAssets; namespace CargoLoader { [DatabaseLoaderAttrib(new[] { "cargo" })] public class CargoLoader : DatabaseLoader<GameObject> { private readonly List<AssetBundle> _loadedBundles = new List<AssetBundle>(); private void Failed(string reason) { successful = false; Debug.LogError(reason); } public overrid
  4. The game scans for all DatabaseLoaderAttrib-decorated types and uses them to load files from GameData directory. You can use this to have the game do stuff with your own files. I recommend you choose your own extension (it can be whatever you like that isn't already taken). It looks like ShadowMage needed to manipulate the materials, and uses that list to keep track of materials that have already been adjusted. My prototype didn't need to do this because I stored everything (textures and materials) inside the asset bundles themselves, so it all just works. RE your concern of multiple
  5. Did you use the code from Shadowmage's post? In that version, the file extension should be 'smf' (although you should probably choose your own extension and edit the code accordingly). You also don't need to use the KSP asset compiler, although it shouldn't be a problem if you do
  6. You don't put the .mu model into the bundle. You put the actual GameObject that you've set up (as a prefab) in there instead, bypassing the .mu creation step entirely. This asset bundle is essentially a mu file now, except it uses Unity's serialization instead of Squad's hand-rolled stuff that is missing lots of features. Everything else behaves exactly the same as if you were using a mu file -- define your cfg in exactly the same way. By the time the PartLoader is creating parts out of the loaded models, all of that stuff has been run and shaders are in-place.
  7. That method will work (for your shader problem). What exactly is the issue? The Shader.Find API apparently requires that the shaders exist at project build time, which is why they aren't found when the PartLoader is creating materials. That's why I suggest you bypass PartLoader entirely. If you put your shader AND model into an asset bundle and then use the previously posted code to load that as though it was a model, you won't be restricted to the extremely limited stuff PartLoader does. The shaders are all in squadcore.ksp. squadcorefx contains TextMeshPro shaders. You can inspect these
  8. You shouldn't even need a loader for the shader. Make sure it's stored inside the AssetBundle itself and Unity should do the rest
  9. I haven't been up with the latest stuff so I'm not sure if it's still functional, but the limitations of the mu loader are exactly why I loaded certain assets as asset bundles instead. @Shadowmage has a version posted, in fact: If you make sure your textures are included in the bundle, you shouldn't even need any post-loading stuff
  10. It doesn't matter for the Canvas' children, but it does for the Canvas itself. Also, the Canvas appears to copy the camera's transform and rotation which means the position and orientation of the Image you're adding are relevant. Here's a fixed version: private void Start() { GameObject canvasGO = new GameObject("censorcanvas"); canvasGO.layer = 0; // must be in camera's culling mask canvasGO.AddComponent<RectTransform>(); canvas = canvasGO.AddComponent<Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceCamera; // UI elements do not show up if we use
  11. But why? Here's what I meant: private class JellyListener : MonoBehaviour { private JellyfishDishMk2 _jellydish; // your PartModule here private void Awake() { _jellydish = GetComponentInParent<JellyfishDishMk2>(); if (_jellydish == null) Debug.LogError("Didn't find expected Jellyfish PM"); } private void FirstAnimationFrame(UnityEngine.Object param) { var pm = param as JellyfishDishMk2; if (pm != null)
  12. While you could do that (any UnityEngine.Object or derived class ... like PartModule or MonoBehaviour), you don't need to. You already know exactly where your data is. You could cache the PartModule or wherever your data is being kept in whatever script you have as an event listener and call methods directly
  13. This kind of error can be a real PITA to debug, but in this case it's correct. The specific problem (at least, in my test bench of just downloading KAS 1.2 + current version of KOS) is that SaveUpgradePipeline.KAS.PatchFilesProcessor fails to load. This happens because it doesn't implement an abstract method. Between 1.6 and 1.7, UpgradeScript.OnUpgrade's signature changed. I didn't check that other mod you mentioned but I imagine something similar is going on. I don't think there's a 1.7 version of KAS yet or else this would be caught already
  14. Are you 100% sure it exported successfully? That looks like it might be the result of an incomplete model. Delete, re-export, then examine Unity console for any exceptions.
  15. You don't need ref or out here. Just use isDragging directly in the lambda functions; C# will create a closure over it and you effectively have a reference to it (although secretly the compiler creates a private inner class which is how it pulls this off). By the way, you probably don't want to be inserting triggers in OnUpdate(): every time the slider value changes, you add another set of triggers
  • Create New...