Archive for the ‘fix’ category

Shaders not loading properly in iOS Unity builds

September 24th, 2014

It’s that classic routine everything works in your game but when deploying to the device everything goes wrong, this time its due to unity’s shaders, you’ll most likely see something like this inside of the ios’s console logs

NullReferenceException
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00000] in <filename unknown>:0

So whats going on here, we can see that the error is clearly with the shaders and the issue is that it can’t seem to find it. Let’s fix it

What should happen but doesn’t work
Shaders take up disk space and theres an awful lot of shaders that you can add, unity gets around this by only including shaders that you use in the scene. However some times you only mention the shader in the code so you need to inform unity to include specified shaders this can be done by going into:
Edit -> Project Settings -> Graphics
In this menu you can amend the array to include your added shaders, however closing the application and rerunning it shows the shaders no longer there so essentially nothings being saved, somethings going wrong here, and this is why you are getting the issue

The fix
Basically these can be fixed by ensuring shaders are available in the scene in edit mode, create a new material for each shader you want to use and add each to an object, I prefer to add these as child objects to parent with an empty scale, this way you can store it as a prefab and use it on multiple scenes.

Once built the ios device should be able to find the shader and your game can load again, happy days

Torrent Linker: Update

October 29th, 2010

A while ago I came up with a python script to link torrent newly downloaded torrent files to a folder allowing you to manage data more effectively whilst seeding. However I have only just realised that the initial script does not work as the importer appears to have removed the spaces at the start of each line making the code unusable. As I cannot find my original code here is an update that also features a twitter integration to send you a twitter message when a file has completed.

All you have to do is modify the items inside of “Modify These Variables”, also ensure to set your torrent program to move your completed torrents to the ‘torrentfilesdirectory’ folder

import os
import sys
from commands import getoutput

#Declare Variables
ary_errors    = []
ary_directory = []
ary_tracker   = []
ary_torrent   = []

#Modify These Variables
torrentfilesdirectory = "/torrent/torrentfilescompleted/"
torrent_completed_dir = "/torrent/completed/"
link_directory        = "/torrent/links/"
torrent_move_to_dir   = "/torrent/torrentfilescompletedandlinked/"
twitter_username      = "##########"
twitter_password      = "##########"

#Add list of torrents into variable
torrent_list = getoutput("ls " + torrentfilesdirectory)

#=====================================================
def WorkOnTorrents(line):
 #Read data from torrent
 directory = getoutput("btshowmetainfo \"" + torrentfilesdirectory + line + "\" | grep \"directory name:\"")
 directory = directory + getoutput("btshowmetainfo \"" + torrentfilesdirectory + line + "\" | grep \"file name.....:\"")
 tracker = getoutput("btshowmetainfo \"" + torrentfilesdirectory + line + "\" | grep \"announce url..:\"")

 #Modify the directory variable
 directory = directory.split(": ")[1]

 #Modify the tracker variable
 try:
  tracker = tracker.split("\n")[0].split("/")[2].split(":")[0]
  torrent_valid = "Works"
 except:
  torrent_valid = "Fails"

 print tracker;

 #Add torrent variables to arrays
 if torrent_valid == "Works":
  # Check Against Identified Errors
  if tracker == "":
   ary_errors.append(line);
  else:
   ary_tracker.append(tracker);
   ary_directory.append(directory);
   ary_torrent.append(line);

torrent_list = torrent_list.split("\n")
for line in torrent_list:
 WorkOnTorrents(line)

#=====================================================
## Create Links
print "Executing Links"
for i in range(len(ary_tracker)):
 os.system("curl -u " + twitter_username + ":" + twitter_password + " -d status=\"" + ary_torrent[i] + "\" http://twitter.com/statuses/update.xml")
 print "Creating Link for: " + ary_torrent[i];
 if os.path.exists(link_directory + ary_tracker[i]) == 1:
  os.system("ln -s \"" + torrent_completed_dir + ary_directory[i] + "\" \"" + link_directory + ary_tracker[i] + "/" + ary_directory[i] + "\"")
 else:
  os.system("mkdir " + link_directory + ary_tracker[i])
  os.system("ln -s \"" + torrent_completed_dir + ary_directory[i] + "\" \"" + link_directory + ary_tracker[i] + "/" + ary_directory[i] + "\"")
 os.system("mv \"" + torrentfilesdirectory + ary_torrent[i] + "\" " + torrent_move_to_dir);

#=====================================================
## Display Error Torrents
if len(ary_errors) > 0:
 print "Errors Found:";
 for i in range(len(ary_errors)):
  print ary_errors[i];

"Windows is configuring Microsoft Office".. every fucking time i start it: Part 2

February 12th, 2008

So I switched on my machine today run excel, and everythings running as normal (yays) but as I check my email i ralise the dreaded setup box coming back, before throwing fist at the screen i decided to have a look what was going on, I checked the other affected applications which were now also running fine it was just outlook that had this problem

Anyway to cut a long story short I discovered that the registry permissions problem was in numerous places and the only way to fix it efficiently was to give full access to HKEY_CLASSES_ROOT. heres the how to

1) complete previous steps from yesterday
2) run Security Explorer
3) select the HKEY_CLASSES_ROOT and press F2
4) aad the user Everyone and add the users to the user box at the bottom
5) press OK to run through the Keys, this should take 10 – 15 minutes to complete, I recommend unchecking the view option as this will take longer.

Thats it. One of the other bonuses is that you won’t receive warnings on the applications about a ‘ddl file missing’. Hope this helps, bye

"Windows is configuring Microsoft Office".. every fucking time i start it

February 11th, 2008

This particular problem took me ages to fix and for anyone who has experienced this it is not a good idea to have this problem popping up everytime you open an office file, so to keep you calm heres how to fix it

Although it may not seem like it this problem is regarding the registry, however rather than being a registry incorperated into the software section, its held in HKEY_CLASSES_ROOT and more importantly its stored in the .pip folder

The problem is a privilage problem essentially the folder is currupt and includes access for no users. So onto the resolution

1) download and install an application called security explorer
2) run the application remove the folder HKEY_CLASSES_ROOT\.pip
3) run excel and ensure that all of the installations have completed then close excel
4) refresh the key data again till you see the .pip folder again
5) add your user and anyone elses user who may want to access the file or insert ‘Everyone’
6) click ok to save the changes and open up excel aagin, this should follow on to the rest of the office applications